Skip to contentSkip to conversation

iio: interrupt-trigger: Remove no-op trigger ops

PATCH In review Lars-Peter Clausen 3 participants 11 messages Oct 31, 2021 – Nov 9, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/9 iio: interrupt-trigger: Remove no-op trigger ops

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/trigger/iio-trig-interrupt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iio/trigger/iio-trig-interrupt.c +0 -4
index f746c460bf2a..5f49cd105fae 100644
@@ -25,9 +25,6 @@ static irqreturn_t iio_interrupt_trigger_poll(int irq, void *private)
 	return IRQ_HANDLED;
 }
 
-static const struct iio_trigger_ops iio_interrupt_trigger_ops = {
-};
-
 static int iio_interrupt_trigger_probe(struct platform_device *pdev)
 {
 	struct iio_interrupt_trigger_info *trig_info;
@@ -58,7 +55,6 @@ static int iio_interrupt_trigger_probe(struct platform_device *pdev)
 	}
 	iio_trigger_set_drvdata(trig, trig_info);
 	trig_info->irq = irq;
-	trig->ops = &iio_interrupt_trigger_ops;
 	ret = request_irq(irq, iio_interrupt_trigger_poll,
 			  irqflags, trig->name, trig);
 	if (ret) {
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/9 iio: sysfs-trigger: Remove no-op trigger ops

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/trigger/iio-trig-sysfs.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iio/trigger/iio-trig-sysfs.c +0 -4
index e9adfff45b39..2a4b75897910 100644
@@ -124,9 +124,6 @@ static const struct attribute_group *iio_sysfs_trigger_attr_groups[] = {
 	NULL
 };
 
-static const struct iio_trigger_ops iio_sysfs_trigger_ops = {
-};
-
 static int iio_sysfs_trigger_probe(int id)
 {
 	struct iio_sysfs_trig *t;
@@ -156,7 +153,6 @@ static int iio_sysfs_trigger_probe(int id)
 	}
 
 	t->trig->dev.groups = iio_sysfs_trigger_attr_groups;
-	t->trig->ops = &iio_sysfs_trigger_ops;
 	iio_trigger_set_drvdata(t->trig, t);
 
 	t->work = IRQ_WORK_INIT_HARD(iio_sysfs_trigger_work);
Signature · 1 line
2.20.1
#2 lore raw

PATCH 3/9 iio: ad_sigma_delta: Remove no-op trigger ops

In reply to Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/adc/ad_sigma_delta.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iio/adc/ad_sigma_delta.c +0 -4
index 1d652d9b2f5c..cd418bd8bd87 100644
@@ -467,9 +467,6 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig)
 }
 EXPORT_SYMBOL_GPL(ad_sd_validate_trigger);
 
-static const struct iio_trigger_ops ad_sd_trigger_ops = {
-};
-
 static int devm_ad_sd_probe_trigger(struct device *dev, struct iio_dev *indio_dev)
 {
 	struct ad_sigma_delta *sigma_delta = iio_device_get_drvdata(indio_dev);
@@ -486,7 +483,6 @@ static int devm_ad_sd_probe_trigger(struct device *dev, struct iio_dev *indio_de
 	if (sigma_delta->trig == NULL)
 		return -ENOMEM;
 
-	sigma_delta->trig->ops = &ad_sd_trigger_ops;
 	init_completion(&sigma_delta->completion);
 
 	sigma_delta->irq_dis = true;
Signature · 1 line
2.20.1
#3 lore raw

PATCH 4/9 iio: afe4403: Remove no-op trigger ops

In reply to Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/health/afe4403.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/iio/health/afe4403.c +0 -5
index 97b82f9a8e45..273f16dcaff8 100644
@@ -345,9 +345,6 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
 	return IRQ_HANDLED;
 }
 
-static const struct iio_trigger_ops afe4403_trigger_ops = {
-};
-
 #define AFE4403_TIMING_PAIRS			\
 	{ AFE440X_LED2STC,	0x000050 },	\
 	{ AFE440X_LED2ENDC,	0x0003e7 },	\
@@ -530,8 +527,6 @@ static int afe4403_probe(struct spi_device *spi)
 
 		iio_trigger_set_drvdata(afe->trig, indio_dev);
 
-		afe->trig->ops = &afe4403_trigger_ops;
-
 		ret = iio_trigger_register(afe->trig);
 		if (ret) {
 			dev_err(afe->dev, "Unable to register IIO trigger\n");
Signature · 1 line
2.20.1
#4 lore raw

PATCH 5/9 iio: afe4404: Remove no-op trigger ops

In reply to Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/health/afe4404.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/iio/health/afe4404.c +0 -5
index 7ef3f5e34de5..aa9311e1e655 100644
@@ -347,9 +347,6 @@ static irqreturn_t afe4404_trigger_handler(int irq, void *private)
 	return IRQ_HANDLED;
 }
 
-static const struct iio_trigger_ops afe4404_trigger_ops = {
-};
-
 /* Default timings from data-sheet */
 #define AFE4404_TIMING_PAIRS			\
 	{ AFE440X_PRPCOUNT,	39999	},	\
@@ -537,8 +534,6 @@ static int afe4404_probe(struct i2c_client *client,
 
 		iio_trigger_set_drvdata(afe->trig, indio_dev);
 
-		afe->trig->ops = &afe4404_trigger_ops;
-
 		ret = iio_trigger_register(afe->trig);
 		if (ret) {
 			dev_err(afe->dev, "Unable to register IIO trigger\n");
Signature · 1 line
2.20.1
#5 lore raw

PATCH 6/9 iio: as3935: Remove no-op trigger ops

In reply to Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/proximity/as3935.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iio/proximity/as3935.c +0 -4
index 3797a8f54276..d62766b6b39e 100644
@@ -238,9 +238,6 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private)
 	return IRQ_HANDLED;
 }
 
-static const struct iio_trigger_ops iio_interrupt_trigger_ops = {
-};
-
 static void as3935_event_work(struct work_struct *work)
 {
 	struct as3935_state *st;
@@ -417,7 +414,6 @@ static int as3935_probe(struct spi_device *spi)
 	st->trig = trig;
 	st->noise_tripped = jiffies - HZ;
 	iio_trigger_set_drvdata(trig, indio_dev);
-	trig->ops = &iio_interrupt_trigger_ops;
 
 	ret = devm_iio_trigger_register(dev, trig);
 	if (ret) {
Signature · 1 line
2.20.1
#6 lore raw

PATCH 7/9 iio: atlas-sensor: Remove no-op trigger ops

In reply to Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/chemical/atlas-sensor.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iio/chemical/atlas-sensor.c +0 -4
index 9cb99585b6ff..04b44a327614 100644
@@ -434,9 +434,6 @@ static int atlas_buffer_predisable(struct iio_dev *indio_dev)
 	return 0;
 }
 
-static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {
-};
-
 static const struct iio_buffer_setup_ops atlas_buffer_setup_ops = {
 	.postenable = atlas_buffer_postenable,
 	.predisable = atlas_buffer_predisable,
@@ -645,7 +642,6 @@ static int atlas_probe(struct i2c_client *client,
 	data->client = client;
 	data->trig = trig;
 	data->chip = chip;
-	trig->ops = &atlas_interrupt_trigger_ops;
 	iio_trigger_set_drvdata(trig, indio_dev);
 
 	i2c_set_clientdata(client, indio_dev);
Signature · 1 line
2.20.1
#7 lore raw

PATCH 8/9 iio: gp2ap020a00f: Remove no-op trigger ops

In reply to Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/light/gp2ap020a00f.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/iio/light/gp2ap020a00f.c +0 -5
index d1d9f2d319e4..b820041159f7 100644
@@ -1467,9 +1467,6 @@ static const struct iio_buffer_setup_ops gp2ap020a00f_buffer_setup_ops = {
 	.predisable = &gp2ap020a00f_buffer_predisable,
 };
 
-static const struct iio_trigger_ops gp2ap020a00f_trigger_ops = {
-};
-
 static int gp2ap020a00f_probe(struct i2c_client *client,
 				const struct i2c_device_id *id)
 {
@@ -1550,8 +1547,6 @@ static int gp2ap020a00f_probe(struct i2c_client *client,
 		goto error_uninit_buffer;
 	}
 
-	data->trig->ops = &gp2ap020a00f_trigger_ops;
-
 	init_irq_work(&data->work, gp2ap020a00f_iio_trigger_work);
 
 	err = iio_trigger_register(data->trig);
Signature · 1 line
2.20.1
Acked-by on v1 8/9
#8 lore raw

Re: [PATCH 8/9] iio: gp2ap020a00f: Remove no-op trigger ops

Quoted 8 lines · Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

Yours,
Linus Walleij

#9 lore raw

PATCH 9/9 iio: lmp91000: Remove no-op trigger ops

In reply to Lars-Peter Clausen

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

---
 drivers/iio/potentiostat/lmp91000.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iio/potentiostat/lmp91000.c +0 -4
index ed30bdaa10ec..fe514f0b5506 100644
@@ -271,9 +271,6 @@ static int lmp91000_buffer_cb(const void *val, void *private)
 	return 0;
 }
 
-static const struct iio_trigger_ops lmp91000_trigger_ops = {
-};
-
 static int lmp91000_buffer_postenable(struct iio_dev *indio_dev)
 {
 	struct lmp91000_data *data = iio_priv(indio_dev);
@@ -330,7 +327,6 @@ static int lmp91000_probe(struct i2c_client *client,
 		return -ENOMEM;
 	}
 
-	data->trig->ops = &lmp91000_trigger_ops;
 	init_completion(&data->completion);
 
 	ret = lmp91000_read_config(data);
Signature · 1 line
2.20.1
maintainer
#10 lore raw
In reply to Lars-Peter Clausen
Quoted 8 lines · On Sun, 31 Oct 2021 15:21:22 +0100 Lars-Peter Clausen <[email protected]> wrote:

The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL.

Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced.

Good spot - I was kind of assuming we didn't protect all call sites but seems that we do so good to get rid of these

Series applied to the togreg branch of iio.git and pushed out as testing for all the normal reasons.

Thanks,

Jonathan

Quoted 26 lines
---
 drivers/iio/trigger/iio-trig-interrupt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/iio/trigger/iio-trig-interrupt.c +0 -4
index f746c460bf2a..5f49cd105fae 100644
@@ -25,9 +25,6 @@ static irqreturn_t iio_interrupt_trigger_poll(int irq, void *private)
 	return IRQ_HANDLED;
 }
 
-static const struct iio_trigger_ops iio_interrupt_trigger_ops = {
-};
-
 static int iio_interrupt_trigger_probe(struct platform_device *pdev)
 {
 	struct iio_interrupt_trigger_info *trig_info;
@@ -58,7 +55,6 @@ static int iio_interrupt_trigger_probe(struct platform_device *pdev)
 	}
 	iio_trigger_set_drvdata(trig, trig_info);
 	trig_info->irq = irq;
-	trig->ops = &iio_interrupt_trigger_ops;
 	ret = request_irq(irq, iio_interrupt_trigger_poll,
 			  irqflags, trig->name, trig);
 	if (ret) {