All of lore.kernel.org
 help / color / mirror / Atom feed
From: robdclark@gmail.com (Rob Clark)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 4/8] drm: msm: update to use component match support
Date: Sun, 27 Apr 2014 11:49:51 -0400	[thread overview]
Message-ID: <CAF6AEGtC1N+vUAcVbNc4yQ3WkzkoTx0nBQp-+rLuXJ9oWwH9rQ@mail.gmail.com> (raw)
In-Reply-To: <E1WeBbf-0002Gi-DT@rmk-PC.arm.linux.org.uk>

On Sat, Apr 26, 2014 at 7:02 PM, Russell King
<rmk+kernel@arm.linux.org.uk> wrote:
> Update MSM's DRM driver to use the component match support rather than
> add_components.

Looks like the component helper improvements make things nicer for the
driver.  Let me know when you are ready to merge the set, if you want
me to take this one via my tree or not.

Reviewed-by: Rob Clark <robdclark@gmail.com>

> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
>  drivers/gpu/drm/msm/msm_drv.c | 81 ++++++++++++++++++-------------------------
>  1 file changed, 34 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index f9de156b9e65..26be58bd611d 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -865,12 +865,41 @@ static int compare_of(struct device *dev, void *data)
>  {
>         return dev->of_node == data;
>  }
> +#else
> +static int compare_dev(struct device *dev, void *data)
> +{
> +       return dev == data;
> +}
> +#endif
> +
> +static int msm_drm_bind(struct device *dev)
> +{
> +       return drm_platform_init(&msm_driver, to_platform_device(dev));
> +}
> +
> +static void msm_drm_unbind(struct device *dev)
> +{
> +       drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
> +}
> +
> +static const struct component_master_ops msm_drm_ops = {
> +       .bind = msm_drm_bind,
> +       .unbind = msm_drm_unbind,
> +};
> +
> +/*
> + * Platform driver:
> + */
>
> -static int msm_drm_add_components(struct device *master, struct master *m)
> +static int msm_pdev_probe(struct platform_device *pdev)
>  {
> +       struct component_match *match = NULL;
> +#ifdef CONFIG_OF
> +       /* NOTE: the CONFIG_OF case duplicates the same code as exynos or imx
> +        * (or probably any other).. so probably some room for some helpers
> +        */
>         struct device_node *np = master->of_node;
>         unsigned i;
> -       int ret;
>
>         for (i = 0; ; i++) {
>                 struct device_node *node;
> @@ -879,22 +908,9 @@ static int msm_drm_add_components(struct device *master, struct master *m)
>                 if (!node)
>                         break;
>
> -               ret = component_master_add_child(m, compare_of, node);
> -               of_node_put(node);
> -
> -               if (ret)
> -                       return ret;
> +               component_match_add(&pdev->dev, &match, compare_of, node);
>         }
> -       return 0;
> -}
>  #else
> -static int compare_dev(struct device *dev, void *data)
> -{
> -       return dev == data;
> -}
> -
> -static int msm_drm_add_components(struct device *master, struct master *m)
> -{
>         /* For non-DT case, it kinda sucks.  We don't actually have a way
>          * to know whether or not we are waiting for certain devices (or if
>          * they are simply not present).  But for non-DT we only need to
> @@ -918,41 +934,12 @@ static int msm_drm_add_components(struct device *master, struct master *m)
>                         return -EPROBE_DEFER;
>                 }
>
> -               ret = component_master_add_child(m, compare_dev, dev);
> -               if (ret) {
> -                       DBG("could not add child: %d", ret);
> -                       return ret;
> -               }
> +               component_match_add(&pdev->dev, &match, compare_dev, dev);
>         }
> -
> -       return 0;
> -}
>  #endif
>
> -static int msm_drm_bind(struct device *dev)
> -{
> -       return drm_platform_init(&msm_driver, to_platform_device(dev));
> -}
> -
> -static void msm_drm_unbind(struct device *dev)
> -{
> -       drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
> -}
> -
> -static const struct component_master_ops msm_drm_ops = {
> -               .add_components = msm_drm_add_components,
> -               .bind = msm_drm_bind,
> -               .unbind = msm_drm_unbind,
> -};
> -
> -/*
> - * Platform driver:
> - */
> -
> -static int msm_pdev_probe(struct platform_device *pdev)
> -{
>         pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> -       return component_master_add(&pdev->dev, &msm_drm_ops);
> +       return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);
>  }
>
>  static int msm_pdev_remove(struct platform_device *pdev)
> --
> 1.8.3.1
>

WARNING: multiple messages have this Message-ID (diff)
From: Rob Clark <robdclark@gmail.com>
To: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH RFC 4/8] drm: msm: update to use component match support
Date: Sun, 27 Apr 2014 11:49:51 -0400	[thread overview]
Message-ID: <CAF6AEGtC1N+vUAcVbNc4yQ3WkzkoTx0nBQp-+rLuXJ9oWwH9rQ@mail.gmail.com> (raw)
In-Reply-To: <E1WeBbf-0002Gi-DT@rmk-PC.arm.linux.org.uk>

On Sat, Apr 26, 2014 at 7:02 PM, Russell King
<rmk+kernel@arm.linux.org.uk> wrote:
> Update MSM's DRM driver to use the component match support rather than
> add_components.

Looks like the component helper improvements make things nicer for the
driver.  Let me know when you are ready to merge the set, if you want
me to take this one via my tree or not.

Reviewed-by: Rob Clark <robdclark@gmail.com>

> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
>  drivers/gpu/drm/msm/msm_drv.c | 81 ++++++++++++++++++-------------------------
>  1 file changed, 34 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index f9de156b9e65..26be58bd611d 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -865,12 +865,41 @@ static int compare_of(struct device *dev, void *data)
>  {
>         return dev->of_node == data;
>  }
> +#else
> +static int compare_dev(struct device *dev, void *data)
> +{
> +       return dev == data;
> +}
> +#endif
> +
> +static int msm_drm_bind(struct device *dev)
> +{
> +       return drm_platform_init(&msm_driver, to_platform_device(dev));
> +}
> +
> +static void msm_drm_unbind(struct device *dev)
> +{
> +       drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
> +}
> +
> +static const struct component_master_ops msm_drm_ops = {
> +       .bind = msm_drm_bind,
> +       .unbind = msm_drm_unbind,
> +};
> +
> +/*
> + * Platform driver:
> + */
>
> -static int msm_drm_add_components(struct device *master, struct master *m)
> +static int msm_pdev_probe(struct platform_device *pdev)
>  {
> +       struct component_match *match = NULL;
> +#ifdef CONFIG_OF
> +       /* NOTE: the CONFIG_OF case duplicates the same code as exynos or imx
> +        * (or probably any other).. so probably some room for some helpers
> +        */
>         struct device_node *np = master->of_node;
>         unsigned i;
> -       int ret;
>
>         for (i = 0; ; i++) {
>                 struct device_node *node;
> @@ -879,22 +908,9 @@ static int msm_drm_add_components(struct device *master, struct master *m)
>                 if (!node)
>                         break;
>
> -               ret = component_master_add_child(m, compare_of, node);
> -               of_node_put(node);
> -
> -               if (ret)
> -                       return ret;
> +               component_match_add(&pdev->dev, &match, compare_of, node);
>         }
> -       return 0;
> -}
>  #else
> -static int compare_dev(struct device *dev, void *data)
> -{
> -       return dev == data;
> -}
> -
> -static int msm_drm_add_components(struct device *master, struct master *m)
> -{
>         /* For non-DT case, it kinda sucks.  We don't actually have a way
>          * to know whether or not we are waiting for certain devices (or if
>          * they are simply not present).  But for non-DT we only need to
> @@ -918,41 +934,12 @@ static int msm_drm_add_components(struct device *master, struct master *m)
>                         return -EPROBE_DEFER;
>                 }
>
> -               ret = component_master_add_child(m, compare_dev, dev);
> -               if (ret) {
> -                       DBG("could not add child: %d", ret);
> -                       return ret;
> -               }
> +               component_match_add(&pdev->dev, &match, compare_dev, dev);
>         }
> -
> -       return 0;
> -}
>  #endif
>
> -static int msm_drm_bind(struct device *dev)
> -{
> -       return drm_platform_init(&msm_driver, to_platform_device(dev));
> -}
> -
> -static void msm_drm_unbind(struct device *dev)
> -{
> -       drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
> -}
> -
> -static const struct component_master_ops msm_drm_ops = {
> -               .add_components = msm_drm_add_components,
> -               .bind = msm_drm_bind,
> -               .unbind = msm_drm_unbind,
> -};
> -
> -/*
> - * Platform driver:
> - */
> -
> -static int msm_pdev_probe(struct platform_device *pdev)
> -{
>         pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> -       return component_master_add(&pdev->dev, &msm_drm_ops);
> +       return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);
>  }
>
>  static int msm_pdev_remove(struct platform_device *pdev)
> --
> 1.8.3.1
>

  reply	other threads:[~2014-04-27 15:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-26 23:00 [RFC PATCH 0/8] component helper improvements Russell King - ARM Linux
2014-04-26 23:00 ` Russell King - ARM Linux
2014-04-26 23:01 ` [PATCH RFC 1/8] component: fix missed cleanup in case of devres failure Russell King
2014-04-26 23:01 ` [PATCH RFC 2/8] component: ignore multiple additions of the same component Russell King
2014-04-26 23:01 ` [PATCH RFC 3/8] component: add support for component match array Russell King
2014-04-28  9:21   ` Thierry Reding
2014-06-24 19:08     ` Russell King - ARM Linux
2014-04-26 23:02 ` [PATCH RFC 4/8] drm: msm: update to use component match support Russell King
2014-04-26 23:02   ` Russell King
2014-04-27 15:49   ` Rob Clark [this message]
2014-04-27 15:49     ` Rob Clark
2014-04-26 23:02 ` [PATCH RFC 5/8] imx-drm: " Russell King
2014-04-26 23:02 ` [PATCH RFC 6/8] component: remove old add_components method Russell King
2014-04-28  7:07   ` Thierry Reding
2014-04-28 10:28     ` Russell King - ARM Linux
2014-04-28 10:52       ` Thierry Reding
2014-04-26 23:02 ` [PATCH RFC 7/8] component: move check for unbound master into try_to_bring_up_masters() Russell King
2014-04-28  7:10   ` Thierry Reding
2014-04-26 23:02 ` [PATCH RFC 8/8] component: track components via array rather than list Russell King
2014-04-27  9:43 ` [PATCH RFC 1/8] component: fix missed cleanup in case of devres failure Russell King
2014-04-27 12:51 ` [RFC PATCH 0/8] component helper improvements Daniel Vetter
2014-04-27 12:51   ` Daniel Vetter
2014-04-27 13:32   ` Russell King - ARM Linux
2014-04-27 13:32     ` Russell King - ARM Linux
2014-05-14 18:42 ` Thierry Reding
2014-05-14 18:42   ` Thierry Reding
2014-07-02 11:12   ` Russell King - ARM Linux
2014-07-02 11:12     ` Russell King - ARM Linux

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=CAF6AEGtC1N+vUAcVbNc4yQ3WkzkoTx0nBQp-+rLuXJ9oWwH9rQ@mail.gmail.com \
    --to=robdclark@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.