mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: pmc_atom: Use named initializer for pci_device_id array
@ 2026-05-07 15:50 Uwe Kleine-König (The Capable Hub)
  2026-05-11 14:22 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-07 15:50 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel, Markus Schneider-Pargmann

While being more verbose using a named initializer yields easier to
understand code and doesn't rely on the two hidden zeros in the
PCI_VDEVICE macro.

This doesn't introduce any changes to the compiled result of the array,
which was confirmed with an ARCH=x86 build.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
Hello,

while being a cleanup that can stand on its own this is also a
preparation for making driver_data an anonymous union that requires that
.driver_data is initialized by name and not by list order. The union
allows to do

	-	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_VLV_PMC), .driver_data = (kernel_ulong_t)&byt_data },
	+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_VLV_PMC), .driver_data_ptr = &byt_data },

and

	-	const struct pmc_data *data = (struct pmc_data *)ent->driver_data;
	+	const struct pmc_data *data = ent->driver_data_ptr;

then.

Best regards
Uwe

 drivers/platform/x86/pmc_atom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c
index 48c2a0e59d18..046933f6d1b6 100644
--- a/drivers/platform/x86/pmc_atom.c
+++ b/drivers/platform/x86/pmc_atom.c
@@ -570,8 +570,8 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 /* Data for PCI driver interface used by pci_match_id() call below */
 static const struct pci_device_id pmc_pci_ids[] = {
-	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_VLV_PMC), (kernel_ulong_t)&byt_data },
-	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CHT_PMC), (kernel_ulong_t)&cht_data },
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_VLV_PMC), .driver_data = (kernel_ulong_t)&byt_data },
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CHT_PMC), .driver_data = (kernel_ulong_t)&cht_data },
 	{}
 };
 

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: pmc_atom: Use named initializer for pci_device_id array
  2026-05-07 15:50 [PATCH] platform/x86: pmc_atom: Use named initializer for pci_device_id array Uwe Kleine-König (The Capable Hub)
@ 2026-05-11 14:22 ` Ilpo Järvinen
  0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2026-05-11 14:22 UTC (permalink / raw)
  To: Hans de Goede, Uwe Kleine-König (The Capable Hub)
  Cc: platform-driver-x86, linux-kernel, Markus Schneider-Pargmann

On Thu, 07 May 2026 17:50:25 +0200, Uwe Kleine-König (The Capable Hub) wrote:

> While being more verbose using a named initializer yields easier to
> understand code and doesn't rely on the two hidden zeros in the
> PCI_VDEVICE macro.
> 
> This doesn't introduce any changes to the compiled result of the array,
> which was confirmed with an ARCH=x86 build.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: pmc_atom: Use named initializer for pci_device_id array
      commit: 3b95f36464ec161bcf14c5d1e5f9d5d5e9464582

--
 i.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-11 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-07 15:50 [PATCH] platform/x86: pmc_atom: Use named initializer for pci_device_id array Uwe Kleine-König (The Capable Hub)
2026-05-11 14:22 ` Ilpo Järvinen

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®