| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * I2C bus driver for ADT7316/7/8 ADT7516/7/9 digital temperature |
|---|
| 3 | 4 | * sensor, ADC and DAC |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright 2010 Analog Devices Inc. |
|---|
| 6 | | - * |
|---|
| 7 | | - * Licensed under the GPL-2 or later. |
|---|
| 8 | 7 | */ |
|---|
| 9 | 8 | |
|---|
| 10 | 9 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 43 | 42 | static int adt7316_i2c_write(void *client, u8 reg, u8 data) |
|---|
| 44 | 43 | { |
|---|
| 45 | 44 | struct i2c_client *cl = client; |
|---|
| 46 | | - int ret = 0; |
|---|
| 45 | + int ret; |
|---|
| 47 | 46 | |
|---|
| 48 | 47 | ret = i2c_smbus_write_byte_data(cl, reg, data); |
|---|
| 49 | 48 | if (ret < 0) |
|---|
| .. | .. |
|---|
| 55 | 54 | static int adt7316_i2c_multi_read(void *client, u8 reg, u8 count, u8 *data) |
|---|
| 56 | 55 | { |
|---|
| 57 | 56 | struct i2c_client *cl = client; |
|---|
| 58 | | - int i, ret = 0; |
|---|
| 57 | + int i, ret; |
|---|
| 59 | 58 | |
|---|
| 60 | 59 | if (count > ADT7316_REG_MAX_ADDR) |
|---|
| 61 | 60 | count = ADT7316_REG_MAX_ADDR; |
|---|
| .. | .. |
|---|
| 74 | 73 | static int adt7316_i2c_multi_write(void *client, u8 reg, u8 count, u8 *data) |
|---|
| 75 | 74 | { |
|---|
| 76 | 75 | struct i2c_client *cl = client; |
|---|
| 77 | | - int i, ret = 0; |
|---|
| 76 | + int i, ret; |
|---|
| 78 | 77 | |
|---|
| 79 | 78 | if (count > ADT7316_REG_MAX_ADDR) |
|---|
| 80 | 79 | count = ADT7316_REG_MAX_ADDR; |
|---|
| .. | .. |
|---|
| 100 | 99 | struct adt7316_bus bus = { |
|---|
| 101 | 100 | .client = client, |
|---|
| 102 | 101 | .irq = client->irq, |
|---|
| 103 | | - .irq_flags = IRQF_TRIGGER_LOW, |
|---|
| 104 | 102 | .read = adt7316_i2c_read, |
|---|
| 105 | 103 | .write = adt7316_i2c_write, |
|---|
| 106 | 104 | .multi_read = adt7316_i2c_multi_read, |
|---|
| .. | .. |
|---|
| 122 | 120 | |
|---|
| 123 | 121 | MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id); |
|---|
| 124 | 122 | |
|---|
| 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 | + |
|---|
| 125 | 135 | static struct i2c_driver adt7316_driver = { |
|---|
| 126 | 136 | .driver = { |
|---|
| 127 | 137 | .name = "adt7316", |
|---|
| 138 | + .of_match_table = adt7316_of_match, |
|---|
| 128 | 139 | .pm = ADT7316_PM_OPS, |
|---|
| 129 | 140 | }, |
|---|
| 130 | 141 | .probe = adt7316_i2c_probe, |
|---|