From: Alan Cox <alan@linux.intel.com>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] gpio: Add PMIC GPIO block support
Date: Fri, 9 Jul 2010 14:35:57 +0100 [thread overview]
Message-ID: <20100709143557.05a0974d@linux.intel.com> (raw)
In-Reply-To: <20100708193708.GA5319@srcf.ucam.org>
On Thu, 8 Jul 2010 20:37:08 +0100
Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Thu, Jul 08, 2010 at 06:09:27PM +0100, Alan Cox wrote:
> > + else if (offset < 14)/* it is GPOSW */
> > + rc = intel_scu_ipc_update_register(GPOSWCTL0 +
> > offset - 8,
> > + GPOSW_DRV | GPOSW_DOU | GPOSW_RDRV,
> > + GPOSW_DRV | (value ? GPOSW_DOU :
> > 0));
> > + else if (offset > 15 && offset < 24)/* it is GPO */
>
> What happened to gpios 14 and 15?
Good question. I will double check this is correct but since everyone
is using the driver its probably right
> > +
> > +static int pmic_gpio_get(struct gpio_chip *chip, unsigned offset)
> > +{
> > + u8 r;
> > +
> > + /* we only have 8 GPIO pins we can use as input */
> > + if (offset > 8)
> > + return -1;
>
> Is there any chance of this getting passed up to userspace? Using
> something more descriptive would be nice (ditto for a couple of other
> places)
No but it can get back to the caller. Right now gpiolib isn't really
internally sure what to do about gpio reads failing. Given that I might
as well hand back -Efoo codes.
> > + if (intel_scu_ipc_ioread8(GPIO0 + offset, &r))
> > + return -1;
>
> ...especially since you get the same error for two different failure
> modes :)
>
> > +static int pmic_irq_type(unsigned irq, unsigned type)
> > +{
> > + struct pmic_gpio *pg = get_irq_chip_data(irq);
> > + u32 gpio = irq - pg->irq_base;
> > + unsigned long flags;
> > +
> > + if (gpio < 0 || gpio > pg->chip.ngpio)
>
> It's unsigned, don't need to check that it's < 0.
Fixed
> I don't think it's really necessary to indicate that the driver's
> loaded here.
Agreed, fixed
> > + if (!pdata || !pdata->gpio_base || !pdata->irq_base) {
> > + dev_dbg(dev, "incorrect or missing platform
> > data\n");
> > + return -EINVAL;
> > + }
>
> Shouldn't there be an is_mrst() check before trying to dereference
> this?
We check pdata == NULL so in the theoretical case someone loaded the
driver on the wrong platform and cooked up a device match you'd still
be ok
Alan
next prev parent reply other threads:[~2010-07-09 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-08 17:09 [PATCH] gpio: Add PMIC GPIO block support Alan Cox
2010-07-08 19:37 ` Matthew Garrett
2010-07-09 13:35 ` Alan Cox [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-07-13 9:56 Alan Cox
2010-07-22 15:01 ` Matthew Garrett
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=20100709143557.05a0974d@linux.intel.com \
--to=alan@linux.intel.com \
--cc=mjg59@srcf.ucam.org \
--cc=platform-driver-x86@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