From: "Richard Hsu(許育彰)" <Richard_Hsu@asmedia.com.tw>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Richard Hsu(許育彰)" <Richard_Hsu@asmedia.com.tw>
Cc: "Richard Hsu" <saraon640529@gmail.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Yd Tseng(曾裕達)" <Yd_Tseng@asmedia.com.tw>,
"Cindy1 Hsu(許凱茵)" <Cindy1_Hsu@asmedia.com.tw>,
"Andrew Su(蘇俊源)" <Andrew_Su@asmedia.com.tw>
Subject: RE: [PATCH] gpio Add my driver new id
Date: Mon, 6 Dec 2021 06:49:18 +0000 [thread overview]
Message-ID: <2c4a9ebf1adb4f198f5850eede186c37@asmedia.com.tw> (raw)
In-Reply-To: <YaqKQVV1+8ksQInA@smile.fi.intel.com>
Hi Andy & Bartosz!
Sorry for the late reply. New acpi device AMDIF031 have 24 gpio pins and older AMDF030/AMDIF030 have 8 gpio pins,
I use acpi_bus_get_device() that check acpi device and gain acpi_dev info to replace the original. Then we check and compare device name from acpi_dev_name(acpi_dev).
If AMDIF031(pt_gpio->gc.ngpio = 24) or AMDF030/AMDIF030 (pt_gpio->gc.ngpio = 8).
I will try to use .driver_data, and add commit messages on title and code that explain what the code does in detail later
Thanks
Richard
> > #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 },
-----Original Message-----
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Sent: Saturday, December 4, 2021 5:21 AM
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Richard Hsu <saraon640529@gmail.com>; Linus Walleij <linus.walleij@linaro.org>; Richard Hsu(許育彰) <Richard_Hsu@asmedia.com.tw>; open list:GPIO SUBSYSTEM <linux-gpio@vger.kernel.org>; Linux Kernel Mailing List <linux-kernel@vger.kernel.org>; Yd Tseng(曾裕達) <Yd_Tseng@asmedia.com.tw>; Cindy1 Hsu(許凱茵) <Cindy1_Hsu@asmedia.com.tw>; Andrew Su(蘇俊源) <Andrew_Su@asmedia.com.tw>
Subject: Re: [PATCH] gpio Add my driver new id
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@gmail.com> 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
<p></p>
prev parent reply other threads:[~2021-12-06 6:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 9:26 Richard Hsu
2021-12-03 10:15 ` Bartosz Golaszewski
2021-12-03 21:21 ` Andy Shevchenko
2021-12-06 6:49 ` Richard Hsu(許育彰) [this message]
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=2c4a9ebf1adb4f198f5850eede186c37@asmedia.com.tw \
--to=richard_hsu@asmedia.com.tw \
--cc=Andrew_Su@asmedia.com.tw \
--cc=Cindy1_Hsu@asmedia.com.tw \
--cc=Yd_Tseng@asmedia.com.tw \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=saraon640529@gmail.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
all inboxes | Powered by JetHome®