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>
This commit is contained in:
Родитель
506140f9c0
Коммит
362fb76626
|
@ -36,9 +36,8 @@
|
||||||
static bool device_has_acpi_name(struct device *dev)
|
static bool device_has_acpi_name(struct device *dev)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
acpi_handle handle;
|
acpi_handle handle = ACPI_HANDLE(dev);
|
||||||
|
|
||||||
handle = ACPI_HANDLE(dev);
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -61,13 +60,9 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
|
||||||
{
|
{
|
||||||
const struct dmi_device *dmi;
|
const struct dmi_device *dmi;
|
||||||
struct dmi_dev_onboard *donboard;
|
struct dmi_dev_onboard *donboard;
|
||||||
int domain_nr;
|
int domain_nr = pci_domain_nr(pdev->bus);
|
||||||
int bus;
|
int bus = pdev->bus->number;
|
||||||
int devfn;
|
int devfn = pdev->devfn;
|
||||||
|
|
||||||
domain_nr = pci_domain_nr(pdev->bus);
|
|
||||||
bus = pdev->bus->number;
|
|
||||||
devfn = pdev->devfn;
|
|
||||||
|
|
||||||
dmi = NULL;
|
dmi = NULL;
|
||||||
while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
|
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,
|
static umode_t smbios_attr_is_visible(struct kobject *kobj, struct attribute *a,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
|
||||||
dev = kobj_to_dev(kobj);
|
|
||||||
pdev = to_pci_dev(dev);
|
|
||||||
|
|
||||||
if (device_has_acpi_name(dev))
|
if (device_has_acpi_name(dev))
|
||||||
return 0;
|
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,
|
static ssize_t smbios_label_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
pdev = to_pci_dev(dev);
|
|
||||||
|
|
||||||
return find_smbios_instance_string(pdev, buf,
|
return find_smbios_instance_string(pdev, buf,
|
||||||
SMBIOS_ATTR_LABEL_SHOW);
|
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,
|
static ssize_t index_show(struct device *dev, struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
pdev = to_pci_dev(dev);
|
|
||||||
|
|
||||||
return find_smbios_instance_string(pdev, buf,
|
return find_smbios_instance_string(pdev, buf,
|
||||||
SMBIOS_ATTR_INSTANCE_SHOW);
|
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,
|
static int dsm_get_label(struct device *dev, char *buf,
|
||||||
enum acpi_attr_enum attr)
|
enum acpi_attr_enum attr)
|
||||||
{
|
{
|
||||||
acpi_handle handle;
|
acpi_handle handle = ACPI_HANDLE(dev);
|
||||||
union acpi_object *obj, *tmp;
|
union acpi_object *obj, *tmp;
|
||||||
int len = -1;
|
int len = -1;
|
||||||
|
|
||||||
handle = ACPI_HANDLE(dev);
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return -1;
|
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,
|
static umode_t acpi_attr_is_visible(struct kobject *kobj, struct attribute *a,
|
||||||
int n)
|
int n)
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
|
|
||||||
dev = kobj_to_dev(kobj);
|
|
||||||
|
|
||||||
if (!device_has_acpi_name(dev))
|
if (!device_has_acpi_name(dev))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче