Re: [PATCH] HID: cp2112: Remove some dead code

From: Benjamin Tissoires
Date: Tue Aug 30 2022 - 07:56:40 EST


On Thu, Aug 25, 2022 at 11:26 AM Jiri Kosina <jikos@xxxxxxxxxx> wrote:
>
> On Sat, 18 Jun 2022, Christophe JAILLET wrote:
>
> > Commit 13de9cca514e ("HID: cp2112: add IRQ chip handling") has introduced
> > cp2112_allocate_irq() that seems to be unused since 2016.
> >
> > Remove it, remove the associated resources and part of the remove()
> > function that frees the resources allocated in cp2112_allocate_irq().
> >
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> > ---
> > Compile tested only.
> >
> > Maybe the issue is completely elsewhere and the probe() should call
> > cp2112_allocate_irq() in some cases.
>
> Benjamin, could you please take a look? Apparently you were aware of the
> code being dead due to the __maybe_unused annotation ... :) What was the
> point?
>

Looks like I kept that code around for the CI I am running on HID patches.

IIRC, I left the code in the tree because it might have been useful to
others when they need to declare IRQs on the board. So yes, it is
entirely dead code upstream :/

I am applying the following 3 patches on the current master tree to be
able to declare hid-cp2112 as an i2c-hid transport:
https://gitlab.freedesktop.org/bentiss/gitlab-kernel-ci/-/tree/master/VM

Those 3 patches can not be upstreamed because platform drivers are a
dead thing, but I have no other ideas on how I can declare an i2c-hid
device on top of hid-cp2112. Given that we don't have DT on x86_64
vm, I can not rely on that to have my custom sensor (or maybe I can
but I am not aware of it).

So unless anybody has a better idea, I won't fight against removing
that code, but it's more convenient for me to have it.

Cheers,
Benjamin