Staging: iio: adt7316: Switch irq_flags to a local variable

There is no need to store irq_flags into the structure as it
is always set to the same thing. Hence switch irq_flags to a
local variable.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Shreeya Patel 2018-11-20 22:26:58 +05:30 коммит произвёл Jonathan Cameron
Родитель c63460c429
Коммит 3310280830
4 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -104,7 +104,6 @@ static int adt7316_i2c_probe(struct i2c_client *client,
struct adt7316_bus bus = { struct adt7316_bus bus = {
.client = client, .client = client,
.irq = client->irq, .irq = client->irq,
.irq_flags = IRQF_TRIGGER_LOW,
.read = adt7316_i2c_read, .read = adt7316_i2c_read,
.write = adt7316_i2c_write, .write = adt7316_i2c_write,
.multi_read = adt7316_i2c_multi_read, .multi_read = adt7316_i2c_multi_read,

Просмотреть файл

@ -94,7 +94,6 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
struct adt7316_bus bus = { struct adt7316_bus bus = {
.client = spi_dev, .client = spi_dev,
.irq = spi_dev->irq, .irq = spi_dev->irq,
.irq_flags = IRQF_TRIGGER_LOW,
.read = adt7316_spi_read, .read = adt7316_spi_read,
.write = adt7316_spi_write, .write = adt7316_spi_write,
.multi_read = adt7316_spi_multi_read, .multi_read = adt7316_spi_multi_read,

Просмотреть файл

@ -2104,6 +2104,7 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
struct adt7316_chip_info *chip; struct adt7316_chip_info *chip;
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
unsigned short *adt7316_platform_data = dev->platform_data; unsigned short *adt7316_platform_data = dev->platform_data;
int irq_flags = IRQF_TRIGGER_LOW;
int ret = 0; int ret = 0;
indio_dev = devm_iio_device_alloc(dev, sizeof(*chip)); indio_dev = devm_iio_device_alloc(dev, sizeof(*chip));
@ -2148,19 +2149,18 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
if (chip->bus.irq > 0) { if (chip->bus.irq > 0) {
if (adt7316_platform_data[0]) if (adt7316_platform_data[0])
chip->bus.irq_flags = adt7316_platform_data[0]; irq_flags = adt7316_platform_data[0];
ret = devm_request_threaded_irq(dev, chip->bus.irq, ret = devm_request_threaded_irq(dev, chip->bus.irq,
NULL, NULL,
adt7316_event_handler, adt7316_event_handler,
chip->bus.irq_flags | irq_flags | IRQF_ONESHOT,
IRQF_ONESHOT,
indio_dev->name, indio_dev->name,
indio_dev); indio_dev);
if (ret) if (ret)
return ret; return ret;
if (chip->bus.irq_flags & IRQF_TRIGGER_HIGH) if (irq_flags & IRQF_TRIGGER_HIGH)
chip->config1 |= ADT7316_INT_POLARITY; chip->config1 |= ADT7316_INT_POLARITY;
} }

Просмотреть файл

@ -17,7 +17,6 @@
struct adt7316_bus { struct adt7316_bus {
void *client; void *client;
int irq; int irq;
int irq_flags;
int (*read)(void *client, u8 reg, u8 *data); int (*read)(void *client, u8 reg, u8 *data);
int (*write)(void *client, u8 reg, u8 val); int (*write)(void *client, u8 reg, u8 val);
int (*multi_read)(void *client, u8 first_reg, u8 count, u8 *data); int (*multi_read)(void *client, u8 first_reg, u8 count, u8 *data);