lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM6PR04MB5413E348ECB06BFEF4F4772BF16C9@AM6PR04MB5413.eurprd04.prod.outlook.com>
Date:   Mon, 15 Mar 2021 06:02:04 +0000
From:   Ran Wang <ran.wang_1@....com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
CC:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] gpio: mpc8xxx: Add ACPI support

Hi Andy,

On Sunday, March 14, 2021 9:52 PM, Andy Shevchenko wrote:
> 
> On Fri, Mar 12, 2021 at 8:53 AM Ran Wang <ran.wang_1@....com> wrote:
> 
> First of all, please add me to the Cc list for the next version of the patch.
> 
> > Current implementation only supports DT, now add ACPI support.
> >
> > Note that compared to device of 'fsl,qoriq-gpio', LS1028A and
> 
> to devices
> 
> > LS1088A's GPIO have no extra programming, so simplify related checking.
> 
> ...
> 
> > +#include <linux/acpi.h>
> 
> Nope, you rather need property.h and mod_devicetable.h.

If I replace acpi.h, will encounter below error (even have added property.h mod_devicetable.h):

CC      drivers/gpio/gpio-mpc8xxx.o
drivers/gpio/gpio-mpc8xxx.c:439:1: warning: data definition has no type or storage class
  439 | MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids);
      | ^~~~~~~~~~~~~~~~~~~
drivers/gpio/gpio-mpc8xxx.c:439:1: error: type defaults to ‘int’ in declaration of ‘MODULE_DEVICE_TABLE’ [-Werror=implicit-int]
drivers/gpio/gpio-mpc8xxx.c:439:1: warning: parameter names (without types) in function declaration
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:271: drivers/gpio/gpio-mpc8xxx.o] Error 1
make[1]: *** [scripts/Makefile.build:514: drivers/gpio] Error 2
make: *** [Makefile:1849: drivers] Error 2
make: *** Waiting for unfinished jobs....

> ...
> 
> > +       if (pdev->dev.of_node) {
> > +               devtype = of_device_get_match_data(&pdev->dev);
> > +       } else {
> > +               acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
> > +                                               &pdev->dev);
> > +               if (acpi_id)
> > +                       devtype = (struct mpc8xxx_gpio_devtype *) acpi_id->driver_data;
> > +       }
> 
> No, please use device_get_match_data() instead of the entire conditional block.

OK

> 
> > +       if (pdev->dev.of_node) {
> > +               if (of_device_is_compatible(np, "fsl,qoriq-gpio"))
> > +                       gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff);
> > +       } else {
> > +               if (acpi_match_device(pdev->dev.driver->acpi_match_table,
> > +                                       &pdev->dev))
> > +                       gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff);
> > +       }
> 
> Yeah, no need to call acpi_match_device() here.
> Instead use stuff from OF, like
> 
> if (of_device_is_compatible() || !(IS_ERR_OR_NULL(fwnode) ||
> is_of_node(fwnode)))
> (check the logic)

Got it!

> ...
> 
> > +#ifdef CONFIG_ACPI
> 
> No ugly ifdeffery, please.

Remove it will cause same compile error above.

> > +static const struct acpi_device_id gpio_acpi_ids[] = {
> > +       {"NXP0031",},
> > +       { }
> > +};
> > +MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids); #endif
> > +
> >  static struct platform_driver mpc8xxx_plat_driver = {
> >         .probe          = mpc8xxx_probe,
> >         .remove         = mpc8xxx_remove,m
> >         .driver         = {
> >                 .name = "gpio-mpc8xxx",
> >                 .of_match_table = mpc8xxx_gpio_ids,
> 
> > +               .acpi_match_table = ACPI_PTR(gpio_acpi_ids),
> 
> Drop ACPI_PTR().

Will encounter below error if !CONFIG_ACPI:

CC      drivers/gpio/gpio-mpc8xxx.o
drivers/gpio/gpio-mpc8xxx.c:449:23: error: ‘gpio_acpi_ids’ undeclared here (not in a function)
  449 |   .acpi_match_table = gpio_acpi_ids,
      |                       ^~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:271: drivers/gpio/gpio-mpc8xxx.o] Error 1
make[1]: *** [scripts/Makefile.build:514: drivers/gpio] Error 2
make[1]: *** Waiting for unfinished jobs....
  CC      net/core/page_pool.o
make: *** [Makefile:1849: drivers] Error 2
make: *** Waiting for unfinished jobs....

Thanks & Regards,
Ran


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ