hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/iio/light/vcnl4035.c
....@@ -8,6 +8,7 @@
88 * TODO: Proximity
99 */
1010 #include <linux/bitops.h>
11
+#include <linux/bitfield.h>
1112 #include <linux/i2c.h>
1213 #include <linux/module.h>
1314 #include <linux/pm_runtime.h>
....@@ -42,6 +43,7 @@
4243 #define VCNL4035_ALS_PERS_MASK GENMASK(3, 2)
4344 #define VCNL4035_INT_ALS_IF_H_MASK BIT(12)
4445 #define VCNL4035_INT_ALS_IF_L_MASK BIT(13)
46
+#define VCNL4035_DEV_ID_MASK GENMASK(7, 0)
4547
4648 /* Default values */
4749 #define VCNL4035_MODE_ALS_ENABLE BIT(0)
....@@ -415,6 +417,7 @@
415417 return ret;
416418 }
417419
420
+ id = FIELD_GET(VCNL4035_DEV_ID_MASK, id);
418421 if (id != VCNL4035_DEV_ID_VAL) {
419422 dev_err(&data->client->dev, "Wrong id, got %x, expected %x\n",
420423 id, VCNL4035_DEV_ID_VAL);