Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730819 > unrolled thread

[PATCH] PCI: make pci_dev_type const

Started byBhumika Goyal <bhumirks@gmail.com>
First post2017-09-12 13:20 +0200
Last post2017-09-19 21:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] PCI: make pci_dev_type const Bhumika Goyal <bhumirks@gmail.com> - 2017-09-12 13:20 +0200
    Re: [PATCH] PCI: make pci_dev_type const Bjorn Helgaas <helgaas@kernel.org> - 2017-09-19 21:50 +0200

#1730819 — [PATCH] PCI: make pci_dev_type const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-09-12 13:20 +0200
Subject[PATCH] PCI: make pci_dev_type const
Message-ID<uoRot-z9-1@gated-at.bofh.it>
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 <bhumirks@gmail.com>
---
 drivers/pci/pci-sysfs.c | 2 +-
 drivers/pci/pci.h       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 1eecfa3..882d6c3 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -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,
 };
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index a6560c9..1db36f2 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -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[];
 
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1735194

FromBjorn Helgaas <helgaas@kernel.org>
Date2017-09-19 21:50 +0200
Message-ID<urwGS-1aF-11@gated-at.bofh.it>
In reply to#1730819
On Tue, Sep 12, 2017 at 04:43:33PM +0530, Bhumika Goyal wrote:
> 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 <bhumirks@gmail.com>

Applied to pci/misc for v4.15, thanks!

> ---
>  drivers/pci/pci-sysfs.c | 2 +-
>  drivers/pci/pci.h       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 1eecfa3..882d6c3 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -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,
>  };
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index a6560c9..1db36f2 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -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[];
>  
>  
> -- 
> 1.9.1
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web