On Sunday 24 November 2013 18:18:03 Michael Trimarchi wrote: > Hi > > On Tue, Nov 19, 2013 at 11:18 AM, Pali Rohár wrote: > > This patch removing set_mode_hook function from board data > > and replacing it with new string variable of notifier power > > supply device. After this change it is possible to add DT > > support because driver does not need specific board > > function anymore. Only static data and name of power supply > > device is required. > > > > Signed-off-by: Pali Rohár > > --- > > > > drivers/power/bq2415x_charger.c | 77 > > +++++++++++++++++++++++++-------- > > include/linux/power/bq2415x_charger.h | 48 > > +++----------------- 2 files changed, 65 insertions(+), 60 > > deletions(-) > > ... > > > > - struct bq2415x_device *bq = data; > > + struct bq2415x_device *bq = > > + container_of(nb, struct bq2415x_device, nb); > > + struct power_supply *psy = v; > > + enum bq2415x_mode mode; > > + union power_supply_propval prop; > > + int ret; > > + int mA; > > > > - if (!bq) > > - return; > > + if (val != PSY_EVENT_PROP_CHANGED) > > + return NOTIFY_OK; > > + > > + if (strcmp(psy->name, bq->init_data.notify_device) > > != 0) + return NOTIFY_OK; > > + > > + dev_dbg(bq->dev, "notifier call was called\n"); > > + > > + ret = psy->get_property(psy, > > POWER_SUPPLY_PROP_CURRENT_MAX, &prop); + if (ret != > > 0) > > + return NOTIFY_OK; > > So you can read this value without any type of synchronization > with the power_supply_core > and sysfs implementation? > > > Michael > I do not see reason why I cannot use it. When isp1704 driver send PSY_EVENT_PROP_CHANGED then property POWER_SUPPLY_PROP_CURRENT_MAX is already updated and can be read by get_property function. -- Pali Rohár pali.rohar@gmail.com