summaryrefslogtreecommitdiff
path: root/drivers/pci/pci-label.c
diff options
context:
space:
mode:
authorKrzysztof Wilczyński <kw@linux.com>2021-04-27 15:04:44 -0500
committerBjorn Helgaas <bhelgaas@google.com>2021-04-29 10:07:31 -0500
commit362fb766264a1d62254ad950304fa1d97172bb44 (patch)
tree1c3fee01cdf698d83790e8cbd621a4f3582f7089 /drivers/pci/pci-label.c
parent506140f9c06b0d136669ae7795e0264c9f21c1a7 (diff)
PCI/sysfs: Tidy SMBIOS & ACPI label attributes
Update coding style to reduce distraction. 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.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index cdcbe09d363e..c4636f2e8545 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -36,9 +36,8 @@
static bool device_has_acpi_name(struct device *dev)
{
#ifdef CONFIG_ACPI
- acpi_handle handle;
+ acpi_handle handle = ACPI_HANDLE(dev);
- handle = ACPI_HANDLE(dev);
if (!handle)
return false;
@@ -61,13 +60,9 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
{
const struct dmi_device *dmi;
struct dmi_dev_onboard *donboard;
- int domain_nr;
- int bus;
- int devfn;
-
- domain_nr = pci_domain_nr(pdev->bus);
- bus = pdev->bus->number;
- devfn = pdev->devfn;
+ int domain_nr = pci_domain_nr(pdev->bus);
+ int bus = pdev->bus->number;
+ int devfn = pdev->devfn;
dmi = NULL;
while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
@@ -95,11 +90,8 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
static umode_t smbios_attr_is_visible(struct kobject *kobj, struct attribute *a,
int n)
{
- struct device *dev;
- struct pci_dev *pdev;
-
- dev = kobj_to_dev(kobj);
- pdev = to_pci_dev(dev);
+ struct device *dev = kobj_to_dev(kobj);
+ struct pci_dev *pdev = to_pci_dev(dev);
if (device_has_acpi_name(dev))
return 0;
@@ -113,8 +105,7 @@ static umode_t smbios_attr_is_visible(struct kobject *kobj, struct attribute *a,
static ssize_t smbios_label_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct pci_dev *pdev;
- pdev = to_pci_dev(dev);
+ struct pci_dev *pdev = to_pci_dev(dev);
return find_smbios_instance_string(pdev, buf,
SMBIOS_ATTR_LABEL_SHOW);
@@ -125,8 +116,7 @@ static struct device_attribute dev_attr_smbios_label = __ATTR(label, 0444,
static ssize_t index_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
- struct pci_dev *pdev;
- pdev = to_pci_dev(dev);
+ struct pci_dev *pdev = to_pci_dev(dev);
return find_smbios_instance_string(pdev, buf,
SMBIOS_ATTR_INSTANCE_SHOW);
@@ -164,11 +154,10 @@ static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
static int dsm_get_label(struct device *dev, char *buf,
enum acpi_attr_enum attr)
{
- acpi_handle handle;
+ acpi_handle handle = ACPI_HANDLE(dev);
union acpi_object *obj, *tmp;
int len = -1;
- handle = ACPI_HANDLE(dev);
if (!handle)
return -1;
@@ -207,9 +196,7 @@ static int dsm_get_label(struct device *dev, char *buf,
static umode_t acpi_attr_is_visible(struct kobject *kobj, struct attribute *a,
int n)
{
- struct device *dev;
-
- dev = kobj_to_dev(kobj);
+ struct device *dev = kobj_to_dev(kobj);
if (!device_has_acpi_name(dev))
return 0;