From: Kevin Hilman <khilman@ti.com>
To: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: <linux-omap@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, Rajendra Nayak <rnayak@ti.com>,
Santosh Shilimkar <santosh.shilimkar@ti.com>, "Cousson\,
Benoit" <b-cousson@ti.com>, Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH 2/2] gpio/omap: add *remove* callback in platform_driver
Date: Wed, 11 Jul 2012 16:25:44 -0700 [thread overview]
Message-ID: <87394xhocn.fsf@ti.com> (raw)
In-Reply-To: <1341997995-14020-3-git-send-email-tarun.kanti@ti.com> (Tarun Kanti DebBarma's message of "Wed, 11 Jul 2012 14:43:15 +0530")
Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:
> Add *remove* callback so that necessary cleanup operations are
> performed when device is unregistered.
How was this tested? on what platforms?
> The device is deleted
> from the list and associated clock handle is released by
> calling clk_put() and irq descriptor is released using the
> irq_free_desc() api.
There is quite a bit of other things to do in remove to properly cleanup
what is done in probe.
Also, what happens when a 'remove' is triwhen there are GPIOs that
are still requested and in use, especially if they are GPIO IRQs.
Also, what about runtime PM?
In short, this seems very premature and I suspect untested.
Kevin
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> Reported-by: Paul Walmsley <paul@pwsan.com>
> Reviewed-by: Jon Hunter <jon-hunter@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Rajendra Nayak <rnayak@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Cousson, Benoit <b-cousson@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> ---
> drivers/gpio/gpio-omap.c | 30 ++++++++++++++++++++++++++++++
> 1 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index afecdcc..08929d5 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1140,6 +1140,35 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
> return ret;
> }
>
> +/**
> + * omap_gpio_remove - cleanup a registered gpio device
> + * @pdev: pointer to current gpio platform device
> + *
> + * Called by driver framework whenever a gpio device is unregistered.
> + * GPIO is deleted from the list and associated clock handle freed.
> + */
> +static int __devexit omap_gpio_remove(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct gpio_bank *bank;
> + unsigned long flags;
> + int ret = -EINVAL;
> +
> + list_for_each_entry(bank, &omap_gpio_list, node) {
> + spin_lock_irqsave(&bank->lock, flags);
> + if (bank->dev == dev) {
> + list_del(&bank->node);
> + clk_put(bank->dbck);
> + irq_free_desc(bank->irq_base);
> + ret = 0;
> + spin_unlock_irqrestore(&bank->lock, flags);
> + break;
> + }
> + spin_unlock_irqrestore(&bank->lock, flags);
> + }
> + return ret;
> +}
> +
> #ifdef CONFIG_ARCH_OMAP2PLUS
>
> #if defined(CONFIG_PM_RUNTIME)
> @@ -1466,6 +1495,7 @@ MODULE_DEVICE_TABLE(of, omap_gpio_match);
>
> static struct platform_driver omap_gpio_driver = {
> .probe = omap_gpio_probe,
> + .remove = __devexit_p(omap_gpio_remove),
> .driver = {
> .name = "omap_gpio",
> .pm = &gpio_pm_ops,
next prev parent reply other threads:[~2012-07-11 23:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-11 9:13 [PATCH 0/2] gpio/omap: few code realignment and update of missing code Tarun Kanti DebBarma
2012-07-11 9:13 ` [PATCH 1/2] gpio/omap: move bank->dbck initialization to omap_gpio_mod_init() Tarun Kanti DebBarma
2012-07-11 17:51 ` Paul Walmsley
2012-07-11 17:56 ` DebBarma, Tarun Kanti
2012-07-11 21:51 ` Linus Walleij
2012-07-11 9:13 ` [PATCH 2/2] gpio/omap: add *remove* callback in platform_driver Tarun Kanti DebBarma
2012-07-11 21:54 ` Linus Walleij
2012-07-11 23:25 ` Kevin Hilman [this message]
2012-07-12 11:03 ` Linus Walleij
2012-07-12 17:48 ` Kevin Hilman
2012-07-14 20:51 ` Linus Walleij
2012-07-16 17:10 ` Kevin Hilman
2012-07-16 20:49 ` Linus Walleij
2012-07-16 22:01 ` Kevin Hilman
2012-07-17 6:03 ` Shilimkar, Santosh
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=87394xhocn.fsf@ti.com \
--to=khilman@ti.com \
--cc=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=rnayak@ti.com \
--cc=santosh.shilimkar@ti.com \
--cc=tarun.kanti@ti.com \
/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