hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/iio/light/bh1750.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensor driver
34 *
45 * Copyright (c) Tomasz Duszynski <tduszyns@gmail.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 *
107 * Data sheets:
118 * http://rohmfs.rohm.com/en/products/databook/datasheet/ic/sensor/light/bh1710fvc-e.pdf
....@@ -257,7 +254,6 @@
257254 return ret;
258255
259256 mutex_init(&data->lock);
260
- indio_dev->dev.parent = &client->dev;
261257 indio_dev->info = &bh1750_info;
262258 indio_dev->name = id->name;
263259 indio_dev->channels = bh1750_channels;
....@@ -281,8 +277,7 @@
281277 return 0;
282278 }
283279
284
-#ifdef CONFIG_PM_SLEEP
285
-static int bh1750_suspend(struct device *dev)
280
+static int __maybe_unused bh1750_suspend(struct device *dev)
286281 {
287282 int ret;
288283 struct bh1750_data *data =
....@@ -300,10 +295,6 @@
300295 }
301296
302297 static SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL);
303
-#define BH1750_PM_OPS (&bh1750_pm_ops)
304
-#else
305
-#define BH1750_PM_OPS NULL
306
-#endif
307298
308299 static const struct i2c_device_id bh1750_id[] = {
309300 { "bh1710", BH1710 },
....@@ -315,10 +306,21 @@
315306 };
316307 MODULE_DEVICE_TABLE(i2c, bh1750_id);
317308
309
+static const struct of_device_id bh1750_of_match[] = {
310
+ { .compatible = "rohm,bh1710", },
311
+ { .compatible = "rohm,bh1715", },
312
+ { .compatible = "rohm,bh1721", },
313
+ { .compatible = "rohm,bh1750", },
314
+ { .compatible = "rohm,bh1751", },
315
+ { }
316
+};
317
+MODULE_DEVICE_TABLE(of, bh1750_of_match);
318
+
318319 static struct i2c_driver bh1750_driver = {
319320 .driver = {
320321 .name = "bh1750",
321
- .pm = BH1750_PM_OPS,
322
+ .of_match_table = bh1750_of_match,
323
+ .pm = &bh1750_pm_ops,
322324 },
323325 .probe = bh1750_probe,
324326 .remove = bh1750_remove,