lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1361198364.496836323@f245.mail.ru>
Date:	Mon, 18 Feb 2013 18:39:24 +0400
From:	Alexander Shiyan <shc_work@...l.ru>
To:	Dong Aisheng <dong.aisheng@...aro.org>
Cc:	Dong Aisheng <b29396@...escale.com>,
	linux-kernel@...r.kernel.org,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: Re[6]: [PATCH] mfd: syscon: Added support for using platform driver resources

Hello.

...
> >> >> Thanks for the patch adding non-dt support. :-)
> >> >>
> >> >> On Mon, Feb 04, 2013 at 07:00:40PM +0400, Alexander Shiyan wrote:
> >> >> > This patch adds support usage platform driver resources, i.e.
> >> >> > possibility works without oftree support. Additionally patch
> >> >> > removes CONFIG_OF dependency and adds helper for accessing
> >> >> > regmap by searching device by its name.
> >> > ...
> >> >> > +static int syscon_match_name(struct device *dev, void *data)
> >> >> > +{
> >> >> > +   return !strcmp(dev_name(dev), (const char *)data);
> >> >> > +}
> >> >> > +
> >> >> > +struct regmap *syscon_regmap_lookup_by_name(const char *name)
> >> >> > +{
> >> >> > +   struct syscon *syscon;
> >> >> > +   struct device *dev;
> >> >> > +
> >> >> > +   dev = driver_find_device(&syscon_driver.driver, NULL, (void *)name,
> >> >> > +                            syscon_match_name);
> >> >> > +   if (!dev)
> >> >> > +           return ERR_PTR(-EPROBE_DEFER);
> >> >> > +
> >> >> > +   syscon = dev_get_drvdata(dev);
> >> >> > +
> >> >> > +   return syscon->regmap;
> >> >> > +}
> >> >> > +
> >> >>
> >> >> How about syscon_dev_to_regmap(struct device *dev) as the exist dt version
> >> >> syscon_node_to_regmap since it's not affected by the name change of devices?
> >> >
> >> > I am not completely understand what you mean. In my version which doing
> >> > search regmap by name, we can call this function with desired device name,
> >> > then use regmap:
> >> > struct regmap *r = syscon_regmap_lookup_by_name("syscon.1");
> >> >
> >>
> >> My concern is that this API may be used by other client drivers, if we hardcode
> >> the device name in those drivers, once the device name is changed,
> >> all those drivers need change too.
> >> For dt case, we use device node to find regmap, so does not care about the name.
> >>
> >> > You suggest use "struct device" as parameter?
> >>
> >> A device pointer.
> >>
> >> > I do not know what we should
> >> > use as parameter to the function in this case, since we can get "struct device"
> >> > only when register this device,
> >>
> >> If we have a platform_device, then we have its device pointer, right?
> >>
> >> > i.e. in board support code, not from anywhere,
> >> > for example from another driver.
> >> > Fixme please.
> >> >
> >> My understanding is that in board support code, we can have the
> >> platform device instance
> >> of that syscon compatible device, then we can use it as the platform
> >> data parameter for those devices driver who wants to use it.
> >> Then in client driver, it can call:
> >> syscon_dev_to_regmap(syscon_compatible_dev)
> >> to find the regmap.
> >> Just like dt working way, the device node usually uses a phandle pointing to
> >> the syscon compatible node which it wants to use.
> >
> > This is not as easy as it seems.
> > All devices that will use "syscon" driver, in this case should have a platform_data
> > record.
> 
> Yes, that's the same way as the dt version does.
> 
> > I think that it can create problems with using these drivers as modules.
> 
> What problems do you think?

I've changed my opinion ;)

> > Alternatively, we can create additional (virtual) "compatible" text property in syscon
> > private data structure and use it to find the proper device. What is your opinion?
> >
> 
> Hmm, i can't see why we need that.
> IMO, for non-dt, we can just use platform_device_id to match devices.

Unfortunately platform_device_id.name field have a length limitation. But, of course,
this is a other theme for discussion. So, I'll send new version of patch.
Thanks!

---

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ