diff options
Diffstat (limited to 'drivers/misc/apds9802als.c')
| -rw-r--r-- | drivers/misc/apds9802als.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c index 0314773f6db..c6cc3dc8ae1 100644 --- a/drivers/misc/apds9802als.c +++ b/drivers/misc/apds9802als.c @@ -22,7 +22,6 @@ */ #include <linux/module.h> -#include <linux/init.h> #include <linux/slab.h> #include <linux/i2c.h> #include <linux/err.h> @@ -68,7 +67,7 @@ static int als_wait_for_data_ready(struct device *dev) ret = i2c_smbus_read_byte_data(client, 0x86); } while (!(ret & 0x80) && retry--); - if (!retry) { + if (retry < 0) { dev_warn(dev, "timeout waiting for data ready\n"); return -ETIMEDOUT; } @@ -126,8 +125,9 @@ static ssize_t als_sensing_range_store(struct device *dev, int ret_val; unsigned long val; - if (strict_strtoul(buf, 10, &val)) - return -EINVAL; + ret_val = kstrtoul(buf, 10, &val); + if (ret_val) + return ret_val; if (val < 4096) val = 1; @@ -254,7 +254,7 @@ als_error1: return res; } -static int __devexit apds9802als_remove(struct i2c_client *client) +static int apds9802als_remove(struct i2c_client *client) { struct als_data *data = i2c_get_clientdata(client); @@ -272,19 +272,8 @@ static int __devexit apds9802als_remove(struct i2c_client *client) } #ifdef CONFIG_PM -static int apds9802als_suspend(struct i2c_client *client, pm_message_t mesg) -{ - als_set_power_state(client, false); - return 0; -} -static int apds9802als_resume(struct i2c_client *client) -{ - als_set_default_config(client); - return 0; -} - -static int apds9802als_runtime_suspend(struct device *dev) +static int apds9802als_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -292,7 +281,7 @@ static int apds9802als_runtime_suspend(struct device *dev) return 0; } -static int apds9802als_runtime_resume(struct device *dev) +static int apds9802als_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -300,16 +289,12 @@ static int apds9802als_runtime_resume(struct device *dev) return 0; } -static const struct dev_pm_ops apds9802als_pm_ops = { - .runtime_suspend = apds9802als_runtime_suspend, - .runtime_resume = apds9802als_runtime_resume, -}; +static UNIVERSAL_DEV_PM_OPS(apds9802als_pm_ops, apds9802als_suspend, + apds9802als_resume, NULL); #define APDS9802ALS_PM_OPS (&apds9802als_pm_ops) #else /* CONFIG_PM */ -#define apds9802als_suspend NULL -#define apds9802als_resume NULL #define APDS9802ALS_PM_OPS NULL #endif /* CONFIG_PM */ @@ -326,9 +311,7 @@ static struct i2c_driver apds9802als_driver = { .pm = APDS9802ALS_PM_OPS, }, .probe = apds9802als_probe, - .remove = __devexit_p(apds9802als_remove), - .suspend = apds9802als_suspend, - .resume = apds9802als_resume, + .remove = apds9802als_remove, .id_table = apds9802als_id, }; |
