From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Ran Wang <ran.wang_1@nxp.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpio: mpc8xxx: Add ACPI support
Date: Sun, 14 Mar 2021 15:51:54 +0200 [thread overview]
Message-ID: <CAHp75VeZyfVEQ6tDnfm2-vZggg=CnG7idwihvykSgJOvjd_=tA@mail.gmail.com> (raw)
In-Reply-To: <20210312065855.37072-1-ran.wang_1@nxp.com>
On Fri, Mar 12, 2021 at 8:53 AM Ran Wang <ran.wang_1@nxp.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 (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.
> + 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)
...
> +#ifdef CONFIG_ACPI
No ugly ifdeffery, please.
> +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,
> .driver = {
> .name = "gpio-mpc8xxx",
> .of_match_table = mpc8xxx_gpio_ids,
> + .acpi_match_table = ACPI_PTR(gpio_acpi_ids),
Drop ACPI_PTR().
> },
> };
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2021-03-14 13:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 6:58 [PATCH] gpio: mpc8xxx: Add ACPI support Ran Wang
2021-03-12 11:07 ` Bartosz Golaszewski
2021-03-14 0:10 ` Michael Walle
2021-03-15 6:12 ` Ran Wang
2021-03-13 1:04 ` kernel test robot
2021-03-14 13:51 ` Andy Shevchenko [this message]
2021-03-15 6:02 ` Ran Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHp75VeZyfVEQ6tDnfm2-vZggg=CnG7idwihvykSgJOvjd_=tA@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ran.wang_1@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).