From: Randy Dunlap <rdunlap@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>,
Mario Limonciello <mario.limonciello@amd.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org
Subject: [PATCH] PCI/sysfs: hide boot_display definition when VIDEO=n
Date: Mon, 21 Jul 2025 14:02:37 -0700 [thread overview]
Message-ID: <20250721210248.267962-1-rdunlap@infradead.org> (raw)
When CONFIG_VIDEO is not set, defining the 'boot_display' attribute
causes build errors/warnings, so hide the declaration as is done with
other code that uses this variable. Bracket unused code inside
#ifdef CONFIG_VIDEO/#endif to prevent other build warnings/errors.
include/linux/device.h:199:33: warning: 'dev_attr_boot_display' defined but not used [-Wunused-variable]
199 | struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
drivers/pci/pci-sysfs.c:688:8: note: in expansion of macro 'DEVICE_ATTR_RO'
688 | static DEVICE_ATTR_RO(boot_display);
drivers/pci/pci-sysfs.c:683:16: warning: ‘boot_display_show’ defined but not used [-Wunused-function]
683 | static ssize_t boot_display_show(struct device *dev,
| ^~~~~~~~~~~~~~~~~
Fixes: c4f2dc1e5293c ("PCI: Add a new 'boot_display' attribute")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
Also, a question:
What does this do in pci-sysfs.c?
#ifndef ARCH_PCI_DEV_GROUPS
#define ARCH_PCI_DEV_GROUPS
#endif
Is there some hidden macro (probably using string concatenation)
that uses this define value? Thanks.
drivers/pci/pci-sysfs.c | 3 +++
1 file changed, 3 insertions(+)
--- linux-next-20250721.orig/drivers/pci/pci-sysfs.c
+++ linux-next-20250721/drivers/pci/pci-sysfs.c
@@ -680,12 +680,15 @@ const struct attribute_group *pcibus_gro
NULL,
};
+#ifdef CONFIG_VIDEO
static ssize_t boot_display_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "1\n");
}
+
static DEVICE_ATTR_RO(boot_display);
+#endif
static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr,
char *buf)
next reply other threads:[~2025-07-21 21:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 21:02 Randy Dunlap [this message]
2025-07-21 21:05 ` Limonciello, Mario
2025-07-21 21:08 ` Randy Dunlap
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=20250721210248.267962-1-rdunlap@infradead.org \
--to=rdunlap@infradead.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mario.limonciello@amd.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
all inboxes | Powered by JetHome®