diff options
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/catc.c | 8 | ||||
-rw-r--r-- | drivers/net/usb/cdc-phonet.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/qmi_wwan.c | 57 |
3 files changed, 42 insertions, 25 deletions
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index 8d5cac2d8e33..df507e6dbb9c 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -640,10 +640,10 @@ static void catc_set_multicast_list(struct net_device *netdev) | |||
640 | { | 640 | { |
641 | struct catc *catc = netdev_priv(netdev); | 641 | struct catc *catc = netdev_priv(netdev); |
642 | struct netdev_hw_addr *ha; | 642 | struct netdev_hw_addr *ha; |
643 | u8 broadcast[6]; | 643 | u8 broadcast[ETH_ALEN]; |
644 | u8 rx = RxEnable | RxPolarity | RxMultiCast; | 644 | u8 rx = RxEnable | RxPolarity | RxMultiCast; |
645 | 645 | ||
646 | memset(broadcast, 0xff, 6); | 646 | memset(broadcast, 0xff, ETH_ALEN); |
647 | memset(catc->multicast, 0, 64); | 647 | memset(catc->multicast, 0, 64); |
648 | 648 | ||
649 | catc_multicast(broadcast, catc->multicast); | 649 | catc_multicast(broadcast, catc->multicast); |
@@ -778,7 +778,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
778 | struct usb_device *usbdev = interface_to_usbdev(intf); | 778 | struct usb_device *usbdev = interface_to_usbdev(intf); |
779 | struct net_device *netdev; | 779 | struct net_device *netdev; |
780 | struct catc *catc; | 780 | struct catc *catc; |
781 | u8 broadcast[6]; | 781 | u8 broadcast[ETH_ALEN]; |
782 | int i, pktsz; | 782 | int i, pktsz; |
783 | 783 | ||
784 | if (usb_set_interface(usbdev, | 784 | if (usb_set_interface(usbdev, |
@@ -882,7 +882,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
882 | 882 | ||
883 | dev_dbg(dev, "Filling the multicast list.\n"); | 883 | dev_dbg(dev, "Filling the multicast list.\n"); |
884 | 884 | ||
885 | memset(broadcast, 0xff, 6); | 885 | memset(broadcast, 0xff, ETH_ALEN); |
886 | catc_multicast(broadcast, catc->multicast); | 886 | catc_multicast(broadcast, catc->multicast); |
887 | catc_multicast(netdev->dev_addr, catc->multicast); | 887 | catc_multicast(netdev->dev_addr, catc->multicast); |
888 | catc_write_mem(catc, 0xfa80, catc->multicast, 64); | 888 | catc_write_mem(catc, 0xfa80, catc->multicast, 64); |
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index 7d78669000d7..6358d420e185 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c | |||
@@ -328,7 +328,7 @@ MODULE_DEVICE_TABLE(usb, usbpn_ids); | |||
328 | 328 | ||
329 | static struct usb_driver usbpn_driver; | 329 | static struct usb_driver usbpn_driver; |
330 | 330 | ||
331 | int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id) | 331 | static int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id) |
332 | { | 332 | { |
333 | static const char ifname[] = "usbpn%d"; | 333 | static const char ifname[] = "usbpn%d"; |
334 | const struct usb_cdc_union_desc *union_header = NULL; | 334 | const struct usb_cdc_union_desc *union_header = NULL; |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 818ce90185b5..e0a4a2b08e45 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -143,16 +143,22 @@ static const struct net_device_ops qmi_wwan_netdev_ops = { | |||
143 | .ndo_validate_addr = eth_validate_addr, | 143 | .ndo_validate_addr = eth_validate_addr, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | /* using a counter to merge subdriver requests with our own into a combined state */ | 146 | /* using a counter to merge subdriver requests with our own into a |
147 | * combined state | ||
148 | */ | ||
147 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) | 149 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) |
148 | { | 150 | { |
149 | struct qmi_wwan_state *info = (void *)&dev->data; | 151 | struct qmi_wwan_state *info = (void *)&dev->data; |
150 | int rv = 0; | 152 | int rv = 0; |
151 | 153 | ||
152 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on); | 154 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, |
155 | atomic_read(&info->pmcount), on); | ||
153 | 156 | ||
154 | if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) { | 157 | if ((on && atomic_add_return(1, &info->pmcount) == 1) || |
155 | /* need autopm_get/put here to ensure the usbcore sees the new value */ | 158 | (!on && atomic_dec_and_test(&info->pmcount))) { |
159 | /* need autopm_get/put here to ensure the usbcore sees | ||
160 | * the new value | ||
161 | */ | ||
156 | rv = usb_autopm_get_interface(dev->intf); | 162 | rv = usb_autopm_get_interface(dev->intf); |
157 | if (rv < 0) | 163 | if (rv < 0) |
158 | goto err; | 164 | goto err; |
@@ -199,7 +205,8 @@ static int qmi_wwan_register_subdriver(struct usbnet *dev) | |||
199 | atomic_set(&info->pmcount, 0); | 205 | atomic_set(&info->pmcount, 0); |
200 | 206 | ||
201 | /* register subdriver */ | 207 | /* register subdriver */ |
202 | subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 4096, &qmi_wwan_cdc_wdm_manage_power); | 208 | subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, |
209 | 4096, &qmi_wwan_cdc_wdm_manage_power); | ||
203 | if (IS_ERR(subdriver)) { | 210 | if (IS_ERR(subdriver)) { |
204 | dev_err(&info->control->dev, "subdriver registration failed\n"); | 211 | dev_err(&info->control->dev, "subdriver registration failed\n"); |
205 | rv = PTR_ERR(subdriver); | 212 | rv = PTR_ERR(subdriver); |
@@ -228,7 +235,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
228 | struct usb_driver *driver = driver_of(intf); | 235 | struct usb_driver *driver = driver_of(intf); |
229 | struct qmi_wwan_state *info = (void *)&dev->data; | 236 | struct qmi_wwan_state *info = (void *)&dev->data; |
230 | 237 | ||
231 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); | 238 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < |
239 | sizeof(struct qmi_wwan_state))); | ||
232 | 240 | ||
233 | /* set up initial state */ | 241 | /* set up initial state */ |
234 | info->control = intf; | 242 | info->control = intf; |
@@ -250,7 +258,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
250 | goto err; | 258 | goto err; |
251 | } | 259 | } |
252 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { | 260 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { |
253 | dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength); | 261 | dev_dbg(&intf->dev, "CDC header len %u\n", |
262 | h->bLength); | ||
254 | goto err; | 263 | goto err; |
255 | } | 264 | } |
256 | break; | 265 | break; |
@@ -260,7 +269,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
260 | goto err; | 269 | goto err; |
261 | } | 270 | } |
262 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { | 271 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { |
263 | dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength); | 272 | dev_dbg(&intf->dev, "CDC union len %u\n", |
273 | h->bLength); | ||
264 | goto err; | 274 | goto err; |
265 | } | 275 | } |
266 | cdc_union = (struct usb_cdc_union_desc *)buf; | 276 | cdc_union = (struct usb_cdc_union_desc *)buf; |
@@ -271,15 +281,15 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
271 | goto err; | 281 | goto err; |
272 | } | 282 | } |
273 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { | 283 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { |
274 | dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength); | 284 | dev_dbg(&intf->dev, "CDC ether len %u\n", |
285 | h->bLength); | ||
275 | goto err; | 286 | goto err; |
276 | } | 287 | } |
277 | cdc_ether = (struct usb_cdc_ether_desc *)buf; | 288 | cdc_ether = (struct usb_cdc_ether_desc *)buf; |
278 | break; | 289 | break; |
279 | } | 290 | } |
280 | 291 | ||
281 | /* | 292 | /* Remember which CDC functional descriptors we've seen. Works |
282 | * Remember which CDC functional descriptors we've seen. Works | ||
283 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE | 293 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE |
284 | * (0x0f) is the highest numbered | 294 | * (0x0f) is the highest numbered |
285 | */ | 295 | */ |
@@ -293,10 +303,14 @@ next_desc: | |||
293 | 303 | ||
294 | /* Use separate control and data interfaces if we found a CDC Union */ | 304 | /* Use separate control and data interfaces if we found a CDC Union */ |
295 | if (cdc_union) { | 305 | if (cdc_union) { |
296 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); | 306 | info->data = usb_ifnum_to_if(dev->udev, |
297 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || !info->data) { | 307 | cdc_union->bSlaveInterface0); |
298 | dev_err(&intf->dev, "bogus CDC Union: master=%u, slave=%u\n", | 308 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || |
299 | cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0); | 309 | !info->data) { |
310 | dev_err(&intf->dev, | ||
311 | "bogus CDC Union: master=%u, slave=%u\n", | ||
312 | cdc_union->bMasterInterface0, | ||
313 | cdc_union->bSlaveInterface0); | ||
300 | goto err; | 314 | goto err; |
301 | } | 315 | } |
302 | } | 316 | } |
@@ -374,8 +388,7 @@ static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) | |||
374 | struct qmi_wwan_state *info = (void *)&dev->data; | 388 | struct qmi_wwan_state *info = (void *)&dev->data; |
375 | int ret; | 389 | int ret; |
376 | 390 | ||
377 | /* | 391 | /* Both usbnet_suspend() and subdriver->suspend() MUST return 0 |
378 | * Both usbnet_suspend() and subdriver->suspend() MUST return 0 | ||
379 | * in system sleep context, otherwise, the resume callback has | 392 | * in system sleep context, otherwise, the resume callback has |
380 | * to recover device from previous suspend failure. | 393 | * to recover device from previous suspend failure. |
381 | */ | 394 | */ |
@@ -383,7 +396,8 @@ static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) | |||
383 | if (ret < 0) | 396 | if (ret < 0) |
384 | goto err; | 397 | goto err; |
385 | 398 | ||
386 | if (intf == info->control && info->subdriver && info->subdriver->suspend) | 399 | if (intf == info->control && info->subdriver && |
400 | info->subdriver->suspend) | ||
387 | ret = info->subdriver->suspend(intf, message); | 401 | ret = info->subdriver->suspend(intf, message); |
388 | if (ret < 0) | 402 | if (ret < 0) |
389 | usbnet_resume(intf); | 403 | usbnet_resume(intf); |
@@ -396,7 +410,8 @@ static int qmi_wwan_resume(struct usb_interface *intf) | |||
396 | struct usbnet *dev = usb_get_intfdata(intf); | 410 | struct usbnet *dev = usb_get_intfdata(intf); |
397 | struct qmi_wwan_state *info = (void *)&dev->data; | 411 | struct qmi_wwan_state *info = (void *)&dev->data; |
398 | int ret = 0; | 412 | int ret = 0; |
399 | bool callsub = (intf == info->control && info->subdriver && info->subdriver->resume); | 413 | bool callsub = (intf == info->control && info->subdriver && |
414 | info->subdriver->resume); | ||
400 | 415 | ||
401 | if (callsub) | 416 | if (callsub) |
402 | ret = info->subdriver->resume(intf); | 417 | ret = info->subdriver->resume(intf); |
@@ -714,6 +729,7 @@ static const struct usb_device_id products[] = { | |||
714 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 729 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
715 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ | 730 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ |
716 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 731 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
732 | {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ | ||
717 | {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */ | 733 | {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */ |
718 | {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ | 734 | {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ |
719 | 735 | ||
@@ -777,7 +793,8 @@ static const struct usb_device_id products[] = { | |||
777 | }; | 793 | }; |
778 | MODULE_DEVICE_TABLE(usb, products); | 794 | MODULE_DEVICE_TABLE(usb, products); |
779 | 795 | ||
780 | static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) | 796 | static int qmi_wwan_probe(struct usb_interface *intf, |
797 | const struct usb_device_id *prod) | ||
781 | { | 798 | { |
782 | struct usb_device_id *id = (struct usb_device_id *)prod; | 799 | struct usb_device_id *id = (struct usb_device_id *)prod; |
783 | 800 | ||