From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Jean Delvare <jdelvare@suse.com>,
Andi Shyti <andi.shyti@kernel.org>,
linux-i2c@vger.kernel.org, Sanket.Goswami@amd.com
Subject: Re: [PATCH v4 4/8] i2c: amd-asf: Add ACPI support for AMD ASF Controller
Date: Wed, 11 Sep 2024 19:50:35 +0300 [thread overview]
Message-ID: <ZuHKW5YjcRTshb31@smile.fi.intel.com> (raw)
In-Reply-To: <d80434a2-d997-4db6-aff4-14211612f2fd@amd.com>
On Wed, Sep 11, 2024 at 10:07:42PM +0530, Shyam Sundar S K wrote:
> On 9/11/2024 20:46, Andy Shevchenko wrote:
> > On Wed, Sep 11, 2024 at 05:24:03PM +0530, Shyam Sundar S K wrote:
...
> >> + struct i2c_adapter adap;
> >
> > Make it first member, it might help if we ever do a container_of() against
> > this.
> >
> >> + struct sb800_mmio_cfg mmio_cfg;
> >> + unsigned short port_addr;
> >
> > What you probably want is to have
> >
> > void __iomem *addr;
>
> I will address the above remarks in the next patch.
>
> I believe this should remain "unsigned short" because
>
> - it is defined a unsigned short in i2c_piix4
> - this is just a port address (like 0xb00, 0xb20) and not a real iomem
> address.
It all depends on how you use that. The devm_ioport_map() is just a trick (in
combination with ioreadXX()/iowriteXX() APIs) to have it in "mapped" address
space.
> > and use devm_ioport_map() somewhere (see
> > drivers/pinctl/intel/pinctrl-lynxpoint.c, for example)
...
> >> + LIST_HEAD(res_list);
> >> + adev = ACPI_COMPANION(&pdev->dev);
> >> + if (!adev)
> >> + return dev_err_probe(&pdev->dev, -ENODEV, "Failed to get ASF device\n");
> >
> > No need. You will get here only if enumerated via ACPI (or if it's out-of-tree
> > board file which we do not care about at all).
>
> Not sure if I understand your comment correctly. But I used
> ACPI_COMPANION to retrieve the acpi device that needs to be passed to
> acpi_dev_get_resources(struct acpi_device *, ...) to address your
> previous remarks.
With platform device driver you don't need all this as you are repeating what
drivers/acpi/acpi_platform.c already does it for all ACPI devices.
> >> + ret = acpi_dev_get_resources(adev, &res_list, NULL, NULL);
> >> + if (ret < 0)
> >> + return dev_err_probe(&pdev->dev, ret, "Error getting ASF ACPI resource: %d\n", ret);
> >> +
> >> + list_for_each_entry(rentry, &res_list, node) {
> >> + switch (resource_type(rentry->res)) {
> >> + case IORESOURCE_IO:
> >> + asf_dev->port_addr = rentry->res->start;
> >> + break;
> >> + default:
> >> + dev_warn(&adev->dev, "Invalid ASF resource\n");
> >> + break;
> >> + }
> >> + }
> >> +
> >> + acpi_dev_free_resource_list(&res_list);
> >
> > Now this is a duplicate of what ACPI glue layer does. You have these already
> > available as platform device resources.
>
> looking at drivers/acpi/resource.c acpi_dev_get_resources() mentions
> that the caller should call acpi_dev_free_resource_list(). Is that not
> the case?
I meant that entire block is just a dup of the existing code. See above.
Instead use simple platform_get_resource() and similar to retrieve this
information.
...
> >> + i2c_set_adapdata(&asf_dev->adap, asf_dev);
> >
> > Is it used?
>
> Yes, in the subsequent patches.
I wasn't Cc'ed on the series. Please, make sure you Cc me in the entire series.
...
> >> + status = acpi_get_handle(NULL, (acpi_string)SB800_ASF_ACPI_PATH, &handle);
> >
> > Does it compile with CONFIG_ACPI=n?
>
> I have used a explicit 'depends on' ACPI to this driver soon that LKP
> does not complain with a randconfig.
>
> > Also don't you need to include acpi.h for this? Or is it already there?
> > (I haven't checked).
>
> acpi_get_handle() is defined in acpi.h.
Yes, and I meant piix4 driver where you call this API.
> please assume the rest of the unanswered remarks as "I agree" :-)
Noted!
> >> + if (ACPI_SUCCESS(status))
> >> + is_asf = true;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-09-11 16:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 11:53 [PATCH v4 0/8] Introduce initial AMD ASF Controller driver support Shyam Sundar S K
2024-09-11 11:54 ` [PATCH v4 1/8] i2c: piix4: Change the signature of piix4_transaction function Shyam Sundar S K
2024-09-12 6:15 ` Andi Shyti
2024-09-12 6:22 ` Shyam Sundar S K
2024-09-11 11:54 ` [PATCH v4 2/8] i2c: piix4: Move i2c_piix4 macros and structures to common header Shyam Sundar S K
2024-09-11 11:54 ` [PATCH v4 3/8] i2c: piix4: Export i2c_piix4 driver functions as library Shyam Sundar S K
2024-09-12 7:40 ` Andi Shyti
2024-09-13 6:24 ` Shyam Sundar S K
2024-09-13 8:36 ` Andi Shyti
2024-09-11 11:54 ` [PATCH v4 4/8] i2c: amd-asf: Add ACPI support for AMD ASF Controller Shyam Sundar S K
2024-09-11 15:16 ` Andy Shevchenko
2024-09-11 16:37 ` Shyam Sundar S K
2024-09-11 16:50 ` Andy Shevchenko [this message]
2024-09-11 16:59 ` Shyam Sundar S K
2024-09-11 11:54 ` [PATCH v4 5/8] i2c: amd-asf: Add i2c_algorithm operations to support AMD ASF with SMBus Shyam Sundar S K
2024-09-11 11:54 ` [PATCH v4 6/8] i2c: amd-asf: Add routine to handle the ASF slave process Shyam Sundar S K
2024-09-11 11:54 ` [PATCH v4 7/8] i2c: amd-asf: Clear remote IRR bit to get successive interrupt Shyam Sundar S K
2024-09-11 11:54 ` [PATCH v4 8/8] MAINTAINERS: Add AMD ASF driver entry Shyam Sundar S K
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=ZuHKW5YjcRTshb31@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Sanket.Goswami@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=andi.shyti@kernel.org \
--cc=jdelvare@suse.com \
--cc=linux-i2c@vger.kernel.org \
/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