Skip to contentSkip to conversation

constify drm pci_device_id

PATCH In review Arvind Yadav 2 participants 4 messages Jul 15, 2017 – Jul 16, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover constify drm pci_device_id

pci_device_id are not supposed to change at runtime. All functions working with pci_device_id provided by <linux/pci.h> work with const pci_device_id. So mark the non-const structs as const.

Arvind Yadav (5):
[PATCH 1/5] drm: radeon: constify pci_device_id. [PATCH 2/5] drm: vmwgfx: constify pci_device_id. [PATCH 3/5] drm: nouveau: constify pci_device_id. [PATCH 4/5] drm: via: constify pci_device_id. [PATCH 5/5] drm: hisilicon: constify pci_device_id.

 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c           | 2 +-
 drivers/gpu/drm/radeon/radeon_drv.c             | 2 +-
 drivers/gpu/drm/via/via_drv.c                   | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c             | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 drm: radeon: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions working with pci_device_id provided by <linux/pci.h> work with const pci_device_id. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
6560 23212 72 29844 7494 gpu/drm/radeon/radeon_drv.o

File size After adding 'const':
text data bss dec hex filename
28960 812 72 29844 7494 gpu/drm/radeon/radeon_drv.o

---
 drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
index e25cb51..b079937 100644
@@ -298,7 +298,7 @@ module_param_named(uvd, radeon_uvd, int, 0444);
 MODULE_PARM_DESC(vce, "vce enable/disable vce support (1 = enable, 0 = disable)");
 module_param_named(vce, radeon_vce, int, 0444);
 
-static struct pci_device_id pciidlist[] = {
+static const struct pci_device_id pciidlist[] = {
 	radeon_PCI_IDS
 };
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/5] drm: radeon: constify pci_device_id.

Am 15.07.2017 um 09:12 schrieb Arvind Yadav:

Quoted 8 lines

pci_device_id are not supposed to change at runtime. All functions working with pci_device_id provided by <linux/pci.h> work with const pci_device_id. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
6560 23212 72 29844 7494 gpu/drm/radeon/radeon_drv.o

Quoted 5 lines

File size After adding 'const':
text data bss dec hex filename
28960 812 72 29844 7494 gpu/drm/radeon/radeon_drv.o

Impressive result for such a simple change.

Patch is Reviewed-by: Christian König <[email protected]>

Are the PCI IDs already const in amdgpu or do we need a similar patch there as well? I only see patch 1 of 5 in my inbox.

Christian.

Quoted 9 lines
---
  drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_drv.c +0 -0
index e25cb51..b079937 100644

drivers/gpu/drm/radeon/radeon_drv.c module_param_named(uvd, radeon_uvd, int, 0444); · line 304

Quoted 8 lines
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -298,7 +298,7 @@ module_param_named(uvd, radeon_uvd, int, 0444);
  MODULE_PARM_DESC(vce, "vce enable/disable vce support (1 = enable, 0 = disable)");
  module_param_named(vce, radeon_vce, int, 0444);
 
-static struct pci_device_id pciidlist[] = {
+static const struct pci_device_id pciidlist[] = {
  	radeon_PCI_IDS
  };
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#3 lore raw

Re: [PATCH 1/5] drm: radeon: constify pci_device_id.

Hi Christian,

Quoted 15 lines · Christian König

Am 15.07.2017 um 09:12 schrieb Arvind Yadav:

Quoted 14 lines

pci_device_id are not supposed to change at runtime. All functions working with pci_device_id provided by <linux/pci.h> work with const pci_device_id. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
6560 23212 72 29844 7494
gpu/drm/radeon/radeon_drv.o

File size After adding 'const':
text data bss dec hex filename
28960 812 72 29844 7494
gpu/drm/radeon/radeon_drv.o

Quoted 7 lines
Quoted 1 line

Impressive result for such a simple change.

Patch is Reviewed-by: Christian König <[email protected]>

Are the PCI IDs already const in amdgpu or do we need a similar patch there as well? I only see patch 1 of 5 in my inbox.

I have send all gpu patch to David Airlie. Please check with him.

Quoted 7 lines

Christian.

Quoted 4 lines
---
  drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

drivers/gpu/drm/radeon/radeon_drv.c module_param_named(uvd, radeon_uvd, int, 0444); · line 304

Quoted 12 lines
drivers/gpu/drm/radeon/radeon_drv.c +1 -0
index e25cb51..b079937 100644
@@ -298,7 +298,7 @@ module_param_named(uvd, radeon_uvd, int, 0444);
  MODULE_PARM_DESC(vce, "vce enable/disable vce support (1 = enable, 
 0 = disable)");
  module_param_named(vce, radeon_vce, int, 0444);
  -static struct pci_device_id pciidlist[] = {
+static const struct pci_device_id pciidlist[] = {
      radeon_PCI_IDS
  };

Regards,
~arvind

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel