summaryrefslogtreecommitdiff
path: root/drivers/iio/light/tsl2591.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/light/tsl2591.c')
-rw-r--r--drivers/iio/light/tsl2591.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/iio/light/tsl2591.c b/drivers/iio/light/tsl2591.c
index 39e68d0c9d6a..c5557867ea43 100644
--- a/drivers/iio/light/tsl2591.c
+++ b/drivers/iio/light/tsl2591.c
@@ -21,7 +21,7 @@
#include <linux/pm_runtime.h>
#include <linux/sysfs.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
@@ -772,7 +772,6 @@ static int tsl2591_read_raw(struct iio_dev *indio_dev,
err_unlock:
mutex_unlock(&chip->als_mutex);
- pm_runtime_mark_last_busy(&client->dev);
pm_runtime_put_autosuspend(&client->dev);
return ret;
@@ -985,7 +984,7 @@ static int tsl2591_write_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
- int state)
+ bool state)
{
struct tsl2591_chip *chip = iio_priv(indio_dev);
struct i2c_client *client = chip->client;
@@ -995,7 +994,6 @@ static int tsl2591_write_event_config(struct iio_dev *indio_dev,
pm_runtime_get_sync(&client->dev);
} else if (!state && chip->events_enabled) {
chip->events_enabled = false;
- pm_runtime_mark_last_busy(&client->dev);
pm_runtime_put_autosuspend(&client->dev);
}
@@ -1019,7 +1017,7 @@ static const struct iio_info tsl2591_info_no_irq = {
.read_avail = tsl2591_read_available,
};
-static int __maybe_unused tsl2591_suspend(struct device *dev)
+static int tsl2591_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct tsl2591_chip *chip = iio_priv(indio_dev);
@@ -1032,7 +1030,7 @@ static int __maybe_unused tsl2591_suspend(struct device *dev)
return ret;
}
-static int __maybe_unused tsl2591_resume(struct device *dev)
+static int tsl2591_resume(struct device *dev)
{
int power_state = TSL2591_PWR_ON | TSL2591_ENABLE_ALS;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -1049,10 +1047,8 @@ static int __maybe_unused tsl2591_resume(struct device *dev)
return ret;
}
-static const struct dev_pm_ops tsl2591_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
- SET_RUNTIME_PM_OPS(tsl2591_suspend, tsl2591_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(tsl2591_pm_ops, tsl2591_suspend,
+ tsl2591_resume, NULL);
static irqreturn_t tsl2591_event_handler(int irq, void *private)
{
@@ -1206,17 +1202,17 @@ static int tsl2591_probe(struct i2c_client *client)
static const struct of_device_id tsl2591_of_match[] = {
{ .compatible = "amstaos,tsl2591"},
- {}
+ { }
};
MODULE_DEVICE_TABLE(of, tsl2591_of_match);
static struct i2c_driver tsl2591_driver = {
.driver = {
.name = "tsl2591",
- .pm = &tsl2591_pm_ops,
+ .pm = pm_ptr(&tsl2591_pm_ops),
.of_match_table = tsl2591_of_match,
},
- .probe_new = tsl2591_probe
+ .probe = tsl2591_probe
};
module_i2c_driver(tsl2591_driver);