Re: [PATCH] gpio Add my driver new id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 03, 2021 at 11:15:46AM +0100, Bartosz Golaszewski wrote:
> On Fri, Dec 3, 2021 at 10:26 AM Richard Hsu <saraon640529@xxxxxxxxx> wrote:

Thanks, Bart, for pointing out to this.

> >  #define PT_TOTAL_GPIO 8
> > +#define PT_TOTAL_GPIO_EX 24

...

> > +       struct acpi_device *acpi_dev;
> > +       acpi_handle handle = ACPI_HANDLE(dev);

> > -       if (!ACPI_COMPANION(dev)) {
> > +       if (acpi_bus_get_device(handle, &acpi_dev)) {

What you are doing here is open coding the ACPI_COMPANION().
But see below.

...

> > +       if (!strncmp(acpi_dev_name(acpi_dev), "AMDIF031", 8))
> > +               pt_gpio->gc.ngpio = PT_TOTAL_GPIO_EX;
> > +       else
> > +               pt_gpio->gc.ngpio = PT_TOTAL_GPIO;

Instead of doing this...

> >  static const struct acpi_device_id pt_gpio_acpi_match[] = {
> >         { "AMDF030", 0 },
> >         { "AMDIF030", 0 },
> > +       { "AMDIF031", 0 },

Just use .driver_data here and if needed in the other ID tables and then simply
retrieve it (w/o any conditions) in the code above:

	pt_gpio->gc.ngpio = (uintptr_t)device_get_match_data(dev);

> >         { },
> >  };

> Please Cc Andy next time on any GPIO stuff related to ACPI. I'll let
> him comment on the code. Your commit message must be more descriptive
> - the title should say "gpio: <driver name>: <do this and that>".
> Please also add a commit message explaining what the code does in
> detail.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux