Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/8] iio: adc: at91_adc: fix NULL trigger dereference and convert to devm
@ 2026-11-23  7:00 Abdelnasser Hussein
  2026-11-23  7:00 ` [PATCH v5 1/8] iio: adc: at91_adc: skip unpopulated triggers on teardown Abdelnasser Hussein
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Abdelnasser Hussein @ 2026-11-23  7:00 UTC (permalink / raw)
  To: jic23, linux-iio
  Cc: dlechner, nuno.sa, andy, nicolas.ferre, alexandre.belloni,
	claudiu.beznea, giorgitchankvetadze1997, amin.gattout,
	antoniu.miclaus, gregkh, mripard, linux-arm-kernel, linux-kernel,
	Abdelnasser Hussein

This series fixes a NULL pointer dereference during trigger teardown in
at91_adc and modernizes the driver to use firmware-agnostic property
APIs and device-managed (devm) resources.

When the "atmel,adc-use-external-triggers" property is omitted from the
Device Tree, at91_adc_trigger_init() leaves external trigger slots in
st->trig as NULL. Patch 1 provides a minimal fix in at91_adc for easy
backporting to stable kernels, while the subsequent patches modernize
the driver and convert it to devm_* APIs (removing the manual teardown
code and the st->trig array altogether).

Changes in v5:
- Patch 1: Keep the minimal NULL check in at91_adc instead of modifying
  iio_trigger_unregister(), and explicitly note in the commit message
  that it is a minimal fix for backporting before devm removal (as
  requested by Jonathan Cameron).
- Patch 2: Drop the redundant dev_err_probe() message after
  devm_request_irq() in a separate patch.
- Patch 3: Switch from of_device_get_match_data() to
  device_get_match_data() and check for NULL in a separate patch.
- Patch 4: Convert of_property_*() calls in at91_adc_probe() and
  at91_adc_probe_dt_ts() (renamed to at91_adc_probe_ts()) to
  device_property_*() APIs, removing the local device_node pointer and
  dropping "in the DT" from missing-property logs.  Since no OF APIs
  remain, replace <linux/of.h> with <linux/mod_devicetable.h>.
- Patch 5: Introduce local struct device *dev in at91_adc_probe() and
  switch devm_iio_device_alloc() to sizeof(*st).
- Patch 6: Pass struct device *dev instead of struct platform_device *pdev
  to at91_ts_register() in a separate patch.
- Patch 7: Replace raw 1000 with HZ_PER_KHZ from <linux/units.h>.
- Patch 8: Convert the remaining buffer, trigger, touchscreen input, and
  IIO device registrations to devm_* APIs, use unsigned int for the
  trigger loop index, drop the now-unused st->trig array, drop the
  redundant input->dev.parent assignment, and remove at91_adc_remove().

Changes in v4:
- Split the series into 3 atomic patches: (1) standalone NULL trigger
  teardown fix for stable backporting, (2) local struct device pointer
  cleanup, and (3) full devm_* conversion.

Changes in v3:
- Address review feedback from Andy Shevchenko on v2 (drop redundant
  -ENOMEM log, use local struct device pointer, scope loop index to the
  for-loop, and convert error paths to dev_err_probe()).

Changes in v2:
- Drop the simple NULL check approach from v1 and refactor the driver to
  use device-managed (devm_*) APIs as suggested by Jonathan Cameron,
  removing manual cleanup functions and at91_adc_remove(), and inlining
  trigger initialization into at91_adc_probe().

Abdelnasser Hussein (8):
  iio: adc: at91_adc: skip unpopulated triggers on teardown
  iio: adc: at91_adc: drop duplicate IRQ allocation error message
  iio: adc: at91_adc: switch to device_get_match_data()
  iio: adc: at91_adc: convert to device_property_*() APIs
  iio: adc: at91_adc: use local struct device pointer in probe
  iio: adc: at91_adc: pass struct device to at91_ts_register()
  iio: adc: at91_adc: use HZ_PER_KHZ instead of raw 1000
  iio: adc: at91_adc: convert to device-managed resources

 drivers/iio/adc/at91_adc.c | 266 +++++++++++--------------------------
 1 file changed, 77 insertions(+), 189 deletions(-)

-- 
2.56.0



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-11-23  8:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  7:00 [PATCH v5 0/8] iio: adc: at91_adc: fix NULL trigger dereference and convert to devm Abdelnasser Hussein
2026-11-23  7:00 ` [PATCH v5 1/8] iio: adc: at91_adc: skip unpopulated triggers on teardown Abdelnasser Hussein
2026-11-23  7:53   ` Joshua Crofts
2026-11-23  7:00 ` [PATCH v5 2/8] iio: adc: at91_adc: drop duplicate IRQ allocation error message Abdelnasser Hussein
2026-11-23  7:55   ` Joshua Crofts
2026-11-23  7:00 ` [PATCH v5 3/8] iio: adc: at91_adc: switch to device_get_match_data() Abdelnasser Hussein
2026-11-23  7:52   ` Joshua Crofts
2026-11-23  7:00 ` [PATCH v5 4/8] iio: adc: at91_adc: convert to device_property_*() APIs Abdelnasser Hussein
2026-11-23  8:02   ` Joshua Crofts
2026-11-23  8:58   ` Uwe Kleine-König
2026-11-23  7:00 ` [PATCH v5 5/8] iio: adc: at91_adc: use local struct device pointer in probe Abdelnasser Hussein
2026-11-23  8:02   ` Joshua Crofts
2026-11-23  7:00 ` [PATCH v5 6/8] iio: adc: at91_adc: pass struct device to at91_ts_register() Abdelnasser Hussein
2026-11-23  8:03   ` Joshua Crofts
2026-11-23  7:01 ` [PATCH v5 7/8] iio: adc: at91_adc: use HZ_PER_KHZ instead of raw 1000 Abdelnasser Hussein
2026-11-23  8:04   ` Joshua Crofts
2026-11-23  7:01 ` [PATCH v5 8/8] iio: adc: at91_adc: convert to device-managed resources Abdelnasser Hussein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox