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: <20121120112129.GA5759@lizard>
Date:	Tue, 20 Nov 2012 03:21:29 -0800
From:	Anton Vorontsov <cbouatmailru@...il.com>
To:	"Tc, Jenny" <jenny.tc@...el.com>
Cc:	Chanwoo Choi <cw00.choi@...sung.com>,
	anish singh <anish198519851985@...il.com>,
	"myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"myunjoo.ham@...il.com" <myunjoo.ham@...il.com>,
	"lockwood@...roid.com" <lockwood@...roid.com>,
	"peterhuewe@....de" <peterhuewe@....de>,
	"broonie@...nsource.wolfsonmicro.com" 
	<broonie@...nsource.wolfsonmicro.com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"lars@...afoo.de" <lars@...afoo.de>,
	"jic23@...nel.org" <jic23@...nel.org>,
	"Pallala, Ramakrishna" <ramakrishna.pallala@...el.com>
Subject: Re: [PATCH] extcon : callback function to read cable property

On Tue, Nov 20, 2012 at 11:08:54AM +0000, Tc, Jenny wrote:
[...]
> > | We may have:
> > |        enum extcon_cable_type {
> > |                EXTCON_CT_REGULATOR,
> > |                EXTCON_CT_PSY,
> > |                EXTCON_CT_CHARGER_CB,
> > |                ...
> > |        };
> > | and have the following included at struct extcon_cable:
> > |        union {
> > |                struct regulator *reg;
> > |                struct power_supply *psy;
> > |                struct charger_cable *charger_cb;
> > |                ...
> > |        } cable data;
> > |        enum extcon_cable_type cable_type;
[...]
> struct charger_cable_props {
> 	unsigned long state;
> 	int mA;
> }
> struct extcon_cable {
> 	.....
> 	union {
> 		struct charger_cable_props chrgr_props;
> 		.....
> 	} data;
> 	enum extcon_cable_name cable_name;
> };
> 
> This way we are not restricting the cable properties just to the charger cable.
> We can add other charger cable properties as we identify the properties for them.

Well, to me, it seems that if we have cable *type*, then having properties
of the cable is the next logical step.

So, personally I see nothing wrong with it.

But you can look at this at the different angle: the type is just another
property of the cable. Would it be better to have power_supply-like API
for extcon? :)

if (extcon->get_prop(extcon, EXC_PROP_TYPE) == EXC_TYPE_CHARGER)) {
	int max_uA = extcon->get_prop(extcon, EXC_PROP_MAX_CURRENT;
	...
}

> We can use the cable_name variable to identify  which cable property to use.

This I didn't get, tho. Why would 'cable_name' tell us which property to
use?. The type of the cable defines a set of its properties -- this I can
understand.

Thanks,
Anton.
--
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