]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - drivers/rtc/rtc-armada38x.c
rtc: armada38x: make struct rtc_class_ops const
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 11 Jan 2017 10:16:58 +0000 (10:16 +0000)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 12 Jan 2017 11:33:58 +0000 (12:33 +0100)
commitd748c9810be2d6a570aad0390463c9ac4336b161
treec1276c1fb30c9b839048bc2dd371dcb173602189
parent8bc57e7f11971665b4a7886305dffcd27213d718
rtc: armada38x: make struct rtc_class_ops const

Armada38x wants to modify its rtc_class_ops to remove the interrupt
handling when there is no usable interrupt, but this means we leave
function pointers in writable memory.

Since rtc_class_ops is small, arrange to have two instances, one for
when we have interrupts, and one for when we have none, both marked
const.  This allows the compiler to place them in read-only memory,
which is better than placing them in __ro_after_init.

Thanks to Bhumika Goyal <bhumirks@gmail.com> for pointing out that
the structure was writable and submitting a patch to add
__ro_after_init.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-armada38x.c