diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 13:37:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 13:37:25 -0400 |
commit | 31f6765266417c0d99f0e922fe82848a7c9c2ae9 (patch) | |
tree | 2d5914dac0a918baad37decd3845b8c206051420 /drivers/hwmon/lm70.c | |
parent | d15d76448bb58c7832e954b6a8f1e301720b7866 (diff) | |
parent | 312869ec935ab3bb67b7ba641a7d11230555aff5 (diff) |
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon changes for v3.4 from Guenter Roeck:
"Mostly cleanup. No new drivers this time around, but support for
several chips added to existing drivers: TPS40400, TPS40422, MTD040,
MAX34446, ZL9101M, ZL9117M, and LM96080. Also, added watchdog support
for SCH56xx, and additional attributes for a couple of drivers."
* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (137 commits)
hwmon: (sch56xx) Add support for the integrated watchdog (v2)
hwmon: (w83627ehf) Add support for temperature offset registers
hwmon: (jc42) Remove unnecessary device IDs
hwmon: (zl6100) Add support for ZL9101M and ZL9117M
hwmon: (adm1275) Add support for ADM1075
hwmon: (max34440) Add support for MAX34446
hwmon: (pmbus) Add more virtual registers
hwmon: (pmbus) Add support for Lineage Power MDT040
hwmon: (pmbus) Add support for TI TPS40400 and TPS40422
hwmon: (max34440) Add support for 'lowest' output voltage attribute
hwmon: (jc42) Convert to use devm_kzalloc
hwmon: (max16065) Convert to use devm_kzalloc
hwmon: (smm665) Convert to use devm_kzalloc
hwmon: (ltc4261) Convert to use devm_kzalloc
hwmon: (pmbus) Simplify remove functions
hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc
hwmon: (lineage-pem) Convert to use devm_kzalloc
hwmon: (hwmon-vid) Fix checkpatch issues
hwmon: (hwmon-vid) Add new entries to VRM model table
hwmon: (lm80) Add detection of NatSemi/TI LM96080
...
Diffstat (limited to 'drivers/hwmon/lm70.c')
-rw-r--r-- | drivers/hwmon/lm70.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index c274ea25d899..472f79521a96 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -57,7 +57,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
57 | struct spi_device *spi = to_spi_device(dev); | 57 | struct spi_device *spi = to_spi_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 = spi_get_drvdata(spi); | 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)) |
@@ -156,6 +156,15 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
156 | mutex_init(&p_lm70->lock); | 156 | mutex_init(&p_lm70->lock); |
157 | p_lm70->chip = chip; | 157 | p_lm70->chip = chip; |
158 | 158 | ||
159 | spi_set_drvdata(spi, p_lm70); | ||
160 | |||
161 | status = device_create_file(&spi->dev, &dev_attr_temp1_input); | ||
162 | if (status) | ||
163 | goto out_dev_create_temp_file_failed; | ||
164 | status = device_create_file(&spi->dev, &dev_attr_name); | ||
165 | if (status) | ||
166 | goto out_dev_create_file_failed; | ||
167 | |||
159 | /* sysfs hook */ | 168 | /* sysfs hook */ |
160 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); | 169 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); |
161 | if (IS_ERR(p_lm70->hwmon_dev)) { | 170 | if (IS_ERR(p_lm70->hwmon_dev)) { |
@@ -163,20 +172,14 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
163 | status = PTR_ERR(p_lm70->hwmon_dev); | 172 | status = PTR_ERR(p_lm70->hwmon_dev); |
164 | goto out_dev_reg_failed; | 173 | goto out_dev_reg_failed; |
165 | } | 174 | } |
166 | spi_set_drvdata(spi, p_lm70); | ||
167 | |||
168 | if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input)) | ||
169 | || (status = device_create_file(&spi->dev, &dev_attr_name))) { | ||
170 | dev_dbg(&spi->dev, "device_create_file failure.\n"); | ||
171 | goto out_dev_create_file_failed; | ||
172 | } | ||
173 | 175 | ||
174 | return 0; | 176 | return 0; |
175 | 177 | ||
178 | out_dev_reg_failed: | ||
179 | device_remove_file(&spi->dev, &dev_attr_name); | ||
176 | out_dev_create_file_failed: | 180 | out_dev_create_file_failed: |
177 | device_remove_file(&spi->dev, &dev_attr_temp1_input); | 181 | device_remove_file(&spi->dev, &dev_attr_temp1_input); |
178 | hwmon_device_unregister(p_lm70->hwmon_dev); | 182 | out_dev_create_temp_file_failed: |
179 | out_dev_reg_failed: | ||
180 | spi_set_drvdata(spi, NULL); | 183 | spi_set_drvdata(spi, NULL); |
181 | kfree(p_lm70); | 184 | kfree(p_lm70); |
182 | return status; | 185 | return status; |
@@ -186,9 +189,9 @@ static int __devexit lm70_remove(struct spi_device *spi) | |||
186 | { | 189 | { |
187 | struct lm70 *p_lm70 = spi_get_drvdata(spi); | 190 | struct lm70 *p_lm70 = spi_get_drvdata(spi); |
188 | 191 | ||
192 | hwmon_device_unregister(p_lm70->hwmon_dev); | ||
189 | device_remove_file(&spi->dev, &dev_attr_temp1_input); | 193 | device_remove_file(&spi->dev, &dev_attr_temp1_input); |
190 | device_remove_file(&spi->dev, &dev_attr_name); | 194 | device_remove_file(&spi->dev, &dev_attr_name); |
191 | hwmon_device_unregister(p_lm70->hwmon_dev); | ||
192 | spi_set_drvdata(spi, NULL); | 195 | spi_set_drvdata(spi, NULL); |
193 | kfree(p_lm70); | 196 | kfree(p_lm70); |
194 | 197 | ||
@@ -213,18 +216,7 @@ static struct spi_driver lm70_driver = { | |||
213 | .remove = __devexit_p(lm70_remove), | 216 | .remove = __devexit_p(lm70_remove), |
214 | }; | 217 | }; |
215 | 218 | ||
216 | static int __init init_lm70(void) | 219 | module_spi_driver(lm70_driver); |
217 | { | ||
218 | return spi_register_driver(&lm70_driver); | ||
219 | } | ||
220 | |||
221 | static void __exit cleanup_lm70(void) | ||
222 | { | ||
223 | spi_unregister_driver(&lm70_driver); | ||
224 | } | ||
225 | |||
226 | module_init(init_lm70); | ||
227 | module_exit(cleanup_lm70); | ||
228 | 220 | ||
229 | MODULE_AUTHOR("Kaiwan N Billimoria"); | 221 | MODULE_AUTHOR("Kaiwan N Billimoria"); |
230 | MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver"); | 222 | MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver"); |