> -----Original Message----- > From: netdev-owner@xxxxxxxxxxxxxxx > [mailto:netdev-owner@xxxxxxxxxxxxxxx] On Behalf Of Linus Walleij > Sent: 01 May 2012 19:15 > To: netdev@xxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; Greg > Kroah-Hartman; David S. Miller; Felipe Balbi > Cc: Jussi Kivilinna; Haiyang Zhang; Wei Yongjun; Ben > Hutchings; Linus Walleij > Subject: [PATCH 01/14 v3] usb/net: rndis: inline the > cpu_to_le32() macro > > The header file <linux/usb/rndis_host.h> used a number of #defines > that included the cpu_to_le32() macro to assure the result will be > in LE endianness. Inlining this into the code instead of using it > in the code definitions yields consolidation opportunities later > on as you will see in the following patches. The individual > drivers also used local defines - all are switched over to the > pattern of doing the conversion at the call sites instead. > > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> > --- > drivers/net/usb/rndis_host.c | 52 +++++++------- > drivers/net/wireless/rndis_wlan.c | 138 > +++++++++++++++++++------------------ > include/linux/usb/rndis_host.h | 84 +++++++++++----------- > 3 files changed, 139 insertions(+), 135 deletions(-) > > diff --git a/drivers/net/usb/rndis_host.c > b/drivers/net/usb/rndis_host.c > index c8f1b5b..05cad0b 100644 > --- a/drivers/net/usb/rndis_host.c > +++ b/drivers/net/usb/rndis_host.c > @@ -78,10 +78,10 @@ static void rndis_msg_indicate(struct > usbnet *dev, struct rndis_indicate *msg, > dev->driver_info->indication(dev, msg, buflen); > } else { > switch (msg->status) { > - case RNDIS_STATUS_MEDIA_CONNECT: > + case cpu_to_le32(RNDIS_STATUS_MEDIA_CONNECT): > dev_info(udev, "rndis media connect\n"); > break; I don't actually see how this helps! It seems to make the code more unreadable and more likely to be wrong (due to typos/coding slipups etc). I didn't see anything in the earlier versions of the patches where leaving the constants 'host endian' helped. I also actually suspect that the generated code for some of the switch statements would be better if the 'status' were byteswapped. In particular it might allow the compiler to use a jump table (when all the case labels are in one set of values). David -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html