From: <Woojung.Huh@microchip.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: RE: [PATCH net-next 1/1] Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver
Date: Wed, 29 Jul 2015 21:57:52 +0000 [thread overview]
Message-ID: <9235D6609DB808459E95D78E17F2E43D537333@CHN-SV-EXMX02.mchp-main.com> (raw)
In-Reply-To: <20150729.121401.1138495718406304622.davem@davemloft.net>
Thanks for review and comment.
Will repost after update.
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, July 29, 2015 3:14 PM
> To: Woojung Huh - C21699
> Cc: netdev@vger.kernel.org
> Subject: Re: [PATCH net-next 1/1] Microchip's LAN7800 family USB 2/3 to
> 10/100/1000 Ethernet device driver
>
> From: <Woojung.Huh@microchip.com>
> Date: Mon, 27 Jul 2015 19:59:30 +0000
>
> > +static int lan78xx_read_stats(struct lan78xx_net *dev,
> > + struct lan78xx_statstage *data)
> > +{
> > + int ret = 0;
> > + struct lan78xx_statstage *stats;
> > +
> > + BUG_ON(!dev);
> > + BUG_ON(!data);
> > + BUG_ON(sizeof(struct lan78xx_statstage) != 0xBC);
> > +
> > + stats = kmalloc(sizeof(*stats), GFP_KERNEL);
> > + if (!stats)
> > + return -ENOMEM;
> > +
> > + ret = usb_control_msg(dev->udev,
> > + usb_rcvctrlpipe(dev->udev, 0),
> > + USB_VENDOR_REQUEST_GET_STATS,
> > + USB_DIR_IN | USB_TYPE_VENDOR |
> USB_RECIP_DEVICE,
> > + 0,
> > + 0,
> > + (void *)stats,
> > + sizeof(*stats),
> > + USB_CTRL_SET_TIMEOUT);
> > + if (likely(ret >= 0)) {
> > + le32_to_cpus(stats);
> > + *data = *stats;
>
> This doesn't work.
>
> le32_to_cpus() will only byte swap the first 'u32' in this statistics structure,
> not all of them.
>
> You have to explicitly byte swap each and every member.
next prev parent reply other threads:[~2015-07-29 21:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 19:59 [PATCH net-next 1/1] Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver Woojung.Huh
2015-07-29 19:14 ` David Miller
2015-07-29 21:57 ` Woojung.Huh [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-07-30 19:45 Woojung.Huh
2015-07-31 22:19 ` David Miller
2015-07-31 22:26 ` Woojung.Huh
2015-07-22 19:01 Woojung.Huh
2015-07-26 23:42 ` David Miller
2015-07-27 14:29 ` Woojung.Huh
2015-07-16 22:16 Woojung.Huh
2015-07-21 3:44 ` David Miller
2015-07-22 16:25 ` Woojung.Huh
2015-07-22 18:06 ` David Miller
2015-07-22 18:29 ` Woojung.Huh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9235D6609DB808459E95D78E17F2E43D537333@CHN-SV-EXMX02.mchp-main.com \
--to=woojung.huh@microchip.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).