hwmon: Avoid initializing the same field twice
Subsystems (4)
PATCH 1/1 hwmon: Avoid initializing the same field twice
All hwmon drivers allocate their data structure with some form of kzalloc, so setting data fields to zero explicitly is a waste of time.
---
Guenter, this is likely to conflict with your current conversion work, as most of these drivers have not been converted yet (lm63 is the exception.) I thought splitting this patch per driver was a little overkill but maybe this would be better for you? I think I'll split at least pc87360 anyway as it's non-trivial. Let me know how you want to proceed.
drivers/hwmon/asc7621.c | 1 - drivers/hwmon/atxp1.c | 2 -- drivers/hwmon/lm63.c | 1 - drivers/hwmon/lm77.c | 1 - drivers/hwmon/lm83.c | 1 - drivers/hwmon/lm87.c | 1 - drivers/hwmon/lm92.c | 1 - drivers/hwmon/lm93.c | 1 - drivers/hwmon/lm95241.c | 2 -- drivers/hwmon/lm95245.c | 1 - drivers/hwmon/max1619.c | 1 - drivers/hwmon/pc87360.c | 12 ++++++------ drivers/hwmon/w83792d.c | 1 - drivers/hwmon/w83l785ts.c | 4 ---- 14 files changed, 6 insertions(+), 24 deletions(-)
drivers/hwmon/lm63.c +0 -1
@@ -1121,7 +1121,6 @@ static int lm63_probe(struct i2c_clientreturn -ENOMEM ; data->client = client; - data->valid =0 ;mutex_init (&data->update_lock);/* Set the device type */
drivers/hwmon/lm77.c +0 -1
@@ -348,7 +348,6 @@ static int lm77_probe(struct i2c_clientreturn -ENOMEM ;i2c_set_clientdata (client, data); - data->valid =0 ;mutex_init (&data->update_lock);/* Initialize the LM77 chip */
drivers/hwmon/lm83.c +0 -1
@@ -349,7 +349,6 @@ static int lm83_probe(struct i2c_clientreturn -ENOMEM ;i2c_set_clientdata (new_client, data); - data->valid =0 ;mutex_init (&data->update_lock);/*
drivers/hwmon/lm92.c +0 -1
@@ -380,7 +380,6 @@ static int lm92_probe(struct i2c_clientreturn -ENOMEM ;i2c_set_clientdata (new_client, data); - data->valid =0 ;mutex_init (&data->update_lock);/* Initialize the chipset */
drivers/hwmon/lm95241.c +0 -2
@@ -371,9 +371,7 @@ static void lm95241_init_client(struct istruct lm95241_data *data =i2c_get_clientdata (client); data->interval =HZ ;/* 1 sec default */ - data->valid =0 ; data->config =CFG_CR0076 ; - data->model =0 ; data->trutherm = (TT_OFF <<TT1_SHIFT ) | (TT_OFF <<TT2_SHIFT );i2c_smbus_write_byte_data (client,LM95241_REG_RW_CONFIG , data->config);
drivers/hwmon/asc7621.c +0 -1
@@ -1115,7 +1115,6 @@ asc7621_probe(struct i2c_client *client,return -ENOMEM ;i2c_set_clientdata (client, data); - data->valid =0 ;mutex_init (&data->update_lock);/* Initialize the asc7621 chip */
drivers/hwmon/atxp1.c +0 -2
@@ -353,8 +353,6 @@ static int atxp1_probe(struct i2c_client data->vrm =vid_which_vrm ();i2c_set_clientdata (new_client, data); - data->valid =0 ; -mutex_init (&data->update_lock);/* Register sysfs hooks */
drivers/hwmon/lm87.c +0 -1
@@ -903,7 +903,6 @@ static int lm87_probe(struct i2c_clientreturn -ENOMEM ;i2c_set_clientdata (client, data); - data->valid =0 ;mutex_init (&data->update_lock);/* Initialize the LM87 chip */
drivers/hwmon/lm93.c +0 -1
@@ -2754,7 +2754,6 @@ static int lm93_probe(struct i2c_clienti2c_set_clientdata (client, data);/* housekeeping */ - data->valid =0 ; data->update = update;mutex_init (&data->update_lock);
drivers/hwmon/lm95245.c +0 -1
@@ -440,7 +440,6 @@ static void lm95245_init_client(struct i {struct lm95245_data *data =i2c_get_clientdata (client); - data->valid =0 ; data->interval =lm95245_read_conversion_rate (client); data->config1 = i2c_smbus_read_byte_data(client,
drivers/hwmon/max1619.c +0 -1
@@ -273,7 +273,6 @@ static int max1619_probe(struct i2c_cliereturn -ENOMEM ;i2c_set_clientdata (new_client, data); - data->valid =0 ;mutex_init (&data->update_lock);/* Initialize the MAX1619 chip */
drivers/hwmon/pc87360.c +6 -6
@@ -1225,7 +1225,7 @@ static int pc87360_probe(struct platformint i;struct pc87360_data *data;int err =0 ; -const char *name ="pc87360" ; +const char *name;int use_thermistors =0 ;struct device *dev = &pdev->dev;
@@ -1233,13 +1233,14 @@ static int pc87360_probe(struct platformif (!data)return -ENOMEM ; - data->fannr =2 ; - data->innr =0 ; - data->tempnr =0 ; -switch (devid) { +default : + name ="pc87360" ; + data->fannr =2 ; +break ;case 0xe8 : name ="pc87363" ; + data->fannr =2 ;break ;case 0xe4 : name ="pc87364" ;
@@ -1260,7 +1261,6 @@ static int pc87360_probe(struct platform } data->name = name; - data->valid =0 ;mutex_init (&data->lock);mutex_init (&data->update_lock);platform_set_drvdata (pdev, data);
drivers/hwmon/w83792d.c +0 -1
@@ -1376,7 +1376,6 @@ w83792d_probe(struct i2c_client *client,return -ENOMEM ;i2c_set_clientdata (client, data); - data->valid =0 ;mutex_init (&data->update_lock); err =w83792d_detect_subclients (client);
drivers/hwmon/w83l785ts.c +0 -4
@@ -188,12 +188,8 @@ static int w83l785ts_probe(struct i2c_clreturn -ENOMEM ;i2c_set_clientdata (client, data); - data->valid =0 ;mutex_init (&data->update_lock); -/* Default values in case the first read fails (unlikely). */ - data->temp[1 ] = data->temp[0 ] =0 ; -/* * Initialize the W83L785TS chip * Nothing yet, assume it is already started.
Signature · 7 lines
Jean Delvare Suse L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 12 lines · Jean Delvare
All hwmon drivers allocate their data structure with some form of kzalloc, so setting data fields to zero explicitly is a waste of time.
Signed-off-by Jean Delvare <[email protected]>---
Guenter, this is likely to conflict with your current conversion work, as most of these drivers have not been converted yet (lm63 is the exception.) I thought splitting this patch per driver was a little overkill but maybe this would be better for you? I think I'll split at least pc87360 anyway as it's non-trivial. Let me know how you want to proceed.
One option would be to take the patch into my repository, or just hold off with further conversions until after 3.15-rc1. Maybe the latter, as we'll already have a conflict with the lm63 driver.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 4 lines · Jean Delvare
All hwmon drivers allocate their data structure with some form of kzalloc, so setting data fields to zero explicitly is a waste of time.
Signed-off-by Jean Delvare <[email protected]>
Forgot: Reviewed-by: Guenter Roeck <[email protected]>
Quoted 7 lines
---
Guenter, this is likely to conflict with your current conversion work, as most of these drivers have not been converted yet (lm63 is the exception.) I thought splitting this patch per driver was a little overkill but maybe this would be better for you? I think I'll split at least pc87360 anyway as it's non-trivial. Let me know how you want to proceed.
Also, yes, separating the pc87360 patch might make sense.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 14 lines · Guenter Roeck
Quoted 12 lines · Jean Delvare
All hwmon drivers allocate their data structure with some form of kzalloc, so setting data fields to zero explicitly is a waste of time.
Signed-off-by Jean Delvare <[email protected]>---
Guenter, this is likely to conflict with your current conversion work, as most of these drivers have not been converted yet (lm63 is the exception.) I thought splitting this patch per driver was a little overkill but maybe this would be better for you? I think I'll split at least pc87360 anyway as it's non-trivial. Let me know how you want to proceed.
Quoted 3 lines
One option would be to take the patch into my repository, or just hold off with further conversions until after 3.15-rc1. Maybe the latter, as we'll already have a conflict with the lm63 driver.
Please don't refrain from converting drivers just because of this cleanup.
I'll split lm63 and pc87360 (for me) and lm95241 and lm95245 (for you), and keep the rest in a single patch for now. If other patches come in that touch these drivers, I'll split it further and the relevant parts can go into your tree.
That's the beauty of quilt-based trees, I can rework pretty much everything easily.
Signature · 7 lines
Jean Delvare Suse L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 19 lines · Jean Delvare
Quoted 14 lines · Guenter Roeck
Quoted 12 lines · Jean Delvare
All hwmon drivers allocate their data structure with some form of kzalloc, so setting data fields to zero explicitly is a waste of time.
Signed-off-by Jean Delvare <[email protected]>---
Guenter, this is likely to conflict with your current conversion work, as most of these drivers have not been converted yet (lm63 is the exception.) I thought splitting this patch per driver was a little overkill but maybe this would be better for you? I think I'll split at least pc87360 anyway as it's non-trivial. Let me know how you want to proceed.Quoted 3 lines
One option would be to take the patch into my repository, or just hold off with further conversions until after 3.15-rc1. Maybe the latter, as we'll already have a conflict with the lm63 driver.
Quoted 8 lines
Please don't refrain from converting drivers just because of this cleanup.
I'll split lm63 and pc87360 (for me) and lm95241 and lm95245 (for you), and keep the rest in a single patch for now. If other patches come in that touch these drivers, I'll split it further and the relevant parts can go into your tree.
Sounds like a plan.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors