As usual, a global that's only ever read during match and attach.
The device type pointer gets stored in the softc, so that member must be
const as well.

Builds on amd64 but I don't have Apple notebooks to run-test:
ffffffff820dd550 l     O .rodata        0000000000000410 ubcmtp_devices

Tests? OK?

Index: ubcmtp.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ubcmtp.c,v
retrieving revision 1.23
diff -u -p -r1.23 ubcmtp.c
--- ubcmtp.c    22 Nov 2021 22:12:37 -0000      1.23
+++ ubcmtp.c    21 Oct 2022 18:26:19 -0000
@@ -135,7 +135,7 @@ struct ubcmtp_dev {
        struct ubcmtp_limit l_orientation;
 };
 
-static struct ubcmtp_dev ubcmtp_devices[] = {
+static const struct ubcmtp_dev ubcmtp_devices[] = {
        /* type 1 devices with separate buttons */
        {
                USB_VENDOR_APPLE,
@@ -312,7 +312,7 @@ static struct ubcmtp_dev ubcmtp_devices[
 struct ubcmtp_softc {
        struct device           sc_dev;         /* base device */
 
-       struct ubcmtp_dev       *dev_type;
+       const struct ubcmtp_dev *dev_type;
 
        struct usbd_device      *sc_udev;
        struct device           *sc_wsmousedev;

Reply via email to