All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [Intel-gfx] [PATCH 2/3] drm/i915/pciids: use designated initializers for struct pci_device_id
Date: Fri, 11 Mar 2022 12:18:53 +0200	[thread overview]
Message-ID: <20220311101854.146911-2-jani.nikula@intel.com> (raw)
In-Reply-To: <20220311101854.146911-1-jani.nikula@intel.com>

Use designated initializers for struct pci_device_id to avoid the
dependency on struct pci_device_id remaining unchanged. Recently, commit
343b7258687e ("PCI: Add 'override_only' field to struct pci_device_id")
added a new member leading to warnings about missing field initializers.

Any userspace using this header should switch to defining their own
initializers. The old one is left in place for now.

References: https://lore.kernel.org/all/202108272322.EipbBEAp-lkp@intel.com
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 include/drm/i915_pciids.h | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index 637333c9e1c0..2831614f8725 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -25,15 +25,18 @@
 #ifndef _I915_PCIIDS_H
 #define _I915_PCIIDS_H
 
+#ifdef __KERNEL__
+/* Initializer for struct pci_device_id */
+#define INTEL_VGA_DEVICE_INIT(__id, __subvendor, __subdevice, __info) { \
+		.vendor = 0x8086, .device = (__id),			\
+		.subvendor = (__subvendor), .subdevice = (__subdevice),	\
+		.class = 0x030000, .class_mask = 0xff0000,		\
+		.driver_data = (kernel_ulong_t)(__info),		\
+	}
+#else
 /*
- * A pci_device_id struct {
- *	__u32 vendor, device;
- *      __u32 subvendor, subdevice;
- *	__u32 class, class_mask;
- *	kernel_ulong_t driver_data;
- * };
- * Don't use C99 here because "class" is reserved and we want to
- * give userspace flexibility.
+ * Transitional, non-kernel users should define INTEL_VGA_DEVICE_INIT()
+ * themselves.
  */
 #define INTEL_VGA_DEVICE_INIT(__id, __subvendor, __subdevice, __info) { \
 		0x8086, (__id),						\
@@ -41,6 +44,7 @@
 		0x030000, 0xff0000,					\
 		(kernel_ulong_t)(__info),				\
 	}
+#endif
 
 #define INTEL_VGA_DEVICE(__id, __info)			\
 	INTEL_VGA_DEVICE_INIT(__id, ~0, ~0, __info)
-- 
2.30.2


  reply	other threads:[~2022-03-11 10:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 10:18 [Intel-gfx] [PATCH 1/3] drm/i915/pciids: add common INTEL_VGA_DEVICE_INIT macro Jani Nikula
2022-03-11 10:18 ` Jani Nikula [this message]
2022-03-11 10:18 ` [Intel-gfx] [PATCH 3/3] drm/i915: define INTEL_VGA_DEVICE_INIT() for subplatform init Jani Nikula
2022-03-11 13:05 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm/i915/pciids: add common INTEL_VGA_DEVICE_INIT macro Patchwork
2022-03-11 13:38 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-11 16:12 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2023-01-16 12:18 [PATCH 0/3] drm/i915: Use designated initializers for struct pci_device_id init Jani Nikula
2023-01-16 12:18 ` [Intel-gfx] [PATCH 2/3] drm/i915/pciids: use designated initializers for struct pci_device_id Jani Nikula

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=20220311101854.146911-2-jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.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.