All of lore.kernel.org
 help / color / mirror / Atom feed
From: Todd E Brandt <todd.e.brandt@linux.intel.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, jacob.jun.pan@linux.intel.com,
	sameo@linux.intel.com, lee.jones@linaro.org,
	dbaryshkov@gmail.com, dwmw2@infradead.org,
	david.woodhouse@intel.com, todd.e.brandt@intel.com
Subject: Re: [PATCH 3/3] power/axp288_fuel_gauge: axp288 fuel gauge driver
Date: Wed, 21 Jan 2015 12:52:53 -0800	[thread overview]
Message-ID: <20150121205253.GB15525@linux.intel.com> (raw)
In-Reply-To: <20150118104923.GA11147@earth.universe>

On Sun, Jan 18, 2015 at 11:49:27AM +0100, Sebastian Reichel wrote:
> Hi,
> 
> On Wed, Jan 07, 2015 at 01:26:55PM -0800, Todd E Brandt wrote:
> > X-Power AXP288 PMIC Fuel Gauge Driver
> > 
> >  new power_supply driver at driver/power
> >  interfaces with the axp20x mfd driver as a cell
> >  provides battery info and monitors for changes
> >  generates alerts on temperature and capacity issues
> > 
> > [...]
> >
> > +static int fuel_gauge_battery_health(struct axp288_fg_info *info)
> > +{
> > +	int temp, vocv;
> > +	int ret, health = POWER_SUPPLY_HEALTH_UNKNOWN;
> > +
> > +	ret = fuel_gauge_get_btemp(info, &temp);
> > +	if (ret < 0)
> > +		goto health_read_fail;
> > +
> > +	ret = fuel_gauge_get_vocv(info, &vocv);
> > +	if (ret < 0)
> > +		goto health_read_fail;
> > +
> > +	if (vocv > info->pdata->max_volt)
> > +		health = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
> > +	else if (temp > info->pdata->max_temp ||
> > +			temp < info->pdata->min_temp)
> > +		health = POWER_SUPPLY_HEALTH_OVERHEAT;
> 
> if (temp < info->pdata->min_temp)
>     health = POWER_SUPPLY_HEALTH_COLD;

Will add in v2, thanks.

> 
> > +	else if (vocv < info->pdata->min_volt)
> > +		health = POWER_SUPPLY_HEALTH_DEAD;
> > +	else
> > +		health = POWER_SUPPLY_HEALTH_GOOD;
> > +
> > +health_read_fail:
> > +	return health;
> > +}
> >
> > [...]
> >
> > +static int axp288_fuel_gauge_remove(struct platform_device *pdev)
> > +{
> > +	return 0;
> > +}
> 
> You can drop this function if nothing needs to be cleaned, but
> that's not the case, so where is the cleanup code?

You're right, I believe it needs:

cancel_delayed_work_sync(&info->status_monitor);
power_supply_unregister(&info->bat);

will add in v2, thanks

> 
> > [...]
> 
> -- Sebastian



WARNING: multiple messages have this Message-ID (diff)
From: Todd E Brandt <todd.e.brandt-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	david.woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	todd.e.brandt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 3/3] power/axp288_fuel_gauge: axp288 fuel gauge driver
Date: Wed, 21 Jan 2015 12:52:53 -0800	[thread overview]
Message-ID: <20150121205253.GB15525@linux.intel.com> (raw)
In-Reply-To: <20150118104923.GA11147-SfvFxonMDyemK9LvCR3Hrw@public.gmane.org>

On Sun, Jan 18, 2015 at 11:49:27AM +0100, Sebastian Reichel wrote:
> Hi,
> 
> On Wed, Jan 07, 2015 at 01:26:55PM -0800, Todd E Brandt wrote:
> > X-Power AXP288 PMIC Fuel Gauge Driver
> > 
> >  new power_supply driver at driver/power
> >  interfaces with the axp20x mfd driver as a cell
> >  provides battery info and monitors for changes
> >  generates alerts on temperature and capacity issues
> > 
> > [...]
> >
> > +static int fuel_gauge_battery_health(struct axp288_fg_info *info)
> > +{
> > +	int temp, vocv;
> > +	int ret, health = POWER_SUPPLY_HEALTH_UNKNOWN;
> > +
> > +	ret = fuel_gauge_get_btemp(info, &temp);
> > +	if (ret < 0)
> > +		goto health_read_fail;
> > +
> > +	ret = fuel_gauge_get_vocv(info, &vocv);
> > +	if (ret < 0)
> > +		goto health_read_fail;
> > +
> > +	if (vocv > info->pdata->max_volt)
> > +		health = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
> > +	else if (temp > info->pdata->max_temp ||
> > +			temp < info->pdata->min_temp)
> > +		health = POWER_SUPPLY_HEALTH_OVERHEAT;
> 
> if (temp < info->pdata->min_temp)
>     health = POWER_SUPPLY_HEALTH_COLD;

Will add in v2, thanks.

> 
> > +	else if (vocv < info->pdata->min_volt)
> > +		health = POWER_SUPPLY_HEALTH_DEAD;
> > +	else
> > +		health = POWER_SUPPLY_HEALTH_GOOD;
> > +
> > +health_read_fail:
> > +	return health;
> > +}
> >
> > [...]
> >
> > +static int axp288_fuel_gauge_remove(struct platform_device *pdev)
> > +{
> > +	return 0;
> > +}
> 
> You can drop this function if nothing needs to be cleaned, but
> that's not the case, so where is the cleanup code?

You're right, I believe it needs:

cancel_delayed_work_sync(&info->status_monitor);
power_supply_unregister(&info->bat);

will add in v2, thanks

> 
> > [...]
> 
> -- Sebastian

  reply	other threads:[~2015-01-21 20:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 21:26 [PATCH 3/3] power/axp288_fuel_gauge: axp288 fuel gauge driver Todd E Brandt
2015-01-07 21:26 ` Todd E Brandt
2015-01-18 10:49 ` Sebastian Reichel
2015-01-18 10:49   ` Sebastian Reichel
2015-01-21 20:52   ` Todd E Brandt [this message]
2015-01-21 20:52     ` Todd E Brandt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150121205253.GB15525@linux.intel.com \
    --to=todd.e.brandt@linux.intel.com \
    --cc=david.woodhouse@intel.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=sre@kernel.org \
    --cc=todd.e.brandt@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.