From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753733AbbCIMrj (ORCPT ); Mon, 9 Mar 2015 08:47:39 -0400 Received: from mga09.intel.com ([134.134.136.24]:45579 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751408AbbCIMrg convert rfc822-to-8bit (ORCPT ); Mon, 9 Mar 2015 08:47:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,367,1422950400"; d="scan'208";a="662489592" From: "Tc, Jenny" To: Sebastian Reichel CC: "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Anton Vorontsov" , David Woodhouse , "jonghwa3.lee@samsung.com" , "myungjoo.ham@gmail.com" , "Pallala, Ramakrishna" Subject: RE: [RFC 3/4] power_supply: Introduce charger control interface Thread-Topic: [RFC 3/4] power_supply: Introduce charger control interface Thread-Index: AQHQV/kQP7iwmiEF/kaJieQYq3aqB50RebIAgAKe86A= Date: Mon, 9 Mar 2015 12:47:18 +0000 Message-ID: <20ADAB092842284E95860F279283C5642EEC9149@BGSMSX104.gar.corp.intel.com> References: <1425638007-9411-1-git-send-email-jenny.tc@intel.com> <1425638007-9411-4-git-send-email-jenny.tc@intel.com> <20150308015515.GB25160@earth> In-Reply-To: <20150308015515.GB25160@earth> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.223.10.10] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > +struct power_supply_charger { > > + int (*get_property)(struct power_supply_charger *psyc, > > + enum psy_charger_control_property pspc, > > + union power_supply_propval *val); > > The charging framework can simply call the same get_property > as used by sysfs. This is already done by all kind of drivers. The idea is to separate power supply properties from power supply charger properties. Existing power supply properties exposes a generic property of a power supply. But the properties introduced above, is used to control charging. But I agree, if the charger properties are moved to enum power_supply_property{ }, the existing set_property()/get_property() calls can be used > > > + int (*set_property)(struct power_supply_charger *psyc, > > + enum psy_charger_control_property pspc, > > + const union power_supply_propval *val); > > I guess this is needed for values, which are supposed to be > writable by the kernel / charging framework, but non-writable > by the sysfs. I suggest to add set_property_kernel() instead > (and make the above properties part of enum power_supply_property) > If properties are moved to enum power_supply_property {}, then it's possible to reuse the set_property() call. property_is_writeable() can be used to block user space write access. > > +}; > > + > > struct power_supply { > > const char *name; > > enum power_supply_type type; > > @@ -200,6 +226,8 @@ struct power_supply { > > void (*external_power_changed)(struct power_supply *psy); > > void (*set_charged)(struct power_supply *psy); > > > > + struct power_supply_charger *psy_charger; > > Why is this a pointer? This is introduced to access charger properties using power supply object. If the properties can be accessed using existing set_property/get_property(), then this is not really needed -Jenny