Re: Re[2]: [PATCH v3] mfd: syscon: Add non-DT support

From: Arnd Bergmann
Date: Tue Feb 19 2013 - 05:50:34 EST


On Tuesday 19 February 2013, Alexander Shiyan wrote:
> Hello.
>
> Strange, but I not received an original answer from Arnd, have only this mail.

I got a reject notice from mail.ru, which apparently didn't like the
SMTP server of my German ISP. I already tried to resend my mail to you,
and now try to send it out through the gmail server. Please let me know
if you get it.

> > >> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> > >> index 4a7ed5a..3c0abcb 100644
> > >> --- a/drivers/mfd/syscon.c
> > >> +++ b/drivers/mfd/syscon.c
> > >
> > > Hi Alexander,
> > >
> > >> struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
> > >> {
> > >> struct device_node *syscon_np;
> > >> struct regmap *regmap;
> > >> + struct syscon *syscon;
> > >> + struct device *dev;
> > >>
> > >> syscon_np = of_find_compatible_node(NULL, NULL, s);
> > >> - if (!syscon_np)
> > >> + if (syscon_np) {
> > >> + regmap = syscon_node_to_regmap(syscon_np);
> > >> + of_node_put(syscon_np);
> > >> +
> > >> + return regmap;
> > >> + }
> > >> +
> > >> + /* Fallback to search by id_entry.name string */
> > >> + dev = driver_find_device(&syscon_driver.driver, NULL, (void *)s,
> > >> + syscon_match_id);
> > >> + if (!dev)
> > >> return ERR_PTR(-ENODEV);
> > >>
> > >> - regmap = syscon_node_to_regmap(syscon_np);
> > >> - of_node_put(syscon_np);
> > >> + syscon = dev_get_drvdata(dev);
> > >>
> > >> - return regmap;
> > >> + return syscon->regmap;
> > >> }
> > >> EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible);
> > >
> > > Since you are not actually comparing the "compatible" property here,
> > > I would suggest adding another function here,
> >
> > Yes, i also think like that.
>
> In this case we should provide two paths for drivers which can work as with DT
> and without DT. In my case we can use platform_device_id.name field with
> "compatible" string. My way in this case is transparency for driver which is
> using "syscon".

But drivers should use the _by_phandle variant normally, which does
not work without DT, so you already have separate code paths.

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