.. | .. |
---|
45 | 45 | |
---|
46 | 46 | static bool nmea; |
---|
47 | 47 | |
---|
48 | | -/* Used in interface blacklisting */ |
---|
49 | | -struct sierra_iface_info { |
---|
50 | | - const u32 infolen; /* number of interface numbers on blacklist */ |
---|
51 | | - const u8 *ifaceinfo; /* pointer to the array holding the numbers */ |
---|
| 48 | +struct sierra_iface_list { |
---|
| 49 | + const u8 *nums; /* array of interface numbers */ |
---|
| 50 | + size_t count; /* number of elements in array */ |
---|
52 | 51 | }; |
---|
53 | 52 | |
---|
54 | 53 | struct sierra_intf_private { |
---|
.. | .. |
---|
101 | 100 | return num_ports; |
---|
102 | 101 | } |
---|
103 | 102 | |
---|
104 | | -static int is_blacklisted(const u8 ifnum, |
---|
105 | | - const struct sierra_iface_info *blacklist) |
---|
| 103 | +static bool is_listed(const u8 ifnum, const struct sierra_iface_list *list) |
---|
106 | 104 | { |
---|
107 | | - const u8 *info; |
---|
108 | 105 | int i; |
---|
109 | 106 | |
---|
110 | | - if (blacklist) { |
---|
111 | | - info = blacklist->ifaceinfo; |
---|
| 107 | + if (!list) |
---|
| 108 | + return false; |
---|
112 | 109 | |
---|
113 | | - for (i = 0; i < blacklist->infolen; i++) { |
---|
114 | | - if (info[i] == ifnum) |
---|
115 | | - return 1; |
---|
116 | | - } |
---|
| 110 | + for (i = 0; i < list->count; i++) { |
---|
| 111 | + if (list->nums[i] == ifnum) |
---|
| 112 | + return true; |
---|
117 | 113 | } |
---|
118 | | - return 0; |
---|
119 | | -} |
---|
120 | 114 | |
---|
121 | | -static int is_himemory(const u8 ifnum, |
---|
122 | | - const struct sierra_iface_info *himemorylist) |
---|
123 | | -{ |
---|
124 | | - const u8 *info; |
---|
125 | | - int i; |
---|
126 | | - |
---|
127 | | - if (himemorylist) { |
---|
128 | | - info = himemorylist->ifaceinfo; |
---|
129 | | - |
---|
130 | | - for (i=0; i < himemorylist->infolen; i++) { |
---|
131 | | - if (info[i] == ifnum) |
---|
132 | | - return 1; |
---|
133 | | - } |
---|
134 | | - } |
---|
135 | | - return 0; |
---|
| 115 | + return false; |
---|
136 | 116 | } |
---|
137 | 117 | |
---|
138 | 118 | static u8 sierra_interface_num(struct usb_serial *serial) |
---|
.. | .. |
---|
143 | 123 | static int sierra_probe(struct usb_serial *serial, |
---|
144 | 124 | const struct usb_device_id *id) |
---|
145 | 125 | { |
---|
| 126 | + const struct sierra_iface_list *ignore_list; |
---|
146 | 127 | int result = 0; |
---|
147 | 128 | struct usb_device *udev; |
---|
148 | 129 | u8 ifnum; |
---|
.. | .. |
---|
161 | 142 | usb_set_interface(udev, ifnum, 1); |
---|
162 | 143 | } |
---|
163 | 144 | |
---|
164 | | - if (is_blacklisted(ifnum, |
---|
165 | | - (struct sierra_iface_info *)id->driver_info)) { |
---|
166 | | - dev_dbg(&serial->dev->dev, |
---|
167 | | - "Ignoring blacklisted interface #%d\n", ifnum); |
---|
| 145 | + ignore_list = (const struct sierra_iface_list *)id->driver_info; |
---|
| 146 | + |
---|
| 147 | + if (is_listed(ifnum, ignore_list)) { |
---|
| 148 | + dev_dbg(&serial->dev->dev, "Ignoring interface #%d\n", ifnum); |
---|
168 | 149 | return -ENODEV; |
---|
169 | 150 | } |
---|
170 | 151 | |
---|
.. | .. |
---|
173 | 154 | |
---|
174 | 155 | /* interfaces with higher memory requirements */ |
---|
175 | 156 | static const u8 hi_memory_typeA_ifaces[] = { 0, 2 }; |
---|
176 | | -static const struct sierra_iface_info typeA_interface_list = { |
---|
177 | | - .infolen = ARRAY_SIZE(hi_memory_typeA_ifaces), |
---|
178 | | - .ifaceinfo = hi_memory_typeA_ifaces, |
---|
| 157 | +static const struct sierra_iface_list typeA_interface_list = { |
---|
| 158 | + .nums = hi_memory_typeA_ifaces, |
---|
| 159 | + .count = ARRAY_SIZE(hi_memory_typeA_ifaces), |
---|
179 | 160 | }; |
---|
180 | 161 | |
---|
181 | 162 | static const u8 hi_memory_typeB_ifaces[] = { 3, 4, 5, 6 }; |
---|
182 | | -static const struct sierra_iface_info typeB_interface_list = { |
---|
183 | | - .infolen = ARRAY_SIZE(hi_memory_typeB_ifaces), |
---|
184 | | - .ifaceinfo = hi_memory_typeB_ifaces, |
---|
| 163 | +static const struct sierra_iface_list typeB_interface_list = { |
---|
| 164 | + .nums = hi_memory_typeB_ifaces, |
---|
| 165 | + .count = ARRAY_SIZE(hi_memory_typeB_ifaces), |
---|
185 | 166 | }; |
---|
186 | 167 | |
---|
187 | | -/* 'blacklist' of interfaces not served by this driver */ |
---|
| 168 | +/* 'ignorelist' of interfaces not served by this driver */ |
---|
188 | 169 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 }; |
---|
189 | | -static const struct sierra_iface_info direct_ip_interface_blacklist = { |
---|
190 | | - .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), |
---|
191 | | - .ifaceinfo = direct_ip_non_serial_ifaces, |
---|
| 170 | +static const struct sierra_iface_list direct_ip_interface_ignore = { |
---|
| 171 | + .nums = direct_ip_non_serial_ifaces, |
---|
| 172 | + .count = ARRAY_SIZE(direct_ip_non_serial_ifaces), |
---|
192 | 173 | }; |
---|
193 | 174 | |
---|
194 | 175 | static const struct usb_device_id id_table[] = { |
---|
.. | .. |
---|
264 | 245 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
---|
265 | 246 | /* Sierra Wireless Direct IP modems */ |
---|
266 | 247 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68A3, 0xFF, 0xFF, 0xFF), |
---|
267 | | - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
---|
| 248 | + .driver_info = (kernel_ulong_t)&direct_ip_interface_ignore |
---|
268 | 249 | }, |
---|
269 | 250 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), |
---|
270 | | - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
---|
| 251 | + .driver_info = (kernel_ulong_t)&direct_ip_interface_ignore |
---|
271 | 252 | }, |
---|
272 | 253 | { USB_DEVICE(0x1199, 0x68AB) }, /* Sierra Wireless AR8550 */ |
---|
273 | 254 | /* AT&T Direct IP LTE modems */ |
---|
274 | 255 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), |
---|
275 | | - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
---|
| 256 | + .driver_info = (kernel_ulong_t)&direct_ip_interface_ignore |
---|
276 | 257 | }, |
---|
277 | 258 | /* Airprime/Sierra Wireless Direct IP modems */ |
---|
278 | 259 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68A3, 0xFF, 0xFF, 0xFF), |
---|
279 | | - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
---|
| 260 | + .driver_info = (kernel_ulong_t)&direct_ip_interface_ignore |
---|
280 | 261 | }, |
---|
281 | 262 | |
---|
282 | 263 | { } |
---|
.. | .. |
---|
589 | 570 | urb, port, portdata); |
---|
590 | 571 | |
---|
591 | 572 | if (status == 0) { |
---|
592 | | - struct usb_ctrlrequest *req_pkt = |
---|
593 | | - (struct usb_ctrlrequest *)urb->transfer_buffer; |
---|
| 573 | + struct usb_ctrlrequest *req_pkt = urb->transfer_buffer; |
---|
594 | 574 | |
---|
595 | 575 | if (!req_pkt) { |
---|
596 | 576 | dev_dbg(&port->dev, "%s: NULL req_pkt\n", |
---|
.. | .. |
---|
757 | 737 | |
---|
758 | 738 | /* |
---|
759 | 739 | * Need to take susp_lock to make sure port is not already being |
---|
760 | | - * resumed, but no need to hold it due to initialized |
---|
| 740 | + * resumed, but no need to hold it due to the tty-port initialized |
---|
| 741 | + * flag. |
---|
761 | 742 | */ |
---|
762 | 743 | spin_lock_irq(&intfdata->susp_lock); |
---|
763 | 744 | if (--intfdata->open_ports == 0) |
---|
.. | .. |
---|
879 | 860 | { |
---|
880 | 861 | struct usb_serial *serial = port->serial; |
---|
881 | 862 | struct sierra_port_private *portdata; |
---|
882 | | - const struct sierra_iface_info *himemoryp; |
---|
| 863 | + const struct sierra_iface_list *himemory_list; |
---|
883 | 864 | u8 ifnum; |
---|
884 | 865 | |
---|
885 | 866 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
---|
.. | .. |
---|
898 | 879 | if (serial->num_ports == 1) { |
---|
899 | 880 | /* Get interface number for composite device */ |
---|
900 | 881 | ifnum = sierra_interface_num(serial); |
---|
901 | | - himemoryp = &typeB_interface_list; |
---|
| 882 | + himemory_list = &typeB_interface_list; |
---|
902 | 883 | } else { |
---|
903 | 884 | /* This is really the usb-serial port number of the interface |
---|
904 | 885 | * rather than the interface number. |
---|
905 | 886 | */ |
---|
906 | 887 | ifnum = port->port_number; |
---|
907 | | - himemoryp = &typeA_interface_list; |
---|
| 888 | + himemory_list = &typeA_interface_list; |
---|
908 | 889 | } |
---|
909 | 890 | |
---|
910 | | - if (is_himemory(ifnum, himemoryp)) { |
---|
| 891 | + if (is_listed(ifnum, himemory_list)) { |
---|
911 | 892 | portdata->num_out_urbs = N_OUT_URB_HM; |
---|
912 | 893 | portdata->num_in_urbs = N_IN_URB_HM; |
---|
913 | 894 | } |
---|