diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-04-14 13:18:27 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-04-14 13:19:04 +0200 |
commit | 6ac1ef482d7ae0c690f1640bf6eb818ff9a2d91e (patch) | |
tree | 021cc9f6b477146fcebe6f3be4752abfa2ba18a9 /drivers/hwmon/lm70.c | |
parent | 682968e0c425c60f0dde37977e5beb2b12ddc4cc (diff) | |
parent | a385ec4f11bdcf81af094c03e2444ee9b7fad2e5 (diff) |
Merge branch 'perf/core' into perf/uprobes
Merge in latest upstream (and the latest perf development tree),
to prepare for tooling changes, and also to pick up v3.4 MM
changes that the uprobes code needs to take care of.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
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 c274ea25d89..472f79521a9 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c @@ -57,7 +57,7 @@ static ssize_t lm70_sense_temp(struct device *dev, struct spi_device *spi = to_spi_device(dev); int status, val = 0; u8 rxbuf[2]; - s16 raw=0; + s16 raw = 0; struct lm70 *p_lm70 = spi_get_drvdata(spi); if (mutex_lock_interruptible(&p_lm70->lock)) @@ -156,6 +156,15 @@ static int __devinit lm70_probe(struct spi_device *spi) mutex_init(&p_lm70->lock); p_lm70->chip = chip; + spi_set_drvdata(spi, p_lm70); + + status = device_create_file(&spi->dev, &dev_attr_temp1_input); + if (status) + goto out_dev_create_temp_file_failed; + status = device_create_file(&spi->dev, &dev_attr_name); + if (status) + goto out_dev_create_file_failed; + /* sysfs hook */ p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); if (IS_ERR(p_lm70->hwmon_dev)) { @@ -163,20 +172,14 @@ static int __devinit lm70_probe(struct spi_device *spi) status = PTR_ERR(p_lm70->hwmon_dev); goto out_dev_reg_failed; } - spi_set_drvdata(spi, p_lm70); - - if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input)) - || (status = device_create_file(&spi->dev, &dev_attr_name))) { - dev_dbg(&spi->dev, "device_create_file failure.\n"); - goto out_dev_create_file_failed; - } return 0; +out_dev_reg_failed: + device_remove_file(&spi->dev, &dev_attr_name); out_dev_create_file_failed: device_remove_file(&spi->dev, &dev_attr_temp1_input); - hwmon_device_unregister(p_lm70->hwmon_dev); -out_dev_reg_failed: +out_dev_create_temp_file_failed: spi_set_drvdata(spi, NULL); kfree(p_lm70); return status; @@ -186,9 +189,9 @@ static int __devexit lm70_remove(struct spi_device *spi) { struct lm70 *p_lm70 = spi_get_drvdata(spi); + hwmon_device_unregister(p_lm70->hwmon_dev); device_remove_file(&spi->dev, &dev_attr_temp1_input); device_remove_file(&spi->dev, &dev_attr_name); - hwmon_device_unregister(p_lm70->hwmon_dev); spi_set_drvdata(spi, NULL); kfree(p_lm70); @@ -213,18 +216,7 @@ static struct spi_driver lm70_driver = { .remove = __devexit_p(lm70_remove), }; -static int __init init_lm70(void) -{ - return spi_register_driver(&lm70_driver); -} - -static void __exit cleanup_lm70(void) -{ - spi_unregister_driver(&lm70_driver); -} - -module_init(init_lm70); -module_exit(cleanup_lm70); +module_spi_driver(lm70_driver); MODULE_AUTHOR("Kaiwan N Billimoria"); MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver"); |