Skip to contentSkip to conversation

max17042_battery: fix driver exit function

PATCH Applied Ramakrishna Pallala 2 participants 4 messages Mar 26, 2012 – May 5, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 max17042_battery: fix driver exit function

This patch frees the irq and sets the i2c client
data to NULL in driver remove function.

---
 drivers/power/max17042_battery.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/power/max17042_battery.c +4 -0
index abf3400..d4868c5 100644
@@ -721,6 +721,10 @@ static int __devexit max17042_remove(struct i2c_client *client)
 	struct max17042_chip *chip = i2c_get_clientdata(client);
 
 	power_supply_unregister(&chip->battery);
+	if (client->irq)
+		free_irq(client->irq, chip);
+	i2c_set_clientdata(client, NULL);
+
 	return 0;
 }
 
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Anton,

Quoted 18 lines

From: Pallala, Ramakrishna
Sent: Monday, March 26, 2012 3:38 PM
To: [email protected]
Cc: Anton Vorontsov; Anton Vorontsov; Pallala, Ramakrishna
Subject: [PATCH] max17042_battery: fix driver exit function

This patch frees the irq and sets the i2c client data to NULL in driver remove function.

---
 drivers/power/max17042_battery.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/power/max17042_battery.c +0 -0
index abf3400..d4868c5 100644

drivers/power/max17042_battery.c static int __devexit max17042_remove(struct i2c_client *client) · line 729

Quoted 9 lines
drivers/power/max17042_battery.c +4 -0
@@ -721,6 +721,10 @@ static int __devexit max17042_remove(struct i2c_client *client)
 	struct max17042_chip *chip = i2c_get_clientdata(client);
 
 	power_supply_unregister(&chip->battery);
+	if (client->irq)
+		free_irq(client->irq, chip);
+	i2c_set_clientdata(client, NULL);
+
 	return 0;
 }

I have not received any comments for this patch. Can I assume that this patch is in your merge queue?

Thanks,
Ram

#2 lore raw

Hello Ramakrishna,

On Tue, Apr 10, 2012 at 05:20:33AM +0000, Pallala, Ramakrishna wrote:
[...]

Quoted 10 lines

drivers/power/max17042_battery.c static int __devexit max17042_remove(struct i2c_client *client) · line 729

Quoted 7 lines
drivers/power/max17042_battery.c +4 -0
 	power_supply_unregister(&chip->battery);
+	if (client->irq)
+		free_irq(client->irq, chip);
+	i2c_set_clientdata(client, NULL);
+
 	return 0;
 }

I have not received any comments for this patch. Can I assume that this patch is in your merge queue?

Applied, but I removed i2c_set_clientdata(client, NULL) line in this patch. It is not be required nowadays, I2C core does it by itself.

Plus, I changed the order of the calls: we should free irq first, then unregister the power supply (btw, you might want to fix probe function as well: it should request irq only after power supply object is fully usable).

Thanks!

Signature · 2 lines
Anton Vorontsov
Email: [email protected]
#3 lore raw
Quoted 13 lines · Ramakrishna

[...]

Quoted 10 lines

drivers/power/max17042_battery.c static int __devexit max17042_remove(struct i2c_client *client) · line 729

Quoted 7 lines
drivers/power/max17042_battery.c +4 -0
 	power_supply_unregister(&chip->battery);
+	if (client->irq)
+		free_irq(client->irq, chip);
+	i2c_set_clientdata(client, NULL);
+
 	return 0;
 }

I have not received any comments for this patch. Can I assume that this patch is in your merge queue?

Quoted 6 lines

Applied, but I removed i2c_set_clientdata(client, NULL) line in this patch. It is not be required nowadays, I2C core does it by itself.

Plus, I changed the order of the calls: we should free irq first, then unregister the power supply (btw, you might want to fix probe function as well: it should request irq only after power supply object is fully usable).

Thanks for the fix. I will look into the probe().

Thanks,
Ram ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�