summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-label.c
diff options
context:
space:
mode:
authorKrzysztof Wilczyński <kw@linux.com>2021-04-27 17:39:16 +0200
committerBjorn Helgaas <bhelgaas@google.com>2021-04-29 17:07:31 +0200
commit1017275d2e43dba68527e0e69f4cc12d2b0f8966 (patch)
tree5e57eea42a425bf2feaba02c429b06e4dfa1aafa /drivers/pci/pci-label.c
parentPCI/sysfs: Convert "vpd" to static attribute (diff)
downloadlinux-1017275d2e43dba68527e0e69f4cc12d2b0f8966.tar.xz
linux-1017275d2e43dba68527e0e69f4cc12d2b0f8966.zip
PCI/sysfs: Rename device_has_dsm() to device_has_acpi_name()
Rename device_has_dsm() to device_has_acpi_name() to better reflect its purpose and move it earlier so it's available for a future SMBIOS .is_visible() function. No functional change intended. [bhelgaas: split to separate patch] Link: https://lore.kernel.org/r/20210416205856.3234481-6-kw@linux.com Signed-off-by: Krzysztof Wilczyński <kw@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci-label.c')
-rw-r--r--drivers/pci/pci-label.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index 781e45cf60d1..5fd5824db82f 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -33,6 +33,22 @@
#include <linux/pci-acpi.h>
#include "pci.h"
+static bool device_has_acpi_name(struct device *dev)
+{
+#ifdef CONFIG_ACPI
+ acpi_handle handle;
+
+ handle = ACPI_HANDLE(dev);
+ if (!handle)
+ return false;
+
+ return acpi_check_dsm(handle, &pci_acpi_dsm_guid, 0x2,
+ 1 << DSM_PCI_DEVICE_NAME);
+#else
+ return false;
+#endif
+}
+
#ifdef CONFIG_DMI
enum smbios_attr_enum {
SMBIOS_ATTR_NONE = 0,
@@ -209,18 +225,6 @@ static int dsm_get_label(struct device *dev, char *buf,
return len;
}
-static bool device_has_dsm(struct device *dev)
-{
- acpi_handle handle;
-
- handle = ACPI_HANDLE(dev);
- if (!handle)
- return false;
-
- return !!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 0x2,
- 1 << DSM_PCI_DEVICE_NAME);
-}
-
static umode_t acpi_index_string_exist(struct kobject *kobj,
struct attribute *attr, int n)
{
@@ -228,7 +232,7 @@ static umode_t acpi_index_string_exist(struct kobject *kobj,
dev = kobj_to_dev(kobj);
- if (device_has_dsm(dev))
+ if (device_has_acpi_name(dev))
return S_IRUGO;
return 0;
@@ -287,16 +291,11 @@ static inline int pci_remove_acpi_index_label_files(struct pci_dev *pdev)
{
return -1;
}
-
-static inline bool device_has_dsm(struct device *dev)
-{
- return false;
-}
#endif
void pci_create_firmware_label_files(struct pci_dev *pdev)
{
- if (device_has_dsm(&pdev->dev))
+ if (device_has_acpi_name(&pdev->dev))
pci_create_acpi_index_label_files(pdev);
else
pci_create_smbiosname_file(pdev);
@@ -304,7 +303,7 @@ void pci_create_firmware_label_files(struct pci_dev *pdev)
void pci_remove_firmware_label_files(struct pci_dev *pdev)
{
- if (device_has_dsm(&pdev->dev))
+ if (device_has_acpi_name(&pdev->dev))
pci_remove_acpi_index_label_files(pdev);
else
pci_remove_smbiosname_file(pdev);