Skip to contentSkip to conversation

hwmon: lm75: Add __devinit and __devexit

PATCH In review Shubhrajyoti D 3 participants 7 messages Sep 13, 2010 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 hwmon: lm75: Add __devinit and __devexit

---
 drivers/hwmon/lm75.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/lm75.c +3 -3
index ab5b87a..028f961 100644
@@ -134,7 +134,7 @@ static const struct attribute_group lm75_group = {
 
 /* device probe and removal */
 
-static int
+static int __devinit
 lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
 	struct lm75_data *data;
@@ -196,7 +196,7 @@ exit_free:
 	return status;
 }
 
-static int lm75_remove(struct i2c_client *client)
+static int __devexit lm75_remove(struct i2c_client *client)
 {
 	struct lm75_data *data = i2c_get_clientdata(client);
 
@@ -325,7 +325,7 @@ static struct i2c_driver lm75_driver = {
 		.pm	= LM75_DEV_PM_OPS,
 	},
 	.probe		= lm75_probe,
-	.remove		= lm75_remove,
+	.remove		=  __devexit_p(lm75_remove),
 	.id_table	= lm75_ids,
 	.detect		= lm75_detect,
 	.address_list	= normal_i2c,
Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw

Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and

Shubhrajyoti D said the following:
...

drivers/hwmon/lm75.c static const struct attribute_group lm75_group = { · line 138

Quoted 3 lines
drivers/hwmon/lm75.c +1 -1
-static int
+static int __devinit
 lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)

Are you sure?
If I understand correctly, this function will be thrown away after system/module init. But what's about devices that are added later? I would expect them to crash on init...

Signature · 7 lines
KR
Michael

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw

Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and

In reply to Shubhrajyoti D
Quoted 13 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 2:52 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Shubhrajyoti D said the following:
...

Quoted 7 lines

drivers/hwmon/lm75.c static const struct attribute_group lm75_group = { · line 138

Quoted 3 lines
drivers/hwmon/lm75.c +1 -1
-static int
+static int __devinit
 lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)

Are you sure?
If I understand correctly, this function will be thrown away after system/module init. But what's about devices that are added later? I would expect them to crash on init...

As all of these are I2C devices are I2C I thought it makes sense. Are you aware of devices that can be plugged/wired runtime?

Quoted 4 lines

--
KR
Michael

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw

Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and

In reply to Shubhrajyoti D

Datta, Shubhrajyoti said the following:

Quoted 20 lines
Quoted 13 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 2:52 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Shubhrajyoti D said the following:
...

Quoted 7 lines

drivers/hwmon/lm75.c static const struct attribute_group lm75_group = { · line 138

Quoted 3 lines
drivers/hwmon/lm75.c +1 -1
-static int
+static int __devinit
 lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)

Are you sure?
If I understand correctly, this function will be thrown away after system/module init. But what's about devices that are added later? I would expect them to crash on init...

Quoted 2 lines

As all of these are I2C devices are I2C I thought it makes sense. Are you aware of devices that can be plugged/wired runtime?

Almost all if behind a multiplexer ;-)
There is just some care in synchronization needed.
We are currently working with such a system that dynamically adds buses and drops them again (triggered by hotplug).

Signature · 8 lines
KR
Michael


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#4 lore raw

Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and

In reply to Shubhrajyoti D
Quoted 28 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 4:42 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Datta, Shubhrajyoti said the following:

Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 2:52 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Quoted 6 lines
Quoted 6 lines

Shubhrajyoti D said the following:
...

drivers/hwmon/lm75.c static const struct attribute_group lm75_group = {

Quoted 3 lines
drivers/hwmon/lm75.c +1 -1
-static int
+static int __devinit
 lm75_probe(struct i2c_client *client, const struct i2c_device_id

*id)

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Are you sure?
If I understand correctly, this function will be thrown away after system/module init. But what's about devices that are added later? I would expect them to crash on init...

As all of these are I2C devices are I2C I thought it makes sense. Are you aware of devices that can be plugged/wired runtime?

Almost all if behind a multiplexer ;-)

I missed this part.

Quoted 3 lines

There is just some care in synchronization needed.
We are currently working with such a system that dynamically adds buses and drops them again (triggered by hotplug).

Does it mean that all the existing drivers need to adapt.

Quoted 3 lines

--
KR
Michael

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#5 lore raw

Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and

In reply to Shubhrajyoti D

Datta, Shubhrajyoti said the following:

Quoted 32 lines
Quoted 32 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 4:42 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Datta, Shubhrajyoti said the following:

Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 2:52 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Quoted 6 lines
Quoted 6 lines

Shubhrajyoti D said the following:
...

drivers/hwmon/lm75.c static const struct attribute_group lm75_group = {

Quoted 3 lines
drivers/hwmon/lm75.c +1 -1
-static int
+static int __devinit
 lm75_probe(struct i2c_client *client, const struct i2c_device_id

*id)

Quoted 4 lines
Quoted 4 lines

Are you sure?
If I understand correctly, this function will be thrown away after system/module init. But what's about devices that are added later? I would expect them to crash on init...

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

As all of these are I2C devices are I2C I thought it makes sense. Are you aware of devices that can be plugged/wired runtime?

Almost all if behind a multiplexer ;-)

I missed this part.

There even exist multiplexer that check the bus state and allow connection only within stop<->start phases.

Quoted 5 lines
Quoted 4 lines

There is just some care in synchronization needed.
We are currently working with such a system that dynamically adds buses and drops them again (triggered by hotplug).

Does it mean that all the existing drivers need to adapt.

I expect them to get adapted step by step when/if this really becomes an issue. Maybe someday a general cleanup will necessary (and done). Anyway this might be already an issue for hot plugged cards (e.g. a compact PCI TV card) that has a local i2c adapter on and common devices on its local bus. But either this scenario does not exist in practical life or was fixed by a local code fix.

--
KR
Michael

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#6 lore raw

Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and

In reply to Shubhrajyoti D
Quoted 44 lines · Michael Lawnick

Datta, Shubhrajyoti said the following:

Quoted 32 lines
Quoted 32 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 4:42 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Datta, Shubhrajyoti said the following:

Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Michael Lawnick [mailto:[email protected]]
Sent: Monday, September 13, 2010 2:52 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [PATCH v3] hwmon: lm75: Add __devinit and __devexit section initializers

Quoted 6 lines
Quoted 6 lines

Shubhrajyoti D said the following:
...

drivers/hwmon/lm75.c static const struct attribute_group lm75_group = {

Quoted 3 lines
drivers/hwmon/lm75.c +1 -1
-static int
+static int __devinit
 lm75_probe(struct i2c_client *client, const struct i2c_device_id

*id)

Quoted 4 lines
Quoted 4 lines

Are you sure?
If I understand correctly, this function will be thrown away after system/module init. But what's about devices that are added later? I would expect them to crash on init...

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

As all of these are I2C devices are I2C I thought it makes sense. Are you aware of devices that can be plugged/wired runtime?

Almost all if behind a multiplexer ;-)

I missed this part.

There even exist multiplexer that check the bus state and allow connection only within stop<->start phases.

Quoted 4 lines
Quoted 4 lines

There is just some care in synchronization needed.
We are currently working with such a system that dynamically adds buses and drops them again (triggered by hotplug).

Quoted 9 lines
Quoted 1 line

Does it mean that all the existing drivers need to adapt.

I expect them to get adapted step by step when/if this really becomes an issue. Maybe someday a general cleanup will necessary (and done). Anyway this might be already an issue for hot plugged cards (e.g. a compact PCI TV card) that has a local i2c adapter on and common devices on its local bus. But either this scenario does not exist in practical life or was fixed by a local code fix.

This is an interesting use case. I didn't think about it either.

Looking through other drivers, it seems to be common that __devinit and __devexit are used only if the device is known to be static. Some even make a destinction based on the interface type (eg lm78).

As such, it may be better not to apply this patch.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors