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