Skip to contentSkip to conversation

constify parisc parisc_device_id

PATCH In review Arvind Yadav 2 participants 10 messages Aug 19, 2017 – Aug 21, 2017 PA-RISC architecture

lore
Share & tools
lore
#0 lore raw

cover constify parisc parisc_device_id

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

Arvind Yadav (8):
[PATCH 1/8] parisc: asp: constify parisc_device_id [PATCH 2/8] parisc: ccio: constify parisc_device_id [PATCH 3/8] parisc: dino: constify parisc_device_id [PATCH 4/8] parisc: hppb: constify parisc_device_id [PATCH 5/8] parisc: lasi: constify parisc_device_id [PATCH 6/8] parisc: lba_pci: constify parisc_device_id [PATCH 7/8] parisc: sba_iommu: constify parisc_device_id [PATCH 8/8] parisc: wax: constify parisc_device_id

 drivers/parisc/asp.c         | 2 +-
 drivers/parisc/ccio-rm-dma.c | 2 +-
 drivers/parisc/dino.c        | 2 +-
 drivers/parisc/hppb.c        | 2 +-
 drivers/parisc/lasi.c        | 2 +-
 drivers/parisc/lba_pci.c     | 2 +-
 drivers/parisc/sba_iommu.c   | 2 +-
 drivers/parisc/wax.c         | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/8 parisc: asp: constify parisc_device_id

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/asp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/asp.c +1 -1
index 6a1ab25..4ad32e1 100644
@@ -118,7 +118,7 @@ static int __init asp_init_chip(struct parisc_device *dev)
 	return ret;
 }
 
-static struct parisc_device_id asp_tbl[] = {
+static const struct parisc_device_id asp_tbl[] = {
 	{ HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00070 },
 	{ 0, }
 };
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/8 parisc: ccio: constify parisc_device_id

In reply to Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/ccio-rm-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/ccio-rm-dma.c +1 -1
index 1bf9880..fc8fbb5 100644
@@ -184,7 +184,7 @@ ccio_probe(struct parisc_device *dev)
 	return 0;
 }
 
-static struct parisc_device_id ccio_tbl[] = {
+static const struct parisc_device_id ccio_tbl[] = {
 	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, U2_BC_GSC, 0xc },
 	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, UTURN_BC_GSC, 0xc },
 	{ 0, }
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/8 parisc: dino: constify parisc_device_id

In reply to Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/dino.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/dino.c +1 -1
index 5c63b92..19c5c9a 100644
@@ -1022,7 +1022,7 @@ static int __init dino_probe(struct parisc_device *dev)
  * and 725 firmware misreport it as 0x08080 for no adequately explained
  * reason.
  */
-static struct parisc_device_id dino_tbl[] = {
+static const struct parisc_device_id dino_tbl[] = {
 	{ HPHW_A_DMA, HVERSION_REV_ANY_ID, 0x004, 0x0009D },/* Card-mode Dino */
 	{ HPHW_A_DMA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x08080 }, /* XXX */
 	{ HPHW_BRIDGE, HVERSION_REV_ANY_ID, 0x680, 0xa }, /* Bridge-mode Dino */
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/8 parisc: hppb: constify parisc_device_id

In reply to Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/hppb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/hppb.c +1 -1
index 898208e..261f826 100644
@@ -81,7 +81,7 @@ static int hppb_probe(struct parisc_device *dev)
         return 0;
 }
 
-static struct parisc_device_id hppb_tbl[] = {
+static const struct parisc_device_id hppb_tbl[] = {
         { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, /* E25 and K */
         { HPHW_BCPORT, 0x0, 0x501, 0xc }, /* E35 */
         { HPHW_BCPORT, 0x0, 0x502, 0xc }, /* E45 */
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/8 parisc: lasi: constify parisc_device_id

In reply to Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/lasi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/lasi.c +1 -1
index e65727c..b77cf1e 100644
@@ -227,7 +227,7 @@ static int __init lasi_init_chip(struct parisc_device *dev)
 	return ret;
 }
 
-static struct parisc_device_id lasi_tbl[] = {
+static const struct parisc_device_id lasi_tbl[] = {
 	{ HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00081 },
 	{ 0, }
 };
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/8 parisc: lba_pci: constify parisc_device_id

In reply to Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/lba_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/lba_pci.c +1 -1
index bc286cb..9d6179e 100644
@@ -1613,7 +1613,7 @@ lba_driver_probe(struct parisc_device *dev)
 	return 0;
 }
 
-static struct parisc_device_id lba_tbl[] = {
+static const struct parisc_device_id lba_tbl[] = {
 	{ HPHW_BRIDGE, HVERSION_REV_ANY_ID, ELROY_HVERS, 0xa },
 	{ HPHW_BRIDGE, HVERSION_REV_ANY_ID, MERCURY_HVERS, 0xa },
 	{ HPHW_BRIDGE, HVERSION_REV_ANY_ID, QUICKSILVER_HVERS, 0xa },
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/8 parisc: sba_iommu: constify parisc_device_id

In reply to Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/sba_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/sba_iommu.c +1 -1
index 4086f79..1bad85c 100644
@@ -1905,7 +1905,7 @@ static const struct file_operations sba_proc_bitmap_fops = {
 };
 #endif /* CONFIG_PROC_FS */
 
-static struct parisc_device_id sba_tbl[] = {
+static const struct parisc_device_id sba_tbl[] = {
 	{ HPHW_IOA, HVERSION_REV_ANY_ID, ASTRO_RUNWAY_PORT, 0xb },
 	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, IKE_MERCED_PORT, 0xc },
 	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, REO_MERCED_PORT, 0xc },
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/8 parisc: wax: constify parisc_device_id

In reply to Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

---
 drivers/parisc/wax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/wax.c +1 -1
index da9d5ad..e2d5238 100644
@@ -125,7 +125,7 @@ static int __init wax_init_chip(struct parisc_device *dev)
 	return ret;
 }
 
-static struct parisc_device_id wax_tbl[] = {
+static const struct parisc_device_id wax_tbl[] = {
   	{ HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008e },
 	{ 0, }
 };
Signature · 1 line
2.7.4
maintainer
#9 lore raw
In reply to Arvind Yadav

Hi Arvind,

Quoted 3 lines · Arvind Yadav

parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const.

Basically your patches are correct, but those structs aren't used after bootup any longer.
So, they are much better placed in the __initconst or __initdata sections so that they get dropped before the kernel enters userspace. Changing it to __initconst includes more changes to those files than just changing one line.

So, I won't apply your patches.
Instead I've hacked up new versions in my tree which move those to __init* sections.

Anyway, thanks for your patches!

Helge

Quoted 20 lines

Arvind Yadav (8):
[PATCH 1/8] parisc: asp: constify parisc_device_id [PATCH 2/8] parisc: ccio: constify parisc_device_id [PATCH 3/8] parisc: dino: constify parisc_device_id [PATCH 4/8] parisc: hppb: constify parisc_device_id [PATCH 5/8] parisc: lasi: constify parisc_device_id [PATCH 6/8] parisc: lba_pci: constify parisc_device_id [PATCH 7/8] parisc: sba_iommu: constify parisc_device_id [PATCH 8/8] parisc: wax: constify parisc_device_id

 drivers/parisc/asp.c         | 2 +-
 drivers/parisc/ccio-rm-dma.c | 2 +-
 drivers/parisc/dino.c        | 2 +-
 drivers/parisc/hppb.c        | 2 +-
 drivers/parisc/lasi.c        | 2 +-
 drivers/parisc/lba_pci.c     | 2 +-
 drivers/parisc/sba_iommu.c   | 2 +-
 drivers/parisc/wax.c         | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)