linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: ims-pcu - remove unneeded get_unaligned_xxx
Date: Fri, 3 Jan 2014 22:16:50 -0800	[thread overview]
Message-ID: <20140104061650.GB20272@core.coreip.homeip.net> (raw)
In-Reply-To: <CAHQ1cqG2=CX6ypONUgVgzjG_3nVJOBLq5LPYwN0BrzwOLCTxzQ@mail.gmail.com>

On Fri, Jan 03, 2014 at 09:52:25PM -0800, Andrey Smirnov wrote:
> On Fri, Jan 3, 2014 at 9:28 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > pcu->cmd_buf[IMS_PCU_DATA_OFFSET] is word aligned so we do not need to use
> > get_unaligned_le16 to access it.
> >
> > Also let's add build time check to make sure it stays aligned.
> 
> - AFAIK, there's no guarantee the "pcu" itself is aligned

Yes. kmalloc returns aligned pointer, otherwise every access to members
other than u8 would risk unaligned exception.

> - This change assumes that aligning data on the 2-byte boundary is
> sufficient for all architectures that do not allow unaligned data
> access, which I don't think is a good assumption to make

What arches require word access be double-word aligned?

> - On x86 or any other architecture that allows unaligned access
> get_unaligned_le16() is actually results to call to le16_to_cpup(), so
> this change doesn't really save anything while imposing restrictions
> on the arrangement of the fields in struct ims_pcu and causing
> unnecessary build errors.

Unless somebody changes the layout there won't be any new build errors,
will there?

Thanks.

-- 
Dmitry

  reply	other threads:[~2014-01-04  6:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-04  5:28 [PATCH] Input: ims-pcu - remove unneeded get_unaligned_xxx Dmitry Torokhov
2014-01-04  5:52 ` Andrey Smirnov
2014-01-04  6:16   ` Dmitry Torokhov [this message]
2014-01-04  6:49     ` Andrey Smirnov
2014-01-04  7:46       ` Dmitry Torokhov
2014-01-04 17:41         ` Andrey Smirnov
2014-01-04 22:32           ` Dmitry Torokhov

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=20140104061650.GB20272@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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).