Re: [PATCH] mmc: sdhci-pltfm: Use of_property_read_u32 instead of open-coding it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2015-09-17 at 14:59:45 +0200, Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
> On 17 September 2015 at 14:07, Tobias Klauser <tklauser@xxxxxxxxxx> wrote:
> > Use of_property_read_u32 instead of of_get_property with return value
> > checks and endianness conversion.
> >
> > Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>
> > ---
> >  drivers/mmc/host/sdhci-pltfm.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> > index a207f5a..58721fb 100644
> > --- a/drivers/mmc/host/sdhci-pltfm.c
> > +++ b/drivers/mmc/host/sdhci-pltfm.c
> > @@ -71,9 +71,8 @@ void sdhci_get_of_property(struct platform_device *pdev)
> >         struct device_node *np = pdev->dev.of_node;
> >         struct sdhci_host *host = platform_get_drvdata(pdev);
> >         struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> > -       const __be32 *clk;
> > +       u32 clk;
> >         u32 bus_width;
> > -       int size;
> >
> >         if (of_get_property(np, "sdhci,auto-cmd12", NULL))
> >                 host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
> > @@ -101,9 +100,8 @@ void sdhci_get_of_property(struct platform_device *pdev)
> >             of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
> >                 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
> >
> > -       clk = of_get_property(np, "clock-frequency", &size);
> > -       if (clk && size == sizeof(*clk) && *clk)
> > -               pltfm_host->clock = be32_to_cpup(clk);
> > +       if (of_property_read_u32(np, "clock-frequency", &clk) == 0)
> 
> Perhaps even better:
> of_property_read_u32(np, "clock-frequency", &pltfm_host->clock);

Yes, even better. I'll send v2.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux