diff options
author | Jean Delvare <khali@linux-fr.org> | 2011-05-25 14:43:31 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2011-05-25 14:43:31 -0400 |
commit | 95de3b257516d21af6e0313c7bab119e4f80d6f4 (patch) | |
tree | 818026064f6a1602e08521f5adaed3aed6313013 /drivers/hwmon/lm70.c | |
parent | bc1f419c76a2d6450413ce4349f4e4a07be011d5 (diff) |
hwmon: Use helper functions to set and get driver data
Use helper functions to set and get driver data. This is more elegant.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/lm70.c')
-rw-r--r-- | drivers/hwmon/lm70.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index 3b84fb503053..c274ea25d899 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -58,7 +58,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
58 | int status, val = 0; | 58 | int status, val = 0; |
59 | u8 rxbuf[2]; | 59 | u8 rxbuf[2]; |
60 | s16 raw=0; | 60 | s16 raw=0; |
61 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 61 | struct lm70 *p_lm70 = spi_get_drvdata(spi); |
62 | 62 | ||
63 | if (mutex_lock_interruptible(&p_lm70->lock)) | 63 | if (mutex_lock_interruptible(&p_lm70->lock)) |
64 | return -ERESTARTSYS; | 64 | return -ERESTARTSYS; |
@@ -163,7 +163,7 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
163 | status = PTR_ERR(p_lm70->hwmon_dev); | 163 | status = PTR_ERR(p_lm70->hwmon_dev); |
164 | goto out_dev_reg_failed; | 164 | goto out_dev_reg_failed; |
165 | } | 165 | } |
166 | dev_set_drvdata(&spi->dev, p_lm70); | 166 | spi_set_drvdata(spi, p_lm70); |
167 | 167 | ||
168 | if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input)) | 168 | if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input)) |
169 | || (status = device_create_file(&spi->dev, &dev_attr_name))) { | 169 | || (status = device_create_file(&spi->dev, &dev_attr_name))) { |
@@ -177,19 +177,19 @@ out_dev_create_file_failed: | |||
177 | device_remove_file(&spi->dev, &dev_attr_temp1_input); | 177 | device_remove_file(&spi->dev, &dev_attr_temp1_input); |
178 | hwmon_device_unregister(p_lm70->hwmon_dev); | 178 | hwmon_device_unregister(p_lm70->hwmon_dev); |
179 | out_dev_reg_failed: | 179 | out_dev_reg_failed: |
180 | dev_set_drvdata(&spi->dev, NULL); | 180 | spi_set_drvdata(spi, NULL); |
181 | kfree(p_lm70); | 181 | kfree(p_lm70); |
182 | return status; | 182 | return status; |
183 | } | 183 | } |
184 | 184 | ||
185 | static int __devexit lm70_remove(struct spi_device *spi) | 185 | static int __devexit lm70_remove(struct spi_device *spi) |
186 | { | 186 | { |
187 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 187 | struct lm70 *p_lm70 = spi_get_drvdata(spi); |
188 | 188 | ||
189 | device_remove_file(&spi->dev, &dev_attr_temp1_input); | 189 | device_remove_file(&spi->dev, &dev_attr_temp1_input); |
190 | device_remove_file(&spi->dev, &dev_attr_name); | 190 | device_remove_file(&spi->dev, &dev_attr_name); |
191 | hwmon_device_unregister(p_lm70->hwmon_dev); | 191 | hwmon_device_unregister(p_lm70->hwmon_dev); |
192 | dev_set_drvdata(&spi->dev, NULL); | 192 | spi_set_drvdata(spi, NULL); |
193 | kfree(p_lm70); | 193 | kfree(p_lm70); |
194 | 194 | ||
195 | return 0; | 195 | return 0; |