Skip to content

Commit

Permalink
hwmon: Convert from class_device to device
Browse files Browse the repository at this point in the history
Convert from class_device to device for hwmon_device_register/unregister

Signed-off-by: Tony Jones <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Kay Sievers <[email protected]>
Signed-off-by: Mark M. Hoffman <[email protected]>
  • Loading branch information
tonyj-suse authored and Mark M. Hoffman committed Oct 10, 2007
1 parent 59a35ba commit 1beeffe
Show file tree
Hide file tree
Showing 61 changed files with 308 additions and 309 deletions.
10 changes: 5 additions & 5 deletions drivers/hwmon/abituguru.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ MODULE_PARM_DESC(verbose, "How verbose should the driver be? (0-3):\n"
The structure is dynamically allocated, at the same time when a new
abituguru device is allocated. */
struct abituguru_data {
struct class_device *class_dev; /* hwmon registered device */
struct device *hwmon_dev; /* hwmon registered device */
struct mutex update_lock; /* protect access to data and uGuru */
unsigned long last_updated; /* In jiffies */
unsigned short addr; /* uguru base address */
Expand Down Expand Up @@ -1287,11 +1287,11 @@ static int __devinit abituguru_probe(struct platform_device *pdev)
&abituguru_sysfs_attr[i].dev_attr))
goto abituguru_probe_error;

data->class_dev = hwmon_device_register(&pdev->dev);
if (!IS_ERR(data->class_dev))
data->hwmon_dev = hwmon_device_register(&pdev->dev);
if (!IS_ERR(data->hwmon_dev))
return 0; /* success */

res = PTR_ERR(data->class_dev);
res = PTR_ERR(data->hwmon_dev);
abituguru_probe_error:
for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
Expand All @@ -1308,7 +1308,7 @@ static int __devexit abituguru_remove(struct platform_device *pdev)
int i;
struct abituguru_data *data = platform_get_drvdata(pdev);

hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/abituguru3.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct abituguru3_motherboard_info {
The structure is dynamically allocated, at the same time when a new
abituguru3 device is allocated. */
struct abituguru3_data {
struct class_device *class_dev; /* hwmon registered device */
struct device *hwmon_dev; /* hwmon registered device */
struct mutex update_lock; /* protect access to data and uGuru */
unsigned short addr; /* uguru base address */
char valid; /* !=0 if following fields are valid */
Expand Down Expand Up @@ -933,9 +933,9 @@ static int __devinit abituguru3_probe(struct platform_device *pdev)
&abituguru3_sysfs_attr[i].dev_attr))
goto abituguru3_probe_error;

data->class_dev = hwmon_device_register(&pdev->dev);
if (IS_ERR(data->class_dev)) {
res = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&pdev->dev);
if (IS_ERR(data->hwmon_dev)) {
res = PTR_ERR(data->hwmon_dev);
goto abituguru3_probe_error;
}

Expand All @@ -957,7 +957,7 @@ static int __devexit abituguru3_remove(struct platform_device *pdev)
struct abituguru3_data *data = platform_get_drvdata(pdev);

platform_set_drvdata(pdev, NULL);
hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
for (i = 0; i < ARRAY_SIZE(abituguru3_sysfs_attr); i++)
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/ad7418.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static const u8 AD7418_REG_TEMP[] = { AD7418_REG_TEMP_IN,

struct ad7418_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
struct attribute_group attrs;
enum chips type;
struct mutex lock;
Expand Down Expand Up @@ -326,9 +326,9 @@ static int ad7418_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs)))
goto exit_detach;

data->class_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}

Expand All @@ -347,7 +347,7 @@ static int ad7418_detect(struct i2c_adapter *adapter, int address, int kind)
static int ad7418_detach_client(struct i2c_client *client)
{
struct ad7418_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &data->attrs);
i2c_detach_client(client);
kfree(data);
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/adm1021.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ clearing it. Weird, ey? --Phil */
/* Each client has this additional data */
struct adm1021_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
enum chips type;

struct mutex update_lock;
Expand Down Expand Up @@ -319,9 +319,9 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = sysfs_create_group(&client->dev.kobj, &adm1021_group)))
goto error2;

data->class_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto error3;
}

Expand Down Expand Up @@ -351,7 +351,7 @@ static int adm1021_detach_client(struct i2c_client *client)
struct adm1021_data *data = i2c_get_clientdata(client);
int err;

hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &adm1021_group);

if ((err = i2c_detach_client(client)))
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/adm1025.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static struct i2c_driver adm1025_driver = {

struct adm1025_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
struct mutex update_lock;
char valid; /* zero until following fields are valid */
unsigned long last_updated; /* in jiffies */
Expand Down Expand Up @@ -472,9 +472,9 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind)
goto exit_remove;
}

data->class_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}

Expand Down Expand Up @@ -538,7 +538,7 @@ static int adm1025_detach_client(struct i2c_client *client)
struct adm1025_data *data = i2c_get_clientdata(client);
int err;

hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &adm1025_group);
sysfs_remove_group(&client->dev.kobj, &adm1025_group_opt);

Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/adm1026.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ struct pwm_data {

struct adm1026_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
enum chips type;

struct mutex update_lock;
Expand Down Expand Up @@ -1676,9 +1676,9 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
if ((err = sysfs_create_group(&new_client->dev.kobj, &adm1026_group)))
goto exitdetach;

data->class_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exitremove;
}

Expand All @@ -1698,7 +1698,7 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
static int adm1026_detach_client(struct i2c_client *client)
{
struct adm1026_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &adm1026_group);
i2c_detach_client(client);
kfree(data);
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/adm1029.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static struct i2c_driver adm1029_driver = {

struct adm1029_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
struct mutex update_lock;
char valid; /* zero until following fields are valid */
unsigned long last_updated; /* in jiffies */
Expand Down Expand Up @@ -391,9 +391,9 @@ static int adm1029_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = sysfs_create_group(&client->dev.kobj, &adm1029_group)))
goto exit_detach;

data->class_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove_files;
}

Expand Down Expand Up @@ -431,7 +431,7 @@ static int adm1029_detach_client(struct i2c_client *client)
struct adm1029_data *data = i2c_get_clientdata(client);
int err;

hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &adm1029_group);

if ((err = i2c_detach_client(client)))
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/adm1031.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ typedef u8 auto_chan_table_t[8][2];
/* Each client has this additional data */
struct adm1031_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
struct mutex update_lock;
int chip_type;
char valid; /* !=0 if following fields are valid */
Expand Down Expand Up @@ -853,9 +853,9 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
goto exit_remove;
}

data->class_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}

Expand All @@ -877,7 +877,7 @@ static int adm1031_detach_client(struct i2c_client *client)
struct adm1031_data *data = i2c_get_clientdata(client);
int ret;

hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &adm1031_group);
sysfs_remove_group(&client->dev.kobj, &adm1031_group_opt);
if ((ret = i2c_detach_client(client)) != 0) {
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/adm9240.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static struct i2c_driver adm9240_driver = {
struct adm9240_data {
enum chips type;
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
struct mutex update_lock;
char valid;
unsigned long last_updated_measure;
Expand Down Expand Up @@ -590,9 +590,9 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = sysfs_create_group(&new_client->dev.kobj, &adm9240_group)))
goto exit_detach;

data->class_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}

Expand Down Expand Up @@ -620,7 +620,7 @@ static int adm9240_detach_client(struct i2c_client *client)
struct adm9240_data *data = i2c_get_clientdata(client);
int err;

hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &adm9240_group);

if ((err = i2c_detach_client(client)))
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/adt7470.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ I2C_CLIENT_INSMOD_1(adt7470);

struct adt7470_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
struct attribute_group attrs;
struct mutex lock;
char sensors_valid;
Expand Down Expand Up @@ -1003,9 +1003,9 @@ static int adt7470_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs)))
goto exit_detach;

data->class_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}

Expand All @@ -1025,7 +1025,7 @@ static int adt7470_detach_client(struct i2c_client *client)
{
struct adt7470_data *data = i2c_get_clientdata(client);

hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &data->attrs);
i2c_detach_client(client);
kfree(data);
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/applesmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static s16 rest_x;
static s16 rest_y;
static struct timer_list applesmc_timer;
static struct input_dev *applesmc_idev;
static struct class_device *hwmon_class_dev;
static struct device *hwmon_dev;

/* Indicates whether this computer has an accelerometer. */
static unsigned int applesmc_accelerometer;
Expand Down Expand Up @@ -1287,9 +1287,9 @@ static int __init applesmc_init(void)
goto out_light_wq;
}

hwmon_class_dev = hwmon_device_register(&pdev->dev);
if (IS_ERR(hwmon_class_dev)) {
ret = PTR_ERR(hwmon_class_dev);
hwmon_dev = hwmon_device_register(&pdev->dev);
if (IS_ERR(hwmon_dev)) {
ret = PTR_ERR(hwmon_dev);
goto out_light_ledclass;
}

Expand Down Expand Up @@ -1331,7 +1331,7 @@ static int __init applesmc_init(void)

static void __exit applesmc_exit(void)
{
hwmon_device_unregister(hwmon_class_dev);
hwmon_device_unregister(hwmon_dev);
if (applesmc_light) {
led_classdev_unregister(&applesmc_backlight);
destroy_workqueue(applesmc_led_wq);
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/asb100.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static u8 DIV_TO_REG(long val)
dynamically allocated, at the same time the client itself is allocated. */
struct asb100_data {
struct i2c_client client;
struct class_device *class_dev;
struct device *hwmon_dev;
struct mutex lock;
enum chips type;

Expand Down Expand Up @@ -844,9 +844,9 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = sysfs_create_group(&new_client->dev.kobj, &asb100_group)))
goto ERROR3;

data->class_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->class_dev)) {
err = PTR_ERR(data->class_dev);
data->hwmon_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto ERROR4;
}

Expand Down Expand Up @@ -874,7 +874,7 @@ static int asb100_detach_client(struct i2c_client *client)

/* main client */
if (data) {
hwmon_device_unregister(data->class_dev);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &asb100_group);
}

Expand Down
Loading

0 comments on commit 1beeffe

Please sign in to comment.