* [PATCH] powerpc/eeh: make eeh_ops structures _ro_after_init
@ 2017-10-13 13:04 Bhumika Goyal
2017-10-13 16:08 ` Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Bhumika Goyal @ 2017-10-13 13:04 UTC (permalink / raw)
To: julia.lawall, ruscur, benh, paulus, mpe, linuxppc-dev,
linux-kernel
Cc: Bhumika Goyal
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.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +-
arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 4650fb2..d2a53df 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -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,
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 6b812ad..6fedfc9 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -684,7 +684,7 @@ static int pseries_eeh_write_config(struct pci_dn *pdn, int where, int size, u32
return 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/eeh: make eeh_ops structures _ro_after_init
2017-10-13 13:04 [PATCH] powerpc/eeh: make eeh_ops structures _ro_after_init Bhumika Goyal
@ 2017-10-13 16:08 ` Julia Lawall
2017-10-13 16:11 ` Bhumika Goyal
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2017-10-13 16:08 UTC (permalink / raw)
To: Bhumika Goyal; +Cc: ruscur, benh, paulus, mpe, linuxppc-dev, linux-kernel
On Fri, 13 Oct 2017, Bhumika Goyal wrote:
> 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.
I think they could be const.
julia
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
> arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +-
> arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
> index 4650fb2..d2a53df 100644
> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
> @@ -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,
> diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
> index 6b812ad..6fedfc9 100644
> --- a/arch/powerpc/platforms/pseries/eeh_pseries.c
> +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
> @@ -684,7 +684,7 @@ static int pseries_eeh_write_config(struct pci_dn *pdn, int where, int size, u32
> return 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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/eeh: make eeh_ops structures _ro_after_init
2017-10-13 16:08 ` Julia Lawall
@ 2017-10-13 16:11 ` Bhumika Goyal
0 siblings, 0 replies; 3+ messages in thread
From: Bhumika Goyal @ 2017-10-13 16:11 UTC (permalink / raw)
To: Julia Lawall
Cc: ruscur, benh, paulus, mpe, linuxppc-dev,
Linux Kernel Mailing List
On Fri, Oct 13, 2017 at 6:08 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Fri, 13 Oct 2017, Bhumika Goyal wrote:
>
>> 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.
>
> I think they could be const.
>
Yes. I will send a patch for const.
> julia
>
>> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
>> ---
>> arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +-
>> arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
>> index 4650fb2..d2a53df 100644
>> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
>> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
>> @@ -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,
>> diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
>> index 6b812ad..6fedfc9 100644
>> --- a/arch/powerpc/platforms/pseries/eeh_pseries.c
>> +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
>> @@ -684,7 +684,7 @@ static int pseries_eeh_write_config(struct pci_dn *pdn, int where, int size, u32
>> return 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
>>
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-13 16:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 13:04 [PATCH] powerpc/eeh: make eeh_ops structures _ro_after_init Bhumika Goyal
2017-10-13 16:08 ` Julia Lawall
2017-10-13 16:11 ` Bhumika Goyal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).