From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ondrej Zary <linux@zary.sk>
Cc: "Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Introduce Synology x86 NAS LEDs driver
Date: Wed, 25 Nov 2026 12:25:53 +0200 [thread overview]
Message-ID: <awa3sVUTSMWKAQCd@ashevche-desk.local> (raw)
In-Reply-To: <202611242312.38998.linux@zary.sk>
On Tue, Nov 24, 2026 at 11:12:38PM +0100, Ondrej Zary wrote:
> On Tuesday 24 November 2026 21:13:21 Andy Shevchenko wrote:
> > On Tue, Nov 24, 2026 at 07:54:47PM +0100, Ondrej Zary wrote:
> > > On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
> > > > On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
> > > > > +struct synology_pci_dev {
> > > > > + unsigned int bus;
> > > > > + unsigned int devfn;
> > > > > + struct pci_device_id id;
> > > > > +};
> > > > > +
> > > > > +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */
> > > > > +static const struct synology_pci_dev ds411plus_pci_devices[] __initconst = {
> > > > > + /* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */
> > > > > + { 0, PCI_DEVFN(0, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0xa000,
> > > > > + PCI_VENDOR_ID_INTEL, 0xa000) } },
> > > > > + /* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */
> > > > > + { 0, PCI_DEVFN(0x1f, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x2916,
> > > > > + PCI_VENDOR_ID_INTEL, 0x2916) } },
> > > >
> > > > > + /* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */
> > > > > + { 2, PCI_DEVFN(0x00, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_CMD, 0x3531,
> > > > > + PCI_VENDOR_ID_CMD, 0x3531) } },
> > > > > + /* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */
> > > > > + { 3, PCI_DEVFN(0x00, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x10d3,
> > > > > + PCI_VENDOR_ID_INTEL, 0x0000) } },
> > > > > + {}
> > > >
> > > > > +};
> > > >
> > > > > +/* check if all PCI devices in the list are present at specified locations */
> > > > > +static bool __init synology_pci_devices_present(const struct synology_pci_dev *list)
> > > > > +{
> > > > > + const struct synology_pci_dev *d;
> > > > > +
> > > > > + for (d = list; d->id.vendor; d++) {
> > > > > + struct pci_dev *pdev = pci_get_domain_bus_and_slot(0, d->bus, d->devfn);
> > > > > +
> > > > > + if (!pdev)
> > > > > + return false;
> > > >
> > > > > + bool matched = d->id.vendor == pdev->vendor &&
> > > > > + d->id.device == pdev->device &&
> > > > > + d->id.subvendor == pdev->subsystem_vendor &&
> > > > > + d->id.subdevice == pdev->subsystem_device;
> > > >
> > > > Don't mix variable definitions with the code (it's exceptionally possible
> > > > for a couple of cases, none of which is this one). Can't it use
> > > > pci_match_id() approach with driver_data? (If we ever need this check.)
> > >
> > > I don't see how can pci_match_id() be used here. I can merge pci bus and
> > > devfun into driver_data to fit into pci_device_id table but there's no
> > > pci_dev which could be matched against that table (and walking all PCI
> > > devices does not seem to be an improvement).
> >
> > _After_ DMI match the walk over all PCI devices is not a big deal. The code
> > will be nicer. But maybe there is a better choice? Like checking CPUID? Or
> > maybe something interesting is present in the ACPI tables?
>
> pci_find_next_bus() and pci_walk_bus() with a callback or
> list_for_each_entry()?
> Then pci_match_id() and finally test if the matched device has proper bus and
> devfn numbers. Doesn't look like a recipe for nice code.
Check how pmc_atom_init() is implemented.
> I'll check ACPI tables tomorrow but I doubt there's anything done properly
> in the BIOS (even int13 support is buggy and requires GRUB patch).
Yeah...
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-11-25 10:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 12:45 [PATCH v3] Introduce Synology x86 NAS LEDs driver Ondrej Zary
2026-11-24 17:03 ` Andy Shevchenko
2026-11-24 18:54 ` Ondrej Zary
2026-11-24 20:13 ` Andy Shevchenko
2026-11-24 22:12 ` Ondrej Zary
2026-11-25 10:25 ` Andy Shevchenko [this message]
2026-11-25 8:11 ` Ondrej Zary
2026-11-25 10:28 ` Andy Shevchenko
2026-11-25 11:33 ` Ondrej Zary
2026-11-25 13:21 ` 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=awa3sVUTSMWKAQCd@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@zary.sk \
--cc=platform-driver-x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.