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

From: Alexander Shiyan
Date: Tue Feb 19 2013 - 03:56:11 EST


...
> >> >> 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.
>
> Yes.

I still think the universal procedure is better for the driver.

> > 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".
> >
>
> Yes, but it also brings misleading and mass.
> And i wonder even the API can cover the two type of matches, the
> caller still can't use
> the only one name for two cases since the name is different.
> So it looks to me not make too much sense to provide only one API.

The previous version of the patch keep conformity to the name of
procedure ("compatible" field in platform_data)...

So, now I'm totally confused what we do with the search function.

---
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i