The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v1] tty: serial: rp2: Use named initializer for pci_device_id::driver_data
@ 2026-05-24 13:19 Uwe Kleine-König (The Capable Hub)
  2026-07-07  9:09 ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-24 13:19 UTC (permalink / raw)
  To: Kevin Cernekee, Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-serial, linux-kernel

The .driver_data member of the struct pci_device_id array were
initialized by list expressions relying on hidden assignment of .class
and .class_mask in PCI_VDEVICE().

Make the initialization more robust by using a named initializer. This
robustness is relevant for a planned change to struct pci_device_id that
replaces .driver_data by an anonymous union.

This change doesn't introduce changes to the compiled pci_device_id
array. Tested on x86 and arm64.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/tty/serial/rp2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/rp2.c b/drivers/tty/serial/rp2.c
index 6d99a02dd439..51e81ec0ffdb 100644
--- a/drivers/tty/serial/rp2.c
+++ b/drivers/tty/serial/rp2.c
@@ -197,7 +197,7 @@ struct rp2_card {
 };
 
 #define RP_ID(prod) PCI_VDEVICE(RP, (prod))
-#define RP_CAP(ports, smpte) (((ports) << 8) | ((smpte) << 0))
+#define RP_CAP(ports, smpte) .driver_data = (((ports) << 8) | ((smpte) << 0))
 
 static inline void rp2_decode_cap(const struct pci_device_id *id,
 				  int *ports, int *smpte)

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


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

* Re: [PATCH v1] tty: serial: rp2: Use named initializer for pci_device_id::driver_data
  2026-05-24 13:19 [PATCH v1] tty: serial: rp2: Use named initializer for pci_device_id::driver_data Uwe Kleine-König (The Capable Hub)
@ 2026-07-07  9:09 ` Uwe Kleine-König (The Capable Hub)
  2026-07-07 12:26   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-07-07  9:09 UTC (permalink / raw)
  To: Kevin Cernekee, Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-serial, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

Hello,

On Sun, May 24, 2026 at 03:19:05PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> The .driver_data member of the struct pci_device_id array were
> initialized by list expressions relying on hidden assignment of .class
> and .class_mask in PCI_VDEVICE().
> 
> Make the initialization more robust by using a named initializer. This
> robustness is relevant for a planned change to struct pci_device_id that
> replaces .driver_data by an anonymous union.
> 
> This change doesn't introduce changes to the compiled pci_device_id
> array. Tested on x86 and arm64.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>

This patch was sent before the merge window leading to v7.2-rc1 and got
no feedback and isn't in next. So I wonder if it's still on someone's
radar?!

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] tty: serial: rp2: Use named initializer for pci_device_id::driver_data
  2026-07-07  9:09 ` Uwe Kleine-König (The Capable Hub)
@ 2026-07-07 12:26   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-07 12:26 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Kevin Cernekee, Jiri Slaby, linux-serial, linux-kernel

On Tue, Jul 07, 2026 at 11:09:30AM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> Hello,
> 
> On Sun, May 24, 2026 at 03:19:05PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > The .driver_data member of the struct pci_device_id array were
> > initialized by list expressions relying on hidden assignment of .class
> > and .class_mask in PCI_VDEVICE().
> > 
> > Make the initialization more robust by using a named initializer. This
> > robustness is relevant for a planned change to struct pci_device_id that
> > replaces .driver_data by an anonymous union.
> > 
> > This change doesn't introduce changes to the compiled pci_device_id
> > array. Tested on x86 and arm64.
> > 
> > Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> 
> This patch was sent before the merge window leading to v7.2-rc1 and got
> no feedback and isn't in next. So I wonder if it's still on someone's
> radar?!

It is, give me a chance to catch up, just made it through 300+
drivers/staging/ patches that had been sent recently....

thanks,

greg k-h

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

end of thread, other threads:[~2026-07-07 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-24 13:19 [PATCH v1] tty: serial: rp2: Use named initializer for pci_device_id::driver_data Uwe Kleine-König (The Capable Hub)
2026-07-07  9:09 ` Uwe Kleine-König (The Capable Hub)
2026-07-07 12:26   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox