From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Baruch Siach <baruch@tkos.co.il>
Cc: linux-kernel@vger.kernel.org,
David Brownell <dbrownell@users.sourceforge.net>,
Andrew Morton <akpm@linux-foundation.org>,
linux-arm-kernel@lists.arm.linux.org.uk
Subject: Re: [PATCH v3] gpio: driver for PrimeCell PL061 GPIO controller
Date: Thu, 4 Jun 2009 10:28:35 +0100 [thread overview]
Message-ID: <20090604092835.GJ29926@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1243975690-12073-1-git-send-email-baruch@tkos.co.il>
On Tue, Jun 02, 2009 at 11:48:10PM +0300, Baruch Siach wrote:
> +static u32 (*pl061_pending_irq)(int irq);
Hmm, not sure this is entirely a good idea, especially when some
platforms may have more than one of these. It'll work provided they
all point at the same function, but if they don't, it's bad news.
IRQs do have the ability to have chip specific data attached to them.
See set_irq_chip_data() and get_irq_chip_data().
> +static unsigned int pl061_irq_startup(unsigned irq)
> +{
> + int ret;
> +
> + ret = gpio_request(irq_to_gpio(irq), "IRQ");
> + if (ret < 0) {
> + pr_warning("%s: warning: gpio_request(%d) returned %d\n",
> + __func__, irq_to_gpio(irq), ret);
> + return 0;
> + }
> +
> + gpio_direction_input(irq_to_gpio(irq));
I thought that it was not expected that claiming an interrupt would claim
a GPIO automatically - in other words, it's the responsibility of the
driver or platform itself to claim GPIOs for interrupts and ensure that
they're properly configured.
> +static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
> +{
> + struct pl061_platform_data *pdata;
> + struct pl061_gpio *chip;
> + int ret, irq, i;
> +
> + pdata = dev->dev.platform_data;
> + if (pdata == NULL)
> + return -ENODEV;
-EINVAL would be better.
> +
> + chip = kzalloc(sizeof(*chip), GFP_KERNEL);
> + if (chip == NULL)
> + return -ENOMEM;
> +
> + if (request_mem_region(dev->res.start, SZ_4K, "pl061") == NULL) {
It would be better to keep SZ_* constants out of what are essentially
generic drivers - or we move them into some generic kernel header (but
I don't hold out that much hope of that happening.)
> diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h
> new file mode 100644
> index 0000000..9e18fa3
> --- /dev/null
> +++ b/include/linux/amba/pl061.h
> @@ -0,0 +1,18 @@
> +/* platform data for the PL061 GPIO driver */
> +
> +#define GPIODIR 0x400
> +#define GPIOIS 0x404
> +#define GPIOIBE 0x408
> +#define GPIOIEV 0x40C
> +#define GPIOIE 0x410
> +#define GPIORIS 0x414
> +#define GPIOMIS 0x418
> +#define GPIOIC 0x41C
I think it would make sense to have the above register definitions in
the .c file.
Thanks.
next prev parent reply other threads:[~2009-06-04 9:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-02 20:48 Baruch Siach
2009-06-02 23:09 ` Andrew Morton
2009-06-03 3:20 ` Baruch Siach
2009-06-04 9:28 ` Russell King - ARM Linux [this message]
2009-06-04 15:58 ` Baruch Siach
2009-06-15 23:38 ` David Brownell
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=20090604092835.GJ29926@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=baruch@tkos.co.il \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--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
all inboxes | Powered by JetHome®