Message ID | 1477510907-23495-7-git-send-email-robert.jarzmik@free.fr (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Oct 26, 2016 at 09:41:44PM +0200, Robert Jarzmik wrote: > As the power supply framework provides a way to store and retrieve > private supply data, use it. > > In the process, change the platform data for wm97xx_battery from a > container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. > > Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> > --- Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Thanks, Charles
Hi Robert, On Wed, Oct 26, 2016 at 09:41:44PM +0200, Robert Jarzmik wrote: > As the power supply framework provides a way to store and retrieve > private supply data, use it. > > In the process, change the platform data for wm97xx_battery from a > container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. > > Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> > --- > drivers/input/touchscreen/wm97xx-core.c | 2 +- > drivers/power/supply/wm97xx_battery.c | 25 ++++++++++--------------- > 2 files changed, 11 insertions(+), 16 deletions(-) I queued this into power-supply's for-next branch. -- Sebastian
Sebastian Reichel <sre@kernel.org> writes: > Hi Robert, > > On Wed, Oct 26, 2016 at 09:41:44PM +0200, Robert Jarzmik wrote: >> As the power supply framework provides a way to store and retrieve >> private supply data, use it. >> >> In the process, change the platform data for wm97xx_battery from a >> container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. >> >> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> >> --- >> drivers/input/touchscreen/wm97xx-core.c | 2 +- >> drivers/power/supply/wm97xx_battery.c | 25 ++++++++++--------------- >> 2 files changed, 11 insertions(+), 16 deletions(-) > > I queued this into power-supply's for-next branch. Thanks Sebastian. Cheers.
Hello, On Wed, Oct 26, 2016 at 12:41 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote: > As the power supply framework provides a way to store and retrieve > private supply data, use it. > > In the process, change the platform data for wm97xx_battery from a > container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. > > Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> kernelci.org has been reporting that the tegra20-iris board has been failing in -next since next-20161123[1], and also in mainline v4.10-rc. I finally took the time to bisect, and it pointed to this patch. I verified that reverting $SUBJECT patch[2] on top of v4.10-rc5 fixes the problem. Kevin [1] https://kernelci.org/boot/id/5879a3fe59b5141534f6c3ac/ [2] in mainline as commit: 6480af4915d6 power_supply: wm97xx_battery: use power_supply_get_drvdata > --- > drivers/input/touchscreen/wm97xx-core.c | 2 +- > drivers/power/supply/wm97xx_battery.c | 25 ++++++++++--------------- > 2 files changed, 11 insertions(+), 16 deletions(-) > > diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c > index 90d6be3c26cc..83cf11312fd9 100644 > --- a/drivers/input/touchscreen/wm97xx-core.c > +++ b/drivers/input/touchscreen/wm97xx-core.c > @@ -682,7 +682,7 @@ static int wm97xx_probe(struct device *dev) > } > platform_set_drvdata(wm->battery_dev, wm); > wm->battery_dev->dev.parent = dev; > - wm->battery_dev->dev.platform_data = pdata; > + wm->battery_dev->dev.platform_data = pdata->batt_pdata; > ret = platform_device_add(wm->battery_dev); > if (ret < 0) > goto batt_reg_err; > diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/wm97xx_battery.c > index 6285626d142a..e3edb31ac880 100644 > --- a/drivers/power/supply/wm97xx_battery.c > +++ b/drivers/power/supply/wm97xx_battery.c > @@ -30,8 +30,7 @@ static enum power_supply_property *prop; > > static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) > { > - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; > - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; > + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); > > return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), > pdata->batt_aux) * pdata->batt_mult / > @@ -40,8 +39,7 @@ static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) > > static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) > { > - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; > - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; > + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); > > return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), > pdata->temp_aux) * pdata->temp_mult / > @@ -52,8 +50,7 @@ static int wm97xx_bat_get_property(struct power_supply *bat_ps, > enum power_supply_property psp, > union power_supply_propval *val) > { > - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; > - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; > + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); > > switch (psp) { > case POWER_SUPPLY_PROP_STATUS: > @@ -103,8 +100,7 @@ static void wm97xx_bat_external_power_changed(struct power_supply *bat_ps) > static void wm97xx_bat_update(struct power_supply *bat_ps) > { > int old_status = bat_status; > - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; > - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; > + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); > > mutex_lock(&work_lock); > > @@ -166,15 +162,15 @@ static int wm97xx_bat_probe(struct platform_device *dev) > int ret = 0; > int props = 1; /* POWER_SUPPLY_PROP_PRESENT */ > int i = 0; > - struct wm97xx_pdata *wmdata = dev->dev.platform_data; > - struct wm97xx_batt_pdata *pdata; > + struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; > + struct power_supply_config cfg = {}; > > - if (!wmdata) { > + if (!pdata) { > dev_err(&dev->dev, "No platform data supplied\n"); > return -EINVAL; > } > > - pdata = wmdata->batt_pdata; > + cfg.drv_data = pdata; > > if (dev->id != -1) > return -EINVAL; > @@ -243,7 +239,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) > bat_psy_desc.properties = prop; > bat_psy_desc.num_properties = props; > > - bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, NULL); > + bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, &cfg); > if (!IS_ERR(bat_psy)) { > schedule_work(&bat_work); > } else { > @@ -266,8 +262,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) > > static int wm97xx_bat_remove(struct platform_device *dev) > { > - struct wm97xx_pdata *wmdata = dev->dev.platform_data; > - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; > + struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; > > if (pdata && gpio_is_valid(pdata->charge_gpio)) { > free_irq(gpio_to_irq(pdata->charge_gpio), dev); > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Hilman <khilman@kernel.org> writes: > Hello, > > On Wed, Oct 26, 2016 at 12:41 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote: >> As the power supply framework provides a way to store and retrieve >> private supply data, use it. >> >> In the process, change the platform data for wm97xx_battery from a >> container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. >> >> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> > > kernelci.org has been reporting that the tegra20-iris board has been > failing in -next since next-20161123[1], and also in mainline > v4.10-rc. I finally took the time to bisect, and it pointed to this > patch. I verified that reverting $SUBJECT patch[2] on top of > v4.10-rc5 fixes the problem. > > Kevin > > [1] https://kernelci.org/boot/id/5879a3fe59b5141534f6c3ac/ > [2] in mainline as commit: 6480af4915d6 power_supply: wm97xx_battery: > use power_supply_get_drvdata Hi Kevin, There is a fix posted in here : https://patchwork.kernel.org/patch/9499231/ I don't know if it's related, as I have no Oops signature nor any data to be able to help further. Cheers. -- Robert
On Tue, Jan 24, 2017 at 08:31:59AM +0100, Robert Jarzmik wrote: > Kevin Hilman <khilman@kernel.org> writes: > > > Hello, > > > > On Wed, Oct 26, 2016 at 12:41 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote: > >> As the power supply framework provides a way to store and retrieve > >> private supply data, use it. > >> > >> In the process, change the platform data for wm97xx_battery from a > >> container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. > >> > >> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> > > > > kernelci.org has been reporting that the tegra20-iris board has been > > failing in -next since next-20161123[1], and also in mainline > > v4.10-rc. I finally took the time to bisect, and it pointed to this > > patch. I verified that reverting $SUBJECT patch[2] on top of > > v4.10-rc5 fixes the problem. > > > > Kevin > > > > [1] https://kernelci.org/boot/id/5879a3fe59b5141534f6c3ac/ > > [2] in mainline as commit: 6480af4915d6 power_supply: wm97xx_battery: > > use power_supply_get_drvdata > > Hi Kevin, > > There is a fix posted in here : > https://patchwork.kernel.org/patch/9499231/ > > I don't know if it's related, as I have no Oops signature nor any data to be > able to help further. I picked up the patch from patchwork and will send it on to Linus in the next day or so. Thanks.
Dmitry Torokhov <dmitry.torokhov@gmail.com> writes: > On Tue, Jan 24, 2017 at 08:31:59AM +0100, Robert Jarzmik wrote: >> Kevin Hilman <khilman@kernel.org> writes: >> >> > Hello, >> > >> > On Wed, Oct 26, 2016 at 12:41 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote: >> >> As the power supply framework provides a way to store and retrieve >> >> private supply data, use it. >> >> >> >> In the process, change the platform data for wm97xx_battery from a >> >> container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. >> >> >> >> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> >> > >> > kernelci.org has been reporting that the tegra20-iris board has been >> > failing in -next since next-20161123[1], and also in mainline >> > v4.10-rc. I finally took the time to bisect, and it pointed to this >> > patch. I verified that reverting $SUBJECT patch[2] on top of >> > v4.10-rc5 fixes the problem. >> > >> > Kevin >> > >> > [1] https://kernelci.org/boot/id/5879a3fe59b5141534f6c3ac/ >> > [2] in mainline as commit: 6480af4915d6 power_supply: wm97xx_battery: >> > use power_supply_get_drvdata >> >> Hi Kevin, >> >> There is a fix posted in here : >> https://patchwork.kernel.org/patch/9499231/ >> >> I don't know if it's related, as I have no Oops signature nor any data to be >> able to help further. FWIW, that kernelci.org link above has full boot log available: https://storage.kernelci.org/next/next-20170113/arm-tegra_defconfig/lab-baylibre-seattle/boot-tegra20-iris-512.html > I picked up the patch from patchwork and will send it on to Linus in the > next day or so. I tested this on top of linus/master and the boot failure goes away. Feel free to add, Tested-by: Kevin Hilman <khilman@baylibre.com> Kevin
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index 90d6be3c26cc..83cf11312fd9 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -682,7 +682,7 @@ static int wm97xx_probe(struct device *dev) } platform_set_drvdata(wm->battery_dev, wm); wm->battery_dev->dev.parent = dev; - wm->battery_dev->dev.platform_data = pdata; + wm->battery_dev->dev.platform_data = pdata->batt_pdata; ret = platform_device_add(wm->battery_dev); if (ret < 0) goto batt_reg_err; diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/wm97xx_battery.c index 6285626d142a..e3edb31ac880 100644 --- a/drivers/power/supply/wm97xx_battery.c +++ b/drivers/power/supply/wm97xx_battery.c @@ -30,8 +30,7 @@ static enum power_supply_property *prop; static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) { - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), pdata->batt_aux) * pdata->batt_mult / @@ -40,8 +39,7 @@ static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) { - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), pdata->temp_aux) * pdata->temp_mult / @@ -52,8 +50,7 @@ static int wm97xx_bat_get_property(struct power_supply *bat_ps, enum power_supply_property psp, union power_supply_propval *val) { - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); switch (psp) { case POWER_SUPPLY_PROP_STATUS: @@ -103,8 +100,7 @@ static void wm97xx_bat_external_power_changed(struct power_supply *bat_ps) static void wm97xx_bat_update(struct power_supply *bat_ps) { int old_status = bat_status; - struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; + struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); mutex_lock(&work_lock); @@ -166,15 +162,15 @@ static int wm97xx_bat_probe(struct platform_device *dev) int ret = 0; int props = 1; /* POWER_SUPPLY_PROP_PRESENT */ int i = 0; - struct wm97xx_pdata *wmdata = dev->dev.platform_data; - struct wm97xx_batt_pdata *pdata; + struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; + struct power_supply_config cfg = {}; - if (!wmdata) { + if (!pdata) { dev_err(&dev->dev, "No platform data supplied\n"); return -EINVAL; } - pdata = wmdata->batt_pdata; + cfg.drv_data = pdata; if (dev->id != -1) return -EINVAL; @@ -243,7 +239,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) bat_psy_desc.properties = prop; bat_psy_desc.num_properties = props; - bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, NULL); + bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, &cfg); if (!IS_ERR(bat_psy)) { schedule_work(&bat_work); } else { @@ -266,8 +262,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) static int wm97xx_bat_remove(struct platform_device *dev) { - struct wm97xx_pdata *wmdata = dev->dev.platform_data; - struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; + struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; if (pdata && gpio_is_valid(pdata->charge_gpio)) { free_irq(gpio_to_irq(pdata->charge_gpio), dev);
As the power supply framework provides a way to store and retrieve private supply data, use it. In the process, change the platform data for wm97xx_battery from a container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> --- drivers/input/touchscreen/wm97xx-core.c | 2 +- drivers/power/supply/wm97xx_battery.c | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-)