PCI/sysfs: Rearrange smbios_attr_group and acpi_attr_group

Collect the smbios_attr_group and acpi_attr_group together in the logical
order.  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>
This commit is contained in:
Krzysztof Wilczyński 2021-04-27 15:18:47 -05:00 committed by Bjorn Helgaas
parent 362fb76626
commit df1af7cbe7

View File

@ -87,21 +87,6 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
return 0; return 0;
} }
static umode_t smbios_attr_is_visible(struct kobject *kobj, struct attribute *a,
int n)
{
struct device *dev = kobj_to_dev(kobj);
struct pci_dev *pdev = to_pci_dev(dev);
if (device_has_acpi_name(dev))
return 0;
if (!find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE))
return 0;
return a->mode;
}
static ssize_t smbios_label_show(struct device *dev, static ssize_t smbios_label_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
@ -129,6 +114,21 @@ static struct attribute *smbios_attrs[] = {
NULL, NULL,
}; };
static umode_t smbios_attr_is_visible(struct kobject *kobj, struct attribute *a,
int n)
{
struct device *dev = kobj_to_dev(kobj);
struct pci_dev *pdev = to_pci_dev(dev);
if (device_has_acpi_name(dev))
return 0;
if (!find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE))
return 0;
return a->mode;
}
const struct attribute_group pci_dev_smbios_attr_group = { const struct attribute_group pci_dev_smbios_attr_group = {
.attrs = smbios_attrs, .attrs = smbios_attrs,
.is_visible = smbios_attr_is_visible, .is_visible = smbios_attr_is_visible,
@ -193,17 +193,6 @@ static int dsm_get_label(struct device *dev, char *buf,
return len; return len;
} }
static umode_t acpi_attr_is_visible(struct kobject *kobj, struct attribute *a,
int n)
{
struct device *dev = kobj_to_dev(kobj);
if (!device_has_acpi_name(dev))
return 0;
return a->mode;
}
static ssize_t label_show(struct device *dev, struct device_attribute *attr, static ssize_t label_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
@ -224,6 +213,17 @@ static struct attribute *acpi_attrs[] = {
NULL, NULL,
}; };
static umode_t acpi_attr_is_visible(struct kobject *kobj, struct attribute *a,
int n)
{
struct device *dev = kobj_to_dev(kobj);
if (!device_has_acpi_name(dev))
return 0;
return a->mode;
}
const struct attribute_group pci_dev_acpi_attr_group = { const struct attribute_group pci_dev_acpi_attr_group = {
.attrs = acpi_attrs, .attrs = acpi_attrs,
.is_visible = acpi_attr_is_visible, .is_visible = acpi_attr_is_visible,