powerpc/eeh: make eeh_ops structures _ro_after_init
Subsystems (2)
PATCH 1/1 powerpc/eeh: make eeh_ops structures _ro_after_init
These structures are passed to the eeh_ops_register function during the initialization phase. There they get stored in a structure variable which only makes function calls through function pointers. There is no other usage of these eeh_ops structures and their fields are never modified after init phase. So, make them __ro_after_init.
--- arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/powernv/eeh-powernv.c +1 -1
@@ -1731,7 +1731,7 @@ static int pnv_eeh_restore_config(struct pci_dn *pdn)return 0 ; } -static struct eeh_ops pnv_eeh_ops = { +static struct eeh_ops pnv_eeh_ops__ro_after_init = { .name ="powernv" , .init = pnv_eeh_init, .probe = pnv_eeh_probe,
arch/powerpc/platforms/pseries/eeh_pseries.c +1 -1
@@ -684,7 +684,7 @@ static int pseries_eeh_write_config(struct pci_dn *pdn, int where, int size, u32return rtas_write_config (pdn, where, size, val); } -static struct eeh_ops pseries_eeh_ops = { +static struct eeh_ops pseries_eeh_ops__ro_after_init = { .name ="pseries" , .init = pseries_eeh_init, .probe = pseries_eeh_probe,
Signature · 1 line
1.9.1
Quoted 5 lines · Bhumika Goyal
These structures are passed to the
eeh_ops_registerfunction during the initialization phase. There they get stored in a structure variable which only makes function calls through function pointers. There is no other usage of theseeeh_opsstructures and their fields are never modified after init phase. So, make them__ro_after_init.
I think they could be const.
julia
Quoted 36 lines
Signed-off-by Bhumika Goyal <[email protected]>--- arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/powerpc/platforms/powernv/eeh-powernv.c +1
-1@@ -1731,7 +1731,7 @@ static int pnv_eeh_restore_config(struct pci_dn *pdn)return 0 ; } -static struct eeh_ops pnv_eeh_ops = { +static struct eeh_ops pnv_eeh_ops__ro_after_init = { .name ="powernv" , .init = pnv_eeh_init, .probe = pnv_eeh_probe,arch/powerpc/platforms/pseries/eeh_pseries.c +1
-2@@ -684,7 +684,7 @@ static int pseries_eeh_write_config(struct pci_dn *pdn, int where, int size, u32return rtas_write_config (pdn, where, size, val); } -static struct eeh_ops pseries_eeh_ops = { +static struct eeh_ops pseries_eeh_ops__ro_after_init = { .name ="pseries" , .init = pseries_eeh_init, .probe = pseries_eeh_probe, --1.9.1
Quoted 4 lines · Julia Lawall
On Fri, 13 Oct 2017, Bhumika Goyal wrote:
Quoted 8 lines
Quoted 5 lines
These structures are passed to the
eeh_ops_registerfunction during the initialization phase. There they get stored in a structure variable which only makes function calls through function pointers. There is no other usage of theseeeh_opsstructures and their fields are never modified after init phase. So, make them__ro_after_init.I think they could be const.
Yes. I will send a patch for const.
Quoted 38 lines
julia
Quoted 36 lines
Signed-off-by Bhumika Goyal <[email protected]>--- arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/powerpc/platforms/powernv/eeh-powernv.c +1
-1@@ -1731,7 +1731,7 @@ static int pnv_eeh_restore_config(struct pci_dn *pdn)return 0 ; } -static struct eeh_ops pnv_eeh_ops = { +static struct eeh_ops pnv_eeh_ops__ro_after_init = { .name ="powernv" , .init = pnv_eeh_init, .probe = pnv_eeh_probe,arch/powerpc/platforms/pseries/eeh_pseries.c +1
-2@@ -684,7 +684,7 @@ static int pseries_eeh_write_config(struct pci_dn *pdn, int where, int size, u32return rtas_write_config (pdn, where, size, val); } -static struct eeh_ops pseries_eeh_ops = { +static struct eeh_ops pseries_eeh_ops__ro_after_init = { .name ="pseries" , .init = pseries_eeh_init, .probe = pseries_eeh_probe, --1.9.1