public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Minkyu Kang <mk7.kang@samsung.com>
Cc: linux-kernel@vger.kernel.org,
	linux-pm@lists.linux-foundation.org, kyungmin.park@samsung.com,
	Anton Vorontsov <cbou@mail.ru>
Subject: Re: [PATCH] add MAX17040 Fuel Gauge driver
Date: Thu, 4 Jun 2009 00:37:17 -0700	[thread overview]
Message-ID: <20090604003717.b6941159.akpm@linux-foundation.org> (raw)
In-Reply-To: <4A25DB40.6010904@samsung.com>

On Wed, 03 Jun 2009 11:09:04 +0900 Minkyu Kang <mk7.kang@samsung.com> wrote:

> The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries
> This patch adds support the MAX17040 Fuel Gauge
> 
> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  drivers/power/Kconfig            |    8 +
>  drivers/power/Makefile           |    3 +-
>  drivers/power/max17040_battery.c |  304 ++++++++++++++++++++++++++++++++++++++
>  include/linux/max17040_battery.h |   19 +++

Please Cc Anton Vorontsov <cbou@mail.ru> on drivers/power patches.

>
> ...
>
> +static int __devinit max17040_probe(struct i2c_client *client,
> +			const struct i2c_device_id *id)
> +{
> +	struct max17040_chip *chip;
> +	int ret;
> +
> +	chip = kzalloc(sizeof(struct max17040_chip), GFP_KERNEL);
> +	if (!chip)
> +		return -ENOMEM;
> +
> +	chip->client = client;
> +	pdata = client->dev.platform_data;
> +
> +	i2c_set_clientdata(client, chip);
> +	max17040 = chip;
> +
> +	max17040_reset();
> +
> +	max17040_get_version();
> +
> +	INIT_DELAYED_WORK_DEFERRABLE(&chip->work, max17040_work);
> +	schedule_delayed_work(&chip->work, MAX17040_DELAY);
> +
> +	bat_ps.properties = max17040_battery_props;
> +	bat_ps.num_properties = ARRAY_SIZE(max17040_battery_props);
> +
> +	ret = power_supply_register(&client->dev, &bat_ps);
> +	if (ret) {
> +		dev_err(&max17040->client->dev,
> +				"failed: power supply register\n");
> +		kfree(chip);
> +		max17040 = NULL;
> +		i2c_set_clientdata(client, NULL);
> +		return -1;

This leaves the delayed work still pending.

> +	}
> +
> +	return 0;
> +}
> +
> +static int __devexit max17040_remove(struct i2c_client *client)
> +{
> +	struct max17040_chip *chip = i2c_get_clientdata(client);
> +
> +	kfree(chip);
> +	max17040 = NULL;
> +	i2c_set_clientdata(client, NULL);
> +	power_supply_unregister(&bat_ps);
> +	return 0;
> +}

Shouldn't max17040_remove() also cancel the delayed_work?

> +static int max17040_suspend(struct i2c_client *client,
> +		pm_message_t state)
> +{
> +	struct max17040_chip *chip = i2c_get_clientdata(client);
> +
> +	cancel_delayed_work(&chip->work);
> +	return 0;
> +}
> +
> +static int max17040_resume(struct i2c_client *client)
> +{
> +	struct max17040_chip *chip = i2c_get_clientdata(client);
> +
> +	schedule_delayed_work(&chip->work, MAX17040_DELAY);
> +	return 0;
> +}


      reply	other threads:[~2009-06-04  7:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-03  2:09 [PATCH] add MAX17040 Fuel Gauge driver Minkyu Kang
2009-06-04  7:37 ` Andrew Morton [this message]

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=20090604003717.b6941159.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cbou@mail.ru \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mk7.kang@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox