Re: [PATCH 2/3] iio: proximity: add driver for Sharp GP2AP070S proximity sensor
From: Joshua Crofts
Date: Thu Jul 30 2026 - 03:32:11 EST
On Wed, 29 Jul 2026 23:23:45 +0530
"Kaustabh Chakraborty" <kauschluss@xxxxxxxxxxx> wrote:
...
> > Please add iio/* includes after the generic linux/* headers. Ensure
> > that there is a blank line between the two groups.
> >
> > Additionally, you're also missing <asm/byteorder.h>, array_size.h, err.h,
> > types.h and delay.h.
>
> By the way, is there any tooling to satisfactorily point out the
> shortfalls with includes? Or is it just intuition and experience?
"Fully satisfactorily" no, but there is a tool called iwyu_tool (IWYU
meaning include-what-you-use). It requires Clang/LLVM on your machine
but it can serve as a pretty good starting point when cleaning up
includes. There is an unofficial mapping file for IIO that makes the
output of the tool less noisy, however it will probably still need
tweaking. Here's the link to that thread:
https://lore.kernel.org/linux-iio/20260512073505.1310-1-joshua.crofts1@xxxxxxxxx/
Setting it up may be a bit tedious, but I found Gemini to be pretty
good at this.
>
> >> + ret = devm_request_threaded_irq(dev, client->irq, NULL,
> >> + gp2ap070s_irq_handler, IRQF_ONESHOT,
> >> + "gp2ap070s-irq", indio_dev);
> >> + if (ret)
> >> + return dev_err_probe(dev, ret, "Failed to request IRQ");
> >
> > Just return ret instead, dev_err_probe() is called automatically on failure.
>
> Are you sure about that? I happen to call dev_err_probe() on all other
> places and other drivers (as of late) as well (other than -ENOMEM).
See the comment at the devm_request_threaded_irq definition here:
https://elixir.bootlin.com/linux/v7.2-rc4/source/kernel/irq/devres.c#L94
--
Kind regards,
Joshua Crofts