linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, David.Laight@aculab.com,
	oneukum@suse.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kernel@lists.codethink.co.uk
Subject: usbnet: smsc95xx: simplify tx_fixup code
Date: Sat, 06 Oct 2018 12:27:27 +0100	[thread overview]
Message-ID: <40033993674bb8b5ef33ac33f28f3aff@codethink.co.uk> (raw)

On 2018-10-05 22:24, David Miller wrote:
> From: Ben Dooks <ben.dooks@codethink.co.uk>
> Date: Tue,  2 Oct 2018 17:56:02 +0100
> 
>> -	memcpy(skb->data, &tx_cmd_a, 4);
>> +	ptr = skb_push(skb, 8);
>> +	tx_cmd_a = cpu_to_le32(tx_cmd_a);
>> +	tx_cmd_b = cpu_to_le32(tx_cmd_b);
>> +	memcpy(ptr, &tx_cmd_a, 4);
>> +	memcpy(ptr+4, &tx_cmd_b, 4);
> 
> Even a memcpy() through a void pointer does not guarantee that gcc will
> not emit word sized loads and stores.
> 
> You must use the get_unaligned()/put_unaligned() facilities to do this
> properly.

Thanks, got a new version of the series just being tested with this.
Should it go into the original, or as a separate change?

> 
> I also agree that making a proper type and structure instead of using
> a void pointer would be better.

             reply	other threads:[~2018-10-06 11:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-06 11:27 Ben Dooks [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-10-08  8:41 usbnet: smsc95xx: simplify tx_fixup code David Laight
2018-10-06 17:28 David Miller
2018-10-05 21:24 David Miller
2018-10-03 16:25 Ben Dooks
2018-10-03 13:36 David Laight
2018-10-02 16:56 Ben Dooks

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=40033993674bb8b5ef33ac33f28f3aff@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=David.Laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.com \
    /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).