aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/max1111.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/max1111.c')
-rw-r--r--drivers/hwmon/max1111.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 36544c4f653c..303d0c9df907 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -85,6 +85,9 @@ static struct max1111_data *the_max1111;
85 85
86int max1111_read_channel(int channel) 86int max1111_read_channel(int channel)
87{ 87{
88 if (!the_max1111 || !the_max1111->spi)
89 return -ENODEV;
90
88 return max1111_read(&the_max1111->spi->dev, channel); 91 return max1111_read(&the_max1111->spi->dev, channel);
89} 92}
90EXPORT_SYMBOL(max1111_read_channel); 93EXPORT_SYMBOL(max1111_read_channel);
@@ -258,6 +261,9 @@ static int max1111_remove(struct spi_device *spi)
258{ 261{
259 struct max1111_data *data = spi_get_drvdata(spi); 262 struct max1111_data *data = spi_get_drvdata(spi);
260 263
264#ifdef CONFIG_SHARPSL_PM
265 the_max1111 = NULL;
266#endif
261 hwmon_device_unregister(data->hwmon_dev); 267 hwmon_device_unregister(data->hwmon_dev);
262 sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group); 268 sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group);
263 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); 269 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);