diff options
Diffstat (limited to 'drivers/hwmon/ad7314.c')
| -rw-r--r-- | drivers/hwmon/ad7314.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index f915eb1c29f..f4f9b219bf1 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c @@ -107,21 +107,21 @@ static const struct attribute_group ad7314_group = { .attrs = ad7314_attributes, }; -static int __devinit ad7314_probe(struct spi_device *spi_dev) +static int ad7314_probe(struct spi_device *spi_dev) { int ret; struct ad7314_data *chip; - chip = kzalloc(sizeof(*chip), GFP_KERNEL); - if (chip == NULL) { - ret = -ENOMEM; - goto error_ret; - } - dev_set_drvdata(&spi_dev->dev, chip); + chip = devm_kzalloc(&spi_dev->dev, sizeof(*chip), GFP_KERNEL); + if (chip == NULL) + return -ENOMEM; + + spi_set_drvdata(spi_dev, chip); ret = sysfs_create_group(&spi_dev->dev.kobj, &ad7314_group); if (ret < 0) - goto error_free_chip; + return ret; + chip->hwmon_dev = hwmon_device_register(&spi_dev->dev); if (IS_ERR(chip->hwmon_dev)) { ret = PTR_ERR(chip->hwmon_dev); @@ -132,19 +132,15 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev) return 0; error_remove_group: sysfs_remove_group(&spi_dev->dev.kobj, &ad7314_group); -error_free_chip: - kfree(chip); -error_ret: return ret; } -static int __devexit ad7314_remove(struct spi_device *spi_dev) +static int ad7314_remove(struct spi_device *spi_dev) { - struct ad7314_data *chip = dev_get_drvdata(&spi_dev->dev); + struct ad7314_data *chip = spi_get_drvdata(spi_dev); hwmon_device_unregister(chip->hwmon_dev); sysfs_remove_group(&spi_dev->dev.kobj, &ad7314_group); - kfree(chip); return 0; } @@ -163,13 +159,12 @@ static struct spi_driver ad7314_driver = { .owner = THIS_MODULE, }, .probe = ad7314_probe, - .remove = __devexit_p(ad7314_remove), + .remove = ad7314_remove, .id_table = ad7314_id, }; module_spi_driver(ad7314_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); -MODULE_DESCRIPTION("Analog Devices AD7314, ADT7301 and ADT7302 digital" - " temperature sensor driver"); +MODULE_DESCRIPTION("Analog Devices AD7314, ADT7301 and ADT7302 digital temperature sensor driver"); MODULE_LICENSE("GPL v2"); |
