From: Bjorn Helgaas <helgaas@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: D Scott Phillips <scott@os.amperecomputing.com>,
linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>, Len Brown <lenb@kernel.org>,
linux-kernel@vger.kernel.org,
Darren Hart <darren@os.amperecomputing.com>,
patches@amperecomputing.com
Subject: Re: [PATCH] PCI: hotplug: Add extension driver for Ampere Altra hotplug LED control
Date: Fri, 29 Sep 2023 15:32:34 -0500 [thread overview]
Message-ID: <20230929203234.GA552475@bhelgaas> (raw)
In-Reply-To: <CAJZ5v0j9hvhboyfmgs1CXkUqpmrMryNjwWGV+kJB-FCMfXaM_g@mail.gmail.com>
On Fri, Sep 29, 2023 at 09:06:02PM +0200, Rafael J. Wysocki wrote:
> On Thu, Sep 28, 2023 at 5:47 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > On Wed, Sep 27, 2023 at 01:23:47PM -0700, D Scott Phillips wrote:
> > > On Ampere Altra, PCIe hotplug is handled through ACPI. A side interface is
> > > also present to request system firmware control of attention LEDs. Add an
> > > ACPI PCI Hotplug companion driver to support attention LED control.
> > > +static int __init acpiphp_ampere_altra_init(void)
> > > +{
> > > + struct fwnode_handle *fwnode;
> > > + acpi_handle leds_handle = NULL;
> > > + struct acpi_device *leds;
> > > + acpi_status status;
> > > + int ret;
> > > +
> > > + status = acpi_get_devices("AMPC0008", get_acpi_handle, NULL,
> > > + &leds_handle);
> >
> > Rafael, can you comment on whether we should use acpi_get_devices(),
> > acpi_bus_register_driver(), acpi_acpi_scan_add_handler(), or something
> > else here?
>
> Personally, I would go for a platform driver, because the ACPI core
> should create a platform device for this object.
>
> acpi_get_devices() carries out a namespace walk that is costly and
> entirely avoidable.
>
> > I try to avoid pci_get_device() because it subverts the
> > driver model (no hotplug support, no driver/device binding).
> >
> > I see Documentation/driver-api/acpi/scan_handlers.rst, but I'm not
> > clear on when to use acpi_bus_register_driver() vs
>
> Never.
>
> > acpi_acpi_scan_add_handler().
>
> When you don't want the ACPI core to create a platform device for your
> ACPI device object. There are cases like that, but they are rare.
Ah, so none of the above (not acpi_get_devices(),
acpi_bus_register_driver(), OR acpi_acpi_scan_add_handler()).
IIUC, what you propose would look something like this:
static u32 led_service_id[4];
static int altra_led_probe(struct platform_device *pdev)
{
struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev);
fwnode_property_read_u32_array(fwnode, "uuid", led_service_id, 4);
}
static const struct acpi_device_id altra_led_ids[] = {
{"AMPC0008", 0}, {}
};
MODULE_DEVICE_TABLE(acpi, altra_led_ids);
static struct platform_driver altra_led_driver = {
.driver = {
.acpi_match_table = altra_led_ids,
},
.probe = altra_led_probe,
};
module_platform_driver(altra_led_driver);
Bjorn
next prev parent reply other threads:[~2023-09-29 20:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 20:23 [PATCH] PCI: hotplug: Add extension driver for Ampere Altra hotplug LED control D Scott Phillips
2023-09-28 15:47 ` Bjorn Helgaas
2023-09-28 21:02 ` D Scott Phillips
2023-09-28 21:26 ` Bjorn Helgaas
2023-09-29 19:06 ` Rafael J. Wysocki
2023-09-29 20:32 ` Bjorn Helgaas [this message]
2023-09-30 0:11 ` D Scott Phillips
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=20230929203234.GA552475@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=darren@os.amperecomputing.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=patches@amperecomputing.com \
--cc=rafael@kernel.org \
--cc=scott@os.amperecomputing.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