devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/3] of: platform: introduce of_probe_platform_driver()
Date: Thu, 16 Dec 2010 10:22:51 -0700	[thread overview]
Message-ID: <AANLkTimxAGVkQF24YgDt+TxjbXvW+iCNJhqVLwXO6FXD@mail.gmail.com> (raw)
In-Reply-To: <1292519639-21859-2-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On Thu, Dec 16, 2010 at 10:13 AM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> Introduce a function equivalent to platform_driver_probe() for of. This is
> needed to keep some SoC devices in the __init section.
>
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Hi Wolfram

Nack for two reasons:
1- Anything needed at driver probe time should be in an __devinit
section.  What specifically are you wanting to keep in __init
2- of_platform_driver is deprecated.  Drivers should be converted to
use platform_driver directly.

g.

> ---
>  drivers/of/platform.c       |   30 +++++++++++++++++++++++++++---
>  include/linux/of_platform.h |    2 ++
>  2 files changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 5b4a07f..511657b 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -72,7 +72,7 @@ static void platform_driver_shutdown_shim(struct platform_device *pdev)
>  /**
>  * of_register_platform_driver
>  */
> -int of_register_platform_driver(struct of_platform_driver *drv)
> +int __of_register_platform_driver(struct of_platform_driver *drv, bool do_probe)
>  {
>        char *of_name;
>
> @@ -90,18 +90,42 @@ int of_register_platform_driver(struct of_platform_driver *drv)
>        sprintf(of_name, "of:%s", drv->driver.name);
>        drv->platform_driver.driver.name = of_name;
>
> -       if (drv->probe)
> -               drv->platform_driver.probe = platform_driver_probe_shim;
>        drv->platform_driver.remove = drv->remove;
>        if (drv->shutdown)
>                drv->platform_driver.shutdown = platform_driver_shutdown_shim;
>        drv->platform_driver.suspend = drv->suspend;
>        drv->platform_driver.resume = drv->resume;
>
> +       if (do_probe)
> +               return platform_driver_probe(&drv->platform_driver,
> +                                       platform_driver_probe_shim);
> +
> +       if (drv->probe)
> +               drv->platform_driver.probe = platform_driver_probe_shim;
> +
>        return platform_driver_register(&drv->platform_driver);
>  }
> +
> +int of_register_platform_driver(struct of_platform_driver *drv)
> +{
> +       return __of_register_platform_driver(drv, false);
> +}
> +
>  EXPORT_SYMBOL(of_register_platform_driver);
>
> +int of_probe_platform_driver(struct of_platform_driver *drv,
> +               int (*probe)(struct platform_device *, const struct of_device_id *match))
> +{
> +       int ret;
> +
> +       drv->probe = probe;
> +       ret = __of_register_platform_driver(drv, true);
> +       drv->probe = NULL;
> +
> +       return ret;
> +}
> +EXPORT_SYMBOL(of_probe_platform_driver);
> +
>  void of_unregister_platform_driver(struct of_platform_driver *drv)
>  {
>        platform_driver_unregister(&drv->platform_driver);
> diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
> index a68716a..c4082c7 100644
> --- a/include/linux/of_platform.h
> +++ b/include/linux/of_platform.h
> @@ -53,6 +53,8 @@ extern void of_unregister_driver(struct of_platform_driver *drv);
>
>  /* Platform drivers register/unregister */
>  extern int of_register_platform_driver(struct of_platform_driver *drv);
> +extern int of_probe_platform_driver(struct of_platform_driver *drv,
> +               int (*probe)(struct platform_device *, const struct of_device_id *match));
>  extern void of_unregister_platform_driver(struct of_platform_driver *drv);
>
>  extern struct platform_device *of_device_alloc(struct device_node *np,
> --
> 1.7.2.3
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

  parent reply	other threads:[~2010-12-16 17:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 17:13 [RFC 0/3] Introduce of_probe_platform_driver() Wolfram Sang
     [not found] ` <1292519639-21859-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-12-16 17:13   ` [PATCH 1/3] of: platform: introduce of_probe_platform_driver() Wolfram Sang
     [not found]     ` <1292519639-21859-2-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-12-16 17:22       ` Grant Likely [this message]
     [not found]         ` <AANLkTimxAGVkQF24YgDt+TxjbXvW+iCNJhqVLwXO6FXD-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-16 18:26           ` Wolfram Sang
2010-12-16 17:13 ` [PATCH 2/3] spi: mpc52xx_psc_spi: fix section mismatch warning Wolfram Sang
2010-12-16 17:23   ` Grant Likely
2010-12-16 17:13 ` [PATCH 3/3] spi: mpc512x_psc_spi: move probe-routine to __init Wolfram Sang
2010-12-16 17:27   ` Grant Likely

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=AANLkTimxAGVkQF24YgDt+TxjbXvW+iCNJhqVLwXO6FXD@mail.gmail.com \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).