lkml.org 
[lkml]   [2013]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe[6]: [PATCH v3] mfd: syscon: Add non-DT sup port
Date
...
> >> >> >> 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.
> >
>
> Why?
> I did not see your reply on my other comments on the problems of using universal
> procedure?
> Please let me know if you think they're not issues.

Yes, I do not see a problem here.
I will try to show the code.

In the driver:
struct regmap *r;
r = syscon_regmap_lookup_by_compatible("my_super_syscon");

For DT case:
syscon@123456 {
compatible = "my_super_syscon", "syscon";
...
};

For non-DT case:
struct platform_device_id id = { .name = "my_super_syscon", };
struct platform_device syscon_pdev = {
.name = "syscon",
.id_entry = &id,
...
};
platform_device_register(&syscon_pdev);

Do I understand what you mean?
Thanks.

---
\
 
 \ /
  Last update: 2013-02-19 13:41    [W:0.382 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site