PCI: make pci_dev_type const
PATCH 1/1 PCI: make pci_dev_type const
Make this const as it not modified in the file referencing it. It is only stored in a const field 'type' of a device structure. Also, add const to the variable declaration in the header file.
Signed-off-by Bhumika Goyal <[email protected]>
--- drivers/pci/pci-sysfs.c | 2 +- drivers/pci/pci.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pci-sysfs.c +1 -1
@@ -1788,6 +1788,6 @@ static umode_t sriov_attrs_are_visible(struct kobject *kobj, NULL, }; -struct device_type pci_dev_type = { +const struct device_type pci_dev_type = { .groups = pci_dev_attr_groups, };
drivers/pci/pci.h +1 -1
@@ -192,7 +192,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev) }extern const struct attribute_group *pci_dev_groups[];extern const struct attribute_group *pcibus_groups[]; -extern struct device_type pci_dev_type; +extern const struct device_type pci_dev_type;extern const struct attribute_group *pci_bus_groups[];
Signature · 1 line
1.9.1
Bjorn Helgaas
AppliedQuoted 5 lines · Bhumika Goyal
Make this const as it not modified in the file referencing it. It is only stored in a const field 'type' of a device structure. Also, add const to the variable declaration in the header file.
Signed-off-by Bhumika Goyal <[email protected]>
Applied to pci/misc for v4.15, thanks!
Quoted 33 lines
--- drivers/pci/pci-sysfs.c | 2 +- drivers/pci/pci.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/pci/pci-sysfs.c +1
-1@@ -1788,6 +1788,6 @@ static umode_t sriov_attrs_are_visible(struct kobject *kobj, NULL, }; -struct device_type pci_dev_type = { +const struct device_type pci_dev_type = { .groups = pci_dev_attr_groups, };drivers/pci/pci.h +1
-1@@ -192,7 +192,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev) }extern const struct attribute_group *pci_dev_groups[];extern const struct attribute_group *pcibus_groups[]; -extern struct device_type pci_dev_type; +extern const struct device_type pci_dev_type;extern const struct attribute_group *pci_bus_groups[];Signature · 1 line
1.9.1