Re: [PATCH v4 08/11] platform/x86: int3472: Add get_sensor_adev_and_name() helper

From: Andy Shevchenko
Date: Mon Nov 01 2021 - 06:52:47 EST


On Mon, Nov 1, 2021 at 12:49 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
> On 11/1/21 11:46, Andy Shevchenko wrote:
> > On Mon, Nov 1, 2021 at 12:44 PM Andy Shevchenko
> > <andy.shevchenko@xxxxxxxxx> wrote:

...

> > Hmm... But then in the original code and with this proposal the
> > acpi_dev_put() seems a bit strange to me.
> > If we are fine (no error code returned) why would the caller (note
> > _er_) go different paths?
>
> We always need to get the dev to get the name, but some callers are
> only interested in the name, so they pass NULL for sensor_adev_ret,
> this helps to keep the code calling this clean, which is the whole
> idea of having a helper for this.

OK.

(Not that I'm very happy with this, but... the function needs a
comment about this alternative behaviour, I forgot if it already has,
though)

--
With Best Regards,
Andy Shevchenko