mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite.dk>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: dbrownell@users.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mcp23s08: support mcp23s17 variant
Date: Mon, 14 Feb 2011 19:29:50 +0100	[thread overview]
Message-ID: <87r5bacvvl.fsf@macbook.be.48ers.dk> (raw)
In-Reply-To: <AANLkTi=pWV+tfD6YGpKbzTkvLVoLXtGA41QRaaF=VFeq@mail.gmail.com> (Grant Likely's message of "Mon, 14 Feb 2011 10:13:01 -0700")

>>>>> "Grant" == Grant Likely <grant.likely@secretlab.ca> writes:

Hi,

 >> -       return (status < 0) ? status : rx[0];
 >> +
 >> +       if (mcp->type == MCP_TYPE_S17) {
 >> +               tx[1] <<= 1;
 >> +
 >> +               status = spi_write_then_read(mcp->spi, tx, sizeof tx, rx, 2);
 >> +               return (status < 0) ? status : (rx[0] | (rx[1] << 8));
 >> +       } else {
 >> +               status = spi_write_then_read(mcp->spi, tx, sizeof tx, rx, 1);
 >> +               return (status < 0) ? status : rx[0];
 >> +       }

 Grant> Rather than checking ->type for every transaction, would a set of
 Grant> callbacks for each type be better?  It would probably have lower
 Grant> overhead and be simpler to maintain.

We could. I didn't do it because the 8bit and 16bit cases are very
similar, and checking a simple integer is presumably a lot faster than
the spi access - But I can rework the patch if you insists.

 >> +++ b/include/linux/spi/mcp23s08.h
 >> @@ -2,21 +2,24 @@
 >>  /* FIXME driver should be able to handle IRQs...  */
 >> 
 >>  struct mcp23s08_chip_info {
 >> -       bool    is_present;             /* true iff populated */
 >> -       u8      pullups;                /* BIT(x) means enable pullup x */
 >> +       bool            is_present;     /* true if populated */
 >> +       unsigned        pullups;        /* BIT(x) means enable pullup x */
 >>  };

 Grant> Unrelated whitespace changes.

I wouldn't call it unrelated. It's to ensure it still lines up after the
s/u8/unsigned/.

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2011-02-14 18:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 16:12 Peter Korsgaard
2011-02-14 17:13 ` Grant Likely
2011-02-14 18:29   ` Peter Korsgaard [this message]
2011-02-14 18:59     ` Grant Likely
2011-02-15 12:47       ` Peter Korsgaard

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=87r5bacvvl.fsf@macbook.be.48ers.dk \
    --to=jacmet@sunsite.dk \
    --cc=dbrownell@users.sourceforge.net \
    --cc=grant.likely@secretlab.ca \
    --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

Powered by JetHome