X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fhwmon%2Fmax1111.c;fp=kernel%2Fdrivers%2Fhwmon%2Fmax1111.c;h=303d0c9df907a722e6d366b07a7f4c8d8a7c728b;hb=52f993b8e89487ec9ee15a7fb4979e0f09a45b27;hp=36544c4f653c6d2f1c7c3ca1333186d68f2f6269;hpb=c189ccac5702322ed843fe17057035b7222a59b6;p=kvmfornfv.git diff --git a/kernel/drivers/hwmon/max1111.c b/kernel/drivers/hwmon/max1111.c index 36544c4f6..303d0c9df 100644 --- a/kernel/drivers/hwmon/max1111.c +++ b/kernel/drivers/hwmon/max1111.c @@ -85,6 +85,9 @@ static struct max1111_data *the_max1111; int max1111_read_channel(int channel) { + if (!the_max1111 || !the_max1111->spi) + return -ENODEV; + return max1111_read(&the_max1111->spi->dev, channel); } EXPORT_SYMBOL(max1111_read_channel); @@ -258,6 +261,9 @@ static int max1111_remove(struct spi_device *spi) { struct max1111_data *data = spi_get_drvdata(spi); +#ifdef CONFIG_SHARPSL_PM + the_max1111 = NULL; +#endif hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group); sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);