clocksource: add __ro_after_init to cyclecounter
Subsystems (2)
PATCH 1/1 clocksource: add __ro_after_init to cyclecounter
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by arch_counter_register. Apart from initialization in arch_counter_register it is also passed as an argument to the function timecounter_init but this argument is of type const. Therefore, add __ro_after_init to its declaration.
--- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/arm_arch_timer.c +1 -1
@@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct cyclecounter *cc) .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static struct cyclecounter cyclecounter = { +static struct cyclecounter cyclecounter__ro_after_init = { .read = arch_counter_read_cc, .mask =CLOCKSOURCE_MASK (56 ), };
Signature · 1 line
1.9.1
Quoted 6 lines · Bhumika Goyal
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by
arch_counter_register. Apart from initialization inarch_counter_registerit is also passed as an argument to the functiontimecounter_initbut this argument is of type const. Therefore, add__ro_after_initto its declaration.
I think adding __ro_after_init is fine if this struct is never modified after init. But the reference in the commit log to the constness of the timecounter_init() argument makes no sense: that only means timecounter_init() will not modify the object, which allows pointers to const objects to be passed to it as well. The opposite is not true, though: there is no requirement whatsoever that objects passed into const pointer arguments should be const themselves.
Quoted 26 lines
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clocksource/arm_arch_timer.c +1
-2@@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct cyclecounter *cc) .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static struct cyclecounter cyclecounter = { +static struct cyclecounter cyclecounter__ro_after_init = { .read = arch_counter_read_cc, .mask =CLOCKSOURCE_MASK (56 ), }; --1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 8 lines · Ard Biesheuvel
Quoted 6 lines · Bhumika Goyal
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by
arch_counter_register. Apart from initialization inarch_counter_registerit is also passed as an argument to the functiontimecounter_initbut this argument is of type const. Therefore, add__ro_after_initto its declaration.
Quoted 7 lines
I think adding
__ro_after_initis fine if this struct is never modified after init. But the reference in the commit log to the constness of thetimecounter_init()argument makes no sense: that only meanstimecounter_init()will not modify the object, which allows pointers to const objects to be passed to it as well. The opposite is not true, though: there is no requirement whatsoever that objects passed into const pointer arguments should be const themselves.
Indeed.
Quoted 8 lines · Ard Biesheuvel
Quoted 6 lines · Bhumika Goyal
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by
arch_counter_register. Apart from initialization inarch_counter_registerit is also passed as an argument to the functiontimecounter_initbut this argument is of type const. Therefore, add__ro_after_initto its declaration.
Quoted 9 lines
I think adding
__ro_after_initis fine if this struct is never modified after init. But the reference in the commit log to the constness of thetimecounter_init()argument makes no sense: that only meanstimecounter_init()will not modify the object, which allows pointers to const objects to be passed to it as well. The opposite is not true, though: there is no requirement whatsoever that objects passed into const pointer arguments should be const themselves.
Yes, true. I will change the commit log and send a v2. Thanks for explaining.
Thanks,
Bhumika
Quoted 26 lines
Quoted 26 lines
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clocksource/arm_arch_timer.c +1
-2@@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct cyclecounter *cc) .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static struct cyclecounter cyclecounter = { +static struct cyclecounter cyclecounter__ro_after_init = { .read = arch_counter_read_cc, .mask =CLOCKSOURCE_MASK (56 ), }; --1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 20 lines · Bhumika Goyal
Quoted 8 lines · Ard Biesheuvel
Quoted 6 lines · Bhumika Goyal
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by
arch_counter_register. Apart from initialization inarch_counter_registerit is also passed as an argument to the functiontimecounter_initbut this argument is of type const. Therefore, add__ro_after_initto its declaration.Quoted 9 lines
I think adding
__ro_after_initis fine if this struct is never modified after init. But the reference in the commit log to the constness of thetimecounter_init()argument makes no sense: that only meanstimecounter_init()will not modify the object, which allows pointers to const objects to be passed to it as well. The opposite is not true, though: there is no requirement whatsoever that objects passed into const pointer arguments should be const themselves.
Quoted 1 line
Yes, true. I will change the commit log and send a v2. Thanks for explaining.
I've applied it already and fixed up the subject/changelog. You should have mail from tip-bot ...
Quoted 22 lines · Thomas Gleixner
Quoted 20 lines · Bhumika Goyal
Quoted 17 lines · Ard Biesheuvel
Quoted 6 lines · Bhumika Goyal
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by
arch_counter_register. Apart from initialization inarch_counter_registerit is also passed as an argument to the functiontimecounter_initbut this argument is of type const. Therefore, add__ro_after_initto its declaration.I think adding
__ro_after_initis fine if this struct is never modified after init. But the reference in the commit log to the constness of thetimecounter_init()argument makes no sense: that only meanstimecounter_init()will not modify the object, which allows pointers to const objects to be passed to it as well. The opposite is not true, though: there is no requirement whatsoever that objects passed into const pointer arguments should be const themselves.
Quoted 4 lines
Quoted 1 line
Yes, true. I will change the commit log and send a v2. Thanks for explaining.
I've applied it already and fixed up the subject/changelog. You should have mail from tip-bot ...
Okay. Thanks. I thought the patch is not applied yet because I haven't received a mail from tip-bot yet.
Thanks,
Bhumika
On Sun, Feb 12, 2017 at 07:56:41PM +0100, Thomas Gleixner wrote:
[ ... ]
Quoted 2 lines
I've applied it already and fixed up the subject/changelog. You should have mail from tip-bot ...
For the record, I did not receive the mails from the tip-bot when the patches from the PR were applied.
-- Daniel
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
On Sun, 12 Feb 2017, Bhumika Goyal wrote:
Please be more careful with your subject line. The prefix for this is definitely not 'clocksource'. git log would have told you the proper one:
clocksource/drivers/arm_arch_timer
'clocksource' is the general subsystem and used for system wide changes or core changes, but not for a particular driver.
Quoted 5 lines
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by
arch_counter_register. Apart from initialization inarch_counter_registerit is also passed as an argument to the functiontimecounter_initbut this argument is of type const. Therefore, add__ro_after_initto its declaration.
Other than that this is fine. I'll fix it up when applying.
Thanks,
tglx
Quoted 10 lines · Thomas Gleixner
On Sun, 12 Feb 2017, Bhumika Goyal wrote:
Please be more careful with your subject line. The prefix for this is definitely not 'clocksource'. git log would have told you the proper one:
clocksource/drivers/arm_arch_timer
'clocksource' is the general subsystem and used for system wide changes or core changes, but not for a particular driver.
I will be more careful about this in future.
Thanks,
Bhumika
Quoted 11 lines
Quoted 5 lines
The object cyclecounter of type cyclecounter is not getting modified after getting initialized by
arch_counter_register. Apart from initialization inarch_counter_registerit is also passed as an argument to the functiontimecounter_initbut this argument is of type const. Therefore, add__ro_after_initto its declaration.Other than that this is fine. I'll fix it up when applying.
Thanks,
tglx
tip-bot for Bhumika Goyal
merge bot[tip:timers/core] clocksource/drivers/arm_arch_timer:: Mark cyclecounter __ro_after_init
In reply to Bhumika Goyalclocksource/drivers/arm_arch_timer:: Mark cyclecounter __ro_after_init
Commit-ID: 3d837bc01c2153565333b2ce71d613b6e7cc761c Gitweb: http://git.kernel.org/tip/3d837bc01c2153565333b2ce71d613b6e7cc761c Author: Bhumika Goyal <[email protected]> AuthorDate: Sun, 12 Feb 2017 00:50:18 +0530 Committer: Thomas Gleixner <[email protected]> CommitDate: Sat, 11 Feb 2017 21:39:04 +0100
clocksource/drivers/arm_arch_timer:: Mark cyclecounter __ro_after_init
The object cyclecounter of type cyclecounter is only modified during initialization in arch_counter_register. So it can be marked __ro_after_init.
--- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/arm_arch_timer.c +1 -1
@@ -646,7 +646,7 @@ static struct clocksource clocksource_counter = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static struct cyclecounter cyclecounter = { +static struct cyclecounter cyclecounter__ro_after_init = { .read = arch_counter_read_cc, .mask =CLOCKSOURCE_MASK (56 ), };