From: Grant Likely <grant.likely@secretlab.ca>
To: Linus Walleij <linus.ml.walleij@gmail.com>
Cc: spi-devel-general@lists.sourceforge.net,
Linus Walleij <linus.walleij@stericsson.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] spi/pl022: compare bitwidth to enums
Date: Thu, 30 Sep 2010 23:37:09 +0900 [thread overview]
Message-ID: <AANLkTimGpfazBPYp3cc4pSFUJ_Q7GaPVxRtB2=YSM5YE@mail.gmail.com> (raw)
In-Reply-To: <AANLkTin6fPnDdSqQiWKH8kTnREV2g8p94HzQQcjcpKLs@mail.gmail.com>
On Thu, Sep 30, 2010 at 8:34 PM, Linus Walleij
<linus.ml.walleij@gmail.com> wrote:
> 2010/9/30 Linus Walleij <linus.walleij@stericsson.com>:
>
>> The enums from <linux/amba/pl022.h> are actually off-by-one
>> since bitwidth 4 is defined as 0x03, causing weirdness when
>> we were trying out some 9-bit peripheral. Fix this by
>> comparing to the enum values rather than hardcoded values
>> and also fixing the enum to something reasonable.
>>
>> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
>> (...)
>> - if (chip_info->data_size <= 8) {
>> + if (chip_info->data_size <= SSP_DATA_BITS_8) {
>> dev_dbg(&spi->dev, "1 <= n <=8 bits per word\n");
>> chip->n_bytes = 1;
>> chip->read = READING_U8;
>> chip->write = WRITING_U8;
>> - } else if (chip_info->data_size <= 16) {
>> + } else if (chip_info->data_size <= SSP_DATA_BITS_16) {
>
> I just realized that Kevin Wells patch actually patch away this problem
> so merge his patch and disregard this for the optimal solution.
>
>> enum ssp_data_size {
>> - SSP_DATA_BITS_4 = 0x03, SSP_DATA_BITS_5, SSP_DATA_BITS_6,
>> + SSP_DATA_BITS_4 = 0x04, SSP_DATA_BITS_5, SSP_DATA_BITS_6,
>
> This is not good because this is used for default register
> settings too (I didn't notice, typical).
And it creates a 1:1 mapping of name to the same number. Insane!
Just use the integer number directly. :-)
>
> If anyone still wants a patch for older kernels I can provide a
> patch against 2.6.36-rc6 with just the first two hunks.
>
> Yours,
> Linus Walleij
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
next prev parent reply other threads:[~2010-09-30 14:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 9:57 [PATCH] spi/pl022: compare bitwidth to enums Linus Walleij
2010-09-30 11:34 ` Linus Walleij
2010-09-30 14:37 ` Grant Likely [this message]
2010-09-30 16:21 ` Kevin Wells
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='AANLkTimGpfazBPYp3cc4pSFUJ_Q7GaPVxRtB2=YSM5YE@mail.gmail.com' \
--to=grant.likely@secretlab.ca \
--cc=linus.ml.walleij@gmail.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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).