hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/staging/iio/addac/adt7316-i2c.c
....@@ -1,10 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * I2C bus driver for ADT7316/7/8 ADT7516/7/9 digital temperature
34 * sensor, ADC and DAC
45 *
56 * Copyright 2010 Analog Devices Inc.
6
- *
7
- * Licensed under the GPL-2 or later.
87 */
98
109 #include <linux/device.h>
....@@ -43,7 +42,7 @@
4342 static int adt7316_i2c_write(void *client, u8 reg, u8 data)
4443 {
4544 struct i2c_client *cl = client;
46
- int ret = 0;
45
+ int ret;
4746
4847 ret = i2c_smbus_write_byte_data(cl, reg, data);
4948 if (ret < 0)
....@@ -55,7 +54,7 @@
5554 static int adt7316_i2c_multi_read(void *client, u8 reg, u8 count, u8 *data)
5655 {
5756 struct i2c_client *cl = client;
58
- int i, ret = 0;
57
+ int i, ret;
5958
6059 if (count > ADT7316_REG_MAX_ADDR)
6160 count = ADT7316_REG_MAX_ADDR;
....@@ -74,7 +73,7 @@
7473 static int adt7316_i2c_multi_write(void *client, u8 reg, u8 count, u8 *data)
7574 {
7675 struct i2c_client *cl = client;
77
- int i, ret = 0;
76
+ int i, ret;
7877
7978 if (count > ADT7316_REG_MAX_ADDR)
8079 count = ADT7316_REG_MAX_ADDR;
....@@ -100,7 +99,6 @@
10099 struct adt7316_bus bus = {
101100 .client = client,
102101 .irq = client->irq,
103
- .irq_flags = IRQF_TRIGGER_LOW,
104102 .read = adt7316_i2c_read,
105103 .write = adt7316_i2c_write,
106104 .multi_read = adt7316_i2c_multi_read,
....@@ -122,9 +120,22 @@
122120
123121 MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id);
124122
123
+static const struct of_device_id adt7316_of_match[] = {
124
+ { .compatible = "adi,adt7316" },
125
+ { .compatible = "adi,adt7317" },
126
+ { .compatible = "adi,adt7318" },
127
+ { .compatible = "adi,adt7516" },
128
+ { .compatible = "adi,adt7517" },
129
+ { .compatible = "adi,adt7519" },
130
+ { },
131
+};
132
+
133
+MODULE_DEVICE_TABLE(of, adt7316_of_match);
134
+
125135 static struct i2c_driver adt7316_driver = {
126136 .driver = {
127137 .name = "adt7316",
138
+ .of_match_table = adt7316_of_match,
128139 .pm = ADT7316_PM_OPS,
129140 },
130141 .probe = adt7316_i2c_probe,