Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280955

Re: [PATCH v3 2/3] ARM: amba: Move reading of periphid to amba_match()

From Ulf Hansson <ulf.hansson@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3 2/3] ARM: amba: Move reading of periphid to amba_match()
Date 2015-12-01 16:30 +0100
Message-ID <qAV2q-2WT-3@gated-at.bofh.it> (permalink)
References <qATjY-1Oq-5@gated-at.bofh.it> <qATjY-1Oq-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 1 December 2015 at 14:34, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
> From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
>
> Reading the periphid when the Primecell device is registered means that
> the apb pclk must be available by then or the device won't be registered
> at all.
>
> By reading the periphid in amba_match() we can return -EPROBE_DEFER if
> the apb pclk isn't there yet and the device will be retried later.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> [minor code adjustments, added missing comment]
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/amba/bus.c | 77 +++++++++++++++++++++++++++++-------------------------
>  1 file changed, 41 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index f009936..879a421 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -24,6 +24,8 @@
>
>  #define to_amba_driver(d)      container_of(d, struct amba_driver, drv)
>
> +static int amba_read_periphid(struct amba_device *dev);
> +
>  static const struct amba_id *
>  amba_lookup(const struct amba_id *table, struct amba_device *dev)
>  {
> @@ -43,11 +45,23 @@ static int amba_match(struct device *dev, struct device_driver *drv)
>  {
>         struct amba_device *pcdev = to_amba_device(dev);
>         struct amba_driver *pcdrv = to_amba_driver(drv);
> +       int ret;
>
>         /* When driver_override is set, only bind to the matching driver */
>         if (pcdev->driver_override)
>                 return !strcmp(pcdev->driver_override, drv->name);
>
> +       /* Do plug-n-play if no hard-coded primecell ID has been provided */
> +       if (!pcdev->periphid) {
> +               ret = amba_read_periphid(pcdev);
> +               if (ret) {
> +                       if (ret != -EPROBE_DEFER)
> +                               dev_err(dev, "Failed to read periphid: %d",
> +                                       ret);

If you anyway are printing errors in the driver core, why do it here as well?

I guess you need to make a call, either here or in driver core. I am
fine with whatever way, just not both.

> +                       return ret;
> +               }
> +       }
> +

Besides the minor comment above, you may add my:

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/3] Exynos4210: fix power domain for MDMA1 device Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-01 14:40 +0100
  [PATCH v3 3/3] ARM: amba: Properly handle devices with power domains Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-01 14:40 +0100
    Re: [PATCH v3 3/3] ARM: amba: Properly handle devices with power domains Ulf Hansson <ulf.hansson@linaro.org> - 2015-12-01 16:30 +0100
  [PATCH v3 2/3] ARM: amba: Move reading of periphid to amba_match() Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-01 14:40 +0100
    Re: [PATCH v3 2/3] ARM: amba: Move reading of periphid to amba_match() Ulf Hansson <ulf.hansson@linaro.org> - 2015-12-01 16:30 +0100
    Re: [PATCH v3 2/3] ARM: amba: Move reading of periphid to  amba_match() Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-01 16:50 +0100
  [PATCH v3 1/3] driver core: handle -EPROBE_DEFER from bus_type.match() Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-01 14:40 +0100
    Re: [PATCH v3 1/3] driver core: handle -EPROBE_DEFER from bus_type.match() Ulf Hansson <ulf.hansson@linaro.org> - 2015-12-01 16:30 +0100

csiph-web