diff options
author | Fabio Porcedda <fabio.porcedda@gmail.com> | 2013-09-16 05:47:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-16 21:38:00 -0400 |
commit | 8857ec2871c9ad39deb6800c06907f6795239eb4 (patch) | |
tree | 5cb3e426fae469507809406a5eaeba434b78b237 | |
parent | 0092820407901a0b2c4e343e85f96bb7abfcded1 (diff) |
net: usb: cdc_ether: fix checkpatch errors and warnings
Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/cdc_ether.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 98aef3bac7d8..c36b1c3c5b19 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/usb/usbnet.h> | 33 | #include <linux/usb/usbnet.h> |
34 | 34 | ||
35 | 35 | ||
36 | #if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) | 36 | #if IS_ENABLED(CONFIG_USB_NET_RNDIS_HOST) |
37 | 37 | ||
38 | static int is_rndis(struct usb_interface_descriptor *desc) | 38 | static int is_rndis(struct usb_interface_descriptor *desc) |
39 | { | 39 | { |
@@ -69,8 +69,7 @@ static const u8 mbm_guid[16] = { | |||
69 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, | 69 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | /* | 72 | /* probes control interface, claims data interface, collects the bulk |
73 | * probes control interface, claims data interface, collects the bulk | ||
74 | * endpoints, activates data interface (if needed), maybe sets MTU. | 73 | * endpoints, activates data interface (if needed), maybe sets MTU. |
75 | * all pure cdc, except for certain firmware workarounds, and knowing | 74 | * all pure cdc, except for certain firmware workarounds, and knowing |
76 | * that rndis uses one different rule. | 75 | * that rndis uses one different rule. |
@@ -88,7 +87,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
88 | struct usb_cdc_mdlm_desc *desc = NULL; | 87 | struct usb_cdc_mdlm_desc *desc = NULL; |
89 | struct usb_cdc_mdlm_detail_desc *detail = NULL; | 88 | struct usb_cdc_mdlm_detail_desc *detail = NULL; |
90 | 89 | ||
91 | if (sizeof dev->data < sizeof *info) | 90 | if (sizeof(dev->data) < sizeof(*info)) |
92 | return -EDOM; | 91 | return -EDOM; |
93 | 92 | ||
94 | /* expect strict spec conformance for the descriptors, but | 93 | /* expect strict spec conformance for the descriptors, but |
@@ -126,10 +125,10 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
126 | is_activesync(&intf->cur_altsetting->desc) || | 125 | is_activesync(&intf->cur_altsetting->desc) || |
127 | is_wireless_rndis(&intf->cur_altsetting->desc)); | 126 | is_wireless_rndis(&intf->cur_altsetting->desc)); |
128 | 127 | ||
129 | memset(info, 0, sizeof *info); | 128 | memset(info, 0, sizeof(*info)); |
130 | info->control = intf; | 129 | info->control = intf; |
131 | while (len > 3) { | 130 | while (len > 3) { |
132 | if (buf [1] != USB_DT_CS_INTERFACE) | 131 | if (buf[1] != USB_DT_CS_INTERFACE) |
133 | goto next_desc; | 132 | goto next_desc; |
134 | 133 | ||
135 | /* use bDescriptorSubType to identify the CDC descriptors. | 134 | /* use bDescriptorSubType to identify the CDC descriptors. |
@@ -139,14 +138,14 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
139 | * in favor of a complicated OID-based RPC scheme doing what | 138 | * in favor of a complicated OID-based RPC scheme doing what |
140 | * CDC Ethernet achieves with a simple descriptor. | 139 | * CDC Ethernet achieves with a simple descriptor. |
141 | */ | 140 | */ |
142 | switch (buf [2]) { | 141 | switch (buf[2]) { |
143 | case USB_CDC_HEADER_TYPE: | 142 | case USB_CDC_HEADER_TYPE: |
144 | if (info->header) { | 143 | if (info->header) { |
145 | dev_dbg(&intf->dev, "extra CDC header\n"); | 144 | dev_dbg(&intf->dev, "extra CDC header\n"); |
146 | goto bad_desc; | 145 | goto bad_desc; |
147 | } | 146 | } |
148 | info->header = (void *) buf; | 147 | info->header = (void *) buf; |
149 | if (info->header->bLength != sizeof *info->header) { | 148 | if (info->header->bLength != sizeof(*info->header)) { |
150 | dev_dbg(&intf->dev, "CDC header len %u\n", | 149 | dev_dbg(&intf->dev, "CDC header len %u\n", |
151 | info->header->bLength); | 150 | info->header->bLength); |
152 | goto bad_desc; | 151 | goto bad_desc; |
@@ -175,7 +174,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
175 | goto bad_desc; | 174 | goto bad_desc; |
176 | } | 175 | } |
177 | info->u = (void *) buf; | 176 | info->u = (void *) buf; |
178 | if (info->u->bLength != sizeof *info->u) { | 177 | if (info->u->bLength != sizeof(*info->u)) { |
179 | dev_dbg(&intf->dev, "CDC union len %u\n", | 178 | dev_dbg(&intf->dev, "CDC union len %u\n", |
180 | info->u->bLength); | 179 | info->u->bLength); |
181 | goto bad_desc; | 180 | goto bad_desc; |
@@ -233,7 +232,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
233 | goto bad_desc; | 232 | goto bad_desc; |
234 | } | 233 | } |
235 | info->ether = (void *) buf; | 234 | info->ether = (void *) buf; |
236 | if (info->ether->bLength != sizeof *info->ether) { | 235 | if (info->ether->bLength != sizeof(*info->ether)) { |
237 | dev_dbg(&intf->dev, "CDC ether len %u\n", | 236 | dev_dbg(&intf->dev, "CDC ether len %u\n", |
238 | info->ether->bLength); | 237 | info->ether->bLength); |
239 | goto bad_desc; | 238 | goto bad_desc; |
@@ -274,8 +273,8 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
274 | break; | 273 | break; |
275 | } | 274 | } |
276 | next_desc: | 275 | next_desc: |
277 | len -= buf [0]; /* bLength */ | 276 | len -= buf[0]; /* bLength */ |
278 | buf += buf [0]; | 277 | buf += buf[0]; |
279 | } | 278 | } |
280 | 279 | ||
281 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the | 280 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the |
@@ -379,9 +378,7 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
379 | } | 378 | } |
380 | EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); | 379 | EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); |
381 | 380 | ||
382 | /*------------------------------------------------------------------------- | 381 | /* Communications Device Class, Ethernet Control model |
383 | * | ||
384 | * Communications Device Class, Ethernet Control model | ||
385 | * | 382 | * |
386 | * Takes two interfaces. The DATA interface is inactive till an altsetting | 383 | * Takes two interfaces. The DATA interface is inactive till an altsetting |
387 | * is selected. Configuration data includes class descriptors. There's | 384 | * is selected. Configuration data includes class descriptors. There's |
@@ -389,8 +386,7 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); | |||
389 | * | 386 | * |
390 | * This should interop with whatever the 2.4 "CDCEther.c" driver | 387 | * This should interop with whatever the 2.4 "CDCEther.c" driver |
391 | * (by Brad Hards) talked with, with more functionality. | 388 | * (by Brad Hards) talked with, with more functionality. |
392 | * | 389 | */ |
393 | *-------------------------------------------------------------------------*/ | ||
394 | 390 | ||
395 | static void dumpspeed(struct usbnet *dev, __le32 *speeds) | 391 | static void dumpspeed(struct usbnet *dev, __le32 *speeds) |
396 | { | 392 | { |
@@ -404,7 +400,7 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb) | |||
404 | { | 400 | { |
405 | struct usb_cdc_notification *event; | 401 | struct usb_cdc_notification *event; |
406 | 402 | ||
407 | if (urb->actual_length < sizeof *event) | 403 | if (urb->actual_length < sizeof(*event)) |
408 | return; | 404 | return; |
409 | 405 | ||
410 | /* SPEED_CHANGE can get split into two 8-byte packets */ | 406 | /* SPEED_CHANGE can get split into two 8-byte packets */ |
@@ -423,7 +419,7 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb) | |||
423 | case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */ | 419 | case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */ |
424 | netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n", | 420 | netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n", |
425 | urb->actual_length); | 421 | urb->actual_length); |
426 | if (urb->actual_length != (sizeof *event + 8)) | 422 | if (urb->actual_length != (sizeof(*event) + 8)) |
427 | set_bit(EVENT_STS_SPLIT, &dev->flags); | 423 | set_bit(EVENT_STS_SPLIT, &dev->flags); |
428 | else | 424 | else |
429 | dumpspeed(dev, (__le32 *) &event[1]); | 425 | dumpspeed(dev, (__le32 *) &event[1]); |
@@ -469,7 +465,6 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_bind); | |||
469 | static const struct driver_info cdc_info = { | 465 | static const struct driver_info cdc_info = { |
470 | .description = "CDC Ethernet Device", | 466 | .description = "CDC Ethernet Device", |
471 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, | 467 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, |
472 | // .check_connect = cdc_check_connect, | ||
473 | .bind = usbnet_cdc_bind, | 468 | .bind = usbnet_cdc_bind, |
474 | .unbind = usbnet_cdc_unbind, | 469 | .unbind = usbnet_cdc_unbind, |
475 | .status = usbnet_cdc_status, | 470 | .status = usbnet_cdc_status, |
@@ -493,9 +488,8 @@ static const struct driver_info wwan_info = { | |||
493 | #define DELL_VENDOR_ID 0x413C | 488 | #define DELL_VENDOR_ID 0x413C |
494 | #define REALTEK_VENDOR_ID 0x0bda | 489 | #define REALTEK_VENDOR_ID 0x0bda |
495 | 490 | ||
496 | static const struct usb_device_id products [] = { | 491 | static const struct usb_device_id products[] = { |
497 | /* | 492 | /* BLACKLIST !! |
498 | * BLACKLIST !! | ||
499 | * | 493 | * |
500 | * First blacklist any products that are egregiously nonconformant | 494 | * First blacklist any products that are egregiously nonconformant |
501 | * with the CDC Ethernet specs. Minor braindamage we cope with; when | 495 | * with the CDC Ethernet specs. Minor braindamage we cope with; when |
@@ -542,7 +536,7 @@ static const struct usb_device_id products [] = { | |||
542 | .driver_info = 0, | 536 | .driver_info = 0, |
543 | }, { | 537 | }, { |
544 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | 538 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
545 | | USB_DEVICE_ID_MATCH_DEVICE, | 539 | | USB_DEVICE_ID_MATCH_DEVICE, |
546 | .idVendor = 0x04DD, | 540 | .idVendor = 0x04DD, |
547 | .idProduct = 0x8007, /* C-700 */ | 541 | .idProduct = 0x8007, /* C-700 */ |
548 | ZAURUS_MASTER_INTERFACE, | 542 | ZAURUS_MASTER_INTERFACE, |
@@ -659,8 +653,7 @@ static const struct usb_device_id products [] = { | |||
659 | .driver_info = 0, | 653 | .driver_info = 0, |
660 | }, | 654 | }, |
661 | 655 | ||
662 | /* | 656 | /* WHITELIST!!! |
663 | * WHITELIST!!! | ||
664 | * | 657 | * |
665 | * CDC Ether uses two interfaces, not necessarily consecutive. | 658 | * CDC Ether uses two interfaces, not necessarily consecutive. |
666 | * We match the main interface, ignoring the optional device | 659 | * We match the main interface, ignoring the optional device |
@@ -749,7 +742,7 @@ static const struct usb_device_id products [] = { | |||
749 | .bInterfaceProtocol = 255, | 742 | .bInterfaceProtocol = 255, |
750 | .driver_info = (unsigned long)&wwan_info, | 743 | .driver_info = (unsigned long)&wwan_info, |
751 | }, | 744 | }, |
752 | { }, // END | 745 | { }, /* END */ |
753 | }; | 746 | }; |
754 | MODULE_DEVICE_TABLE(usb, products); | 747 | MODULE_DEVICE_TABLE(usb, products); |
755 | 748 | ||