From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-i2c@vger.kernel.org,
acpica-devel@lists.linuxfoundation.org,
Len Brown <lenb@kernel.org>, Andi Shyti <andi.shyti@kernel.org>,
Robert Moore <robert.moore@intel.com>,
Michael Brunner <michael.brunner@kontron.com>
Subject: Re: [PATCH v2 1/2] ACPI: platform: Ignore SMB0001 only when it has resources
Date: Thu, 22 Jun 2023 21:18:39 +0300 [thread overview]
Message-ID: <ZJSQf07cO6qmNyCn@smile.fi.intel.com> (raw)
In-Reply-To: <CAJZ5v0jt8XCzUxQaBXLz0zXezih1Urq=dt-K9PWVY1JpN=Go6Q@mail.gmail.com>
On Thu, Jun 22, 2023 at 05:53:13PM +0200, Rafael J. Wysocki wrote:
> On Wed, Jun 21, 2023 at 5:16 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > After switching i2c-scmi driver to be a plaform one, it stopped
>
> "platform"
>
> > being enumerated on number of Kontron platforms, because it's
> > listed in the forbidden_id_list.
> >
> > To resolve the situation, split the list to generic one and
> > another that holds devices that has to be skipped if and only
>
> "have"
>
> > if they have bogus resources attached (_CRS method returns some).
Thanks for the typo fixes!
...
> > +static const struct acpi_device_id forbidden_id_with_resourses[] = {
>
> I don't quite like this name and the driver_data field could be used
> to indicate the need to check the resources.
Okay, something like
/* Check if the device has resources provided by _CRS method */
#define ACPI_PLATFORM_CHECK_RES BIT(0)
?
> > + {"SMB0001", 0}, /* ACPI SMBUS virtual device */
> > + { }
> > +};
...
> > +static int acpi_platform_resource_count(struct acpi_resource *ares, void *data)
> > +{
> > + int *count = data;
> > +
> > + *count = *count + 1;
>
> Why not (*count)++?
Can be that way, I just copied'n'pasted from the existing code.
> > + return 1;
> > +}
...
> > INIT_LIST_HEAD(&resource_list);
> > + ret = acpi_dev_get_resources(adev, &resource_list, acpi_platform_resource_count, &count);
> > + if (ret < 0)
> > + return ERR_PTR(ret);
>
> Why not use acpi_walk_resources() directly here?
Can be done that way. Again, I just used a template (existing code in kernel)
for similar functionality.
> Also, this extra resources walk is only needed if the resources check
> is needed to decide whether or not to skip the device, so what's the
> benefit of doing it for every device that's not skipped?
Ah, indeed. Makes sense to have done it conditionally.
> > + acpi_dev_free_resource_list(&resource_list);
...
Thank you for the review!
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-06-22 18:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 15:16 [PATCH v2 1/2] ACPI: platform: Ignore SMB0001 only when it has resources Andy Shevchenko
2023-06-21 15:16 ` [PATCH v2 2/2] ACPI: platform: Move SMB0001 HID to the header and reuse Andy Shevchenko
2023-06-23 5:54 ` Wolfram Sang
2023-06-22 15:53 ` [PATCH v2 1/2] ACPI: platform: Ignore SMB0001 only when it has resources Rafael J. Wysocki
2023-06-22 18:18 ` Andy Shevchenko [this message]
2023-06-23 14:43 ` Rafael J. Wysocki
2023-06-26 8:15 ` Andy Shevchenko
2023-06-26 10:44 ` Andy Shevchenko
2023-06-26 12:11 ` Rafael J. Wysocki
2023-06-26 13:27 ` Andy Shevchenko
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=ZJSQf07cO6qmNyCn@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=acpica-devel@lists.linuxfoundation.org \
--cc=andi.shyti@kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.brunner@kontron.com \
--cc=rafael@kernel.org \
--cc=robert.moore@intel.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