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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140912140720.GC30816@xps8300>
Date:	Fri, 12 Sep 2014 17:07:20 +0300
From:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:	Kishon Vijay Abraham I <kishon@...com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Felipe Balbi <balbi@...com>,
	Vivek Gautam <gautam.vivek@...sung.com>,
	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 2/6] phy: improved lookup method

On Thu, Sep 11, 2014 at 09:03:06PM +0530, Kishon Vijay Abraham I wrote:
> > +static struct phy *phy_find(struct device *dev, const char *con_id)
> > +{
> > +	const char *dev_id = dev ? dev_name(dev) : NULL;
> > +	int match, best_found = 0, best_possible = 0;
> > +	struct phy *phy = ERR_PTR(-ENODEV);
> > +	struct phy_lookup *p, *pl = NULL;
> > +
> > +	if (dev_id)
> > +		best_possible += 2;
> > +	if (con_id)
> > +		best_possible += 1;
> > +
> > +	list_for_each_entry(p, &phys, node) {
> > +		match = 0;
> > +		if (p->dev_id) {
> > +			if (!dev_id || strcmp(p->dev_id, dev_id))
> > +				continue;
> > +			match += 2;
> > +		}
> > +		if (p->con_id) {
> > +			if (!con_id || strcmp(p->con_id, con_id))
> > +				continue;
> > +			match += 1;
> > +		}
> > +
> > +		if (match > best_found) {
> > +			pl = p;
> > +			if (match != best_possible)
> > +				best_found = match;
> > +			else
> > +				break;
> > +		}
> > +	}
> > +
> > +	if (pl) {
> > +		struct class_dev_iter iter;
> > +		struct device *phy_dev;
> > +
> > +		class_dev_iter_init(&iter, phy_class, NULL, NULL);
> > +		while ((phy_dev = class_dev_iter_next(&iter))) {
> > +			if (!strcmp(dev_name(phy_dev), pl->phy_name)) {
> 
> I'm not sure how it'll work with systems which has multiple PHYs since the "id"
> component of the device is determined purely in runtime.
> 
> I'd assume we'll be constantly patching the lookup data for non-dt boot :-/

I'm sorry but I don't think I understand (I must be a bit tired
today)? Could you please elaborate?


Have a nice weekend!

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ