diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-01-27 11:15:39 -0500 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-01-28 08:47:05 -0500 |
commit | d6b5f30d9886a4f1e00c9bf355af2a95cabafa09 (patch) | |
tree | e7d701c9f89c5c678a9c8a3fb107702dfcefe9bc /drivers/net/can | |
parent | 0adfd7335b622ca3cac94810487db470f57892fc (diff) |
can: peak_usb: constify struct peak_usb_adapter
A "struct peak_usb_adapter" describes a certain USB adapter, as this doesn't
change during runtime, this patch marks all USB adapter definitions as const.
Acked-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/usb/peak_usb/pcan_usb.c | 2 | ||||
-rw-r--r-- | drivers/net/can/usb/peak_usb/pcan_usb_core.c | 8 | ||||
-rw-r--r-- | drivers/net/can/usb/peak_usb/pcan_usb_core.h | 10 | ||||
-rw-r--r-- | drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index 2a1c9ce53fae..d57d3f64a5bf 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c | |||
@@ -855,7 +855,7 @@ static int pcan_usb_probe(struct usb_interface *intf) | |||
855 | /* | 855 | /* |
856 | * describe the PCAN-USB adapter | 856 | * describe the PCAN-USB adapter |
857 | */ | 857 | */ |
858 | struct peak_usb_adapter pcan_usb = { | 858 | const struct peak_usb_adapter pcan_usb = { |
859 | .name = "PCAN-USB", | 859 | .name = "PCAN-USB", |
860 | .device_id = PCAN_USB_PRODUCT_ID, | 860 | .device_id = PCAN_USB_PRODUCT_ID, |
861 | .ctrl_count = 1, | 861 | .ctrl_count = 1, |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c index 26c0cc3ce3b2..729b80d78322 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c | |||
@@ -43,7 +43,7 @@ static struct usb_device_id peak_usb_table[] = { | |||
43 | MODULE_DEVICE_TABLE(usb, peak_usb_table); | 43 | MODULE_DEVICE_TABLE(usb, peak_usb_table); |
44 | 44 | ||
45 | /* List of supported PCAN-USB adapters (NULL terminated list) */ | 45 | /* List of supported PCAN-USB adapters (NULL terminated list) */ |
46 | static struct peak_usb_adapter *peak_usb_adapters_list[] = { | 46 | static const struct peak_usb_adapter *const peak_usb_adapters_list[] = { |
47 | &pcan_usb, | 47 | &pcan_usb, |
48 | &pcan_usb_pro, | 48 | &pcan_usb_pro, |
49 | }; | 49 | }; |
@@ -64,7 +64,7 @@ void pcan_dump_mem(char *prompt, void *p, int l) | |||
64 | * initialize a time_ref object with usb adapter own settings | 64 | * initialize a time_ref object with usb adapter own settings |
65 | */ | 65 | */ |
66 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, | 66 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, |
67 | struct peak_usb_adapter *adapter) | 67 | const struct peak_usb_adapter *adapter) |
68 | { | 68 | { |
69 | if (time_ref) { | 69 | if (time_ref) { |
70 | memset(time_ref, 0, sizeof(struct peak_time_ref)); | 70 | memset(time_ref, 0, sizeof(struct peak_time_ref)); |
@@ -708,7 +708,7 @@ static const struct net_device_ops peak_usb_netdev_ops = { | |||
708 | * create one device which is attached to CAN controller #ctrl_idx of the | 708 | * create one device which is attached to CAN controller #ctrl_idx of the |
709 | * usb adapter. | 709 | * usb adapter. |
710 | */ | 710 | */ |
711 | static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, | 711 | static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, |
712 | struct usb_interface *intf, int ctrl_idx) | 712 | struct usb_interface *intf, int ctrl_idx) |
713 | { | 713 | { |
714 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 714 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
@@ -856,7 +856,7 @@ static int peak_usb_probe(struct usb_interface *intf, | |||
856 | { | 856 | { |
857 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 857 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
858 | const u16 usb_id_product = le16_to_cpu(usb_dev->descriptor.idProduct); | 858 | const u16 usb_id_product = le16_to_cpu(usb_dev->descriptor.idProduct); |
859 | struct peak_usb_adapter *peak_usb_adapter = NULL; | 859 | const struct peak_usb_adapter *peak_usb_adapter = NULL; |
860 | int i, err = -ENOMEM; | 860 | int i, err = -ENOMEM; |
861 | 861 | ||
862 | usb_dev = interface_to_usbdev(intf); | 862 | usb_dev = interface_to_usbdev(intf); |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h index 073b47ff8eee..10f2fcac7c13 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h | |||
@@ -78,15 +78,15 @@ struct peak_usb_adapter { | |||
78 | int sizeof_dev_private; | 78 | int sizeof_dev_private; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | extern struct peak_usb_adapter pcan_usb; | 81 | extern const struct peak_usb_adapter pcan_usb; |
82 | extern struct peak_usb_adapter pcan_usb_pro; | 82 | extern const struct peak_usb_adapter pcan_usb_pro; |
83 | 83 | ||
84 | struct peak_time_ref { | 84 | struct peak_time_ref { |
85 | struct timeval tv_host_0, tv_host; | 85 | struct timeval tv_host_0, tv_host; |
86 | u32 ts_dev_1, ts_dev_2; | 86 | u32 ts_dev_1, ts_dev_2; |
87 | u64 ts_total; | 87 | u64 ts_total; |
88 | u32 tick_count; | 88 | u32 tick_count; |
89 | struct peak_usb_adapter *adapter; | 89 | const struct peak_usb_adapter *adapter; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct peak_tx_urb_context { | 92 | struct peak_tx_urb_context { |
@@ -102,7 +102,7 @@ struct peak_tx_urb_context { | |||
102 | /* PEAK-System USB device */ | 102 | /* PEAK-System USB device */ |
103 | struct peak_usb_device { | 103 | struct peak_usb_device { |
104 | struct can_priv can; | 104 | struct can_priv can; |
105 | struct peak_usb_adapter *adapter; | 105 | const struct peak_usb_adapter *adapter; |
106 | unsigned int ctrl_idx; | 106 | unsigned int ctrl_idx; |
107 | u32 state; | 107 | u32 state; |
108 | 108 | ||
@@ -134,7 +134,7 @@ void pcan_dump_mem(char *prompt, void *p, int l); | |||
134 | 134 | ||
135 | /* common timestamp management */ | 135 | /* common timestamp management */ |
136 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, | 136 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, |
137 | struct peak_usb_adapter *adapter); | 137 | const struct peak_usb_adapter *adapter); |
138 | void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now); | 138 | void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now); |
139 | void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now); | 139 | void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now); |
140 | void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts, | 140 | void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts, |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 145fa87c31b9..56855b2b1fa1 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -1012,7 +1012,7 @@ static int pcan_usb_pro_probe(struct usb_interface *intf) | |||
1012 | /* | 1012 | /* |
1013 | * describe the PCAN-USB Pro adapter | 1013 | * describe the PCAN-USB Pro adapter |
1014 | */ | 1014 | */ |
1015 | struct peak_usb_adapter pcan_usb_pro = { | 1015 | const struct peak_usb_adapter pcan_usb_pro = { |
1016 | .name = "PCAN-USB Pro", | 1016 | .name = "PCAN-USB Pro", |
1017 | .device_id = PCAN_USBPRO_PRODUCT_ID, | 1017 | .device_id = PCAN_USBPRO_PRODUCT_ID, |
1018 | .ctrl_count = PCAN_USBPRO_CHANNEL_COUNT, | 1018 | .ctrl_count = PCAN_USBPRO_CHANNEL_COUNT, |