forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/iio/light/bh1780.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ROHM 1780GLI Ambient Light Sensor Driver
34 *
....@@ -12,7 +13,7 @@
1213 #include <linux/platform_device.h>
1314 #include <linux/delay.h>
1415 #include <linux/module.h>
15
-#include <linux/of.h>
16
+#include <linux/mod_devicetable.h>
1617 #include <linux/pm_runtime.h>
1718 #include <linux/iio/iio.h>
1819 #include <linux/iio/sysfs.h>
....@@ -145,7 +146,7 @@
145146 {
146147 int ret;
147148 struct bh1780_data *bh1780;
148
- struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
149
+ struct i2c_adapter *adapter = client->adapter;
149150 struct iio_dev *indio_dev;
150151
151152 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
....@@ -184,7 +185,6 @@
184185 pm_runtime_use_autosuspend(&client->dev);
185186 pm_runtime_put(&client->dev);
186187
187
- indio_dev->dev.parent = &client->dev;
188188 indio_dev->info = &bh1780_info;
189189 indio_dev->name = "bh1780";
190190 indio_dev->channels = bh1780_channels;
....@@ -272,13 +272,11 @@
272272
273273 MODULE_DEVICE_TABLE(i2c, bh1780_id);
274274
275
-#ifdef CONFIG_OF
276275 static const struct of_device_id of_bh1780_match[] = {
277276 { .compatible = "rohm,bh1780gli", },
278277 {},
279278 };
280279 MODULE_DEVICE_TABLE(of, of_bh1780_match);
281
-#endif
282280
283281 static struct i2c_driver bh1780_driver = {
284282 .probe = bh1780_probe,
....@@ -287,7 +285,7 @@
287285 .driver = {
288286 .name = "bh1780",
289287 .pm = &bh1780_dev_pm_ops,
290
- .of_match_table = of_match_ptr(of_bh1780_match),
288
+ .of_match_table = of_bh1780_match,
291289 },
292290 };
293291