Linux Kernels

rtc: sunxi: constify the data_year_param structure

This change “rtc: sunxi: constify the data_year_param structure” (commit 6ddab92) in Linux kernel is authored by LABBE Corentin <clabbe.montjoie [at] gmail.com> on Thu Nov 19 11:50:09 2015 +0100.

Description of "rtc: sunxi: constify the data_year_param structure"

The change “rtc: sunxi: constify the data_year_param structure” introduces changes as follows.

rtc: sunxi: constify the data_year_param structure

The data_year_param struct is never modified, so lets constify it.
This permit to remove cast since of_device_id is const also.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Linux kernel releases containing commit 6ddab92

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "rtc: sunxi: constify the data_year_param structure"

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/rtc/rtc-sunxi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 
diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c
index b4f35acc1e12..0c08a5b7dc61 100644
--- a/drivers/rtc/rtc-sunxi.c
+++ b/drivers/rtc/rtc-sunxi.c
@@ -133,7 +133,7 @@ struct sunxi_rtc_data_year {
 	unsigned char leap_shift;	/* bit shift to get the leap year */
 };
 
-static struct sunxi_rtc_data_year data_year_param[] = {
+static const struct sunxi_rtc_data_year data_year_param[] = {
 	[0] = {
 		.min		= 2010,
 		.max		= 2073,
@@ -151,7 +151,7 @@ static struct sunxi_rtc_data_year data_year_param[] = {
 struct sunxi_rtc_dev {
 	struct rtc_device *rtc;
 	struct device *dev;
-	struct sunxi_rtc_data_year *data_year;
+	const struct sunxi_rtc_data_year *data_year;
 	void __iomem *base;
 	int irq;
 };
@@ -468,7 +468,7 @@ static int sunxi_rtc_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Unable to setup RTC data\n");
 		return -ENODEV;
 	}
-	chip->data_year = (struct sunxi_rtc_data_year *) of_id->data;
+	chip->data_year = of_id->data;
 
 	/* clear the alarm count value */
 	writel(0, chip->base + SUNXI_ALRM_DHMS);

The commit for this change in Linux stable tree is 6ddab92 (patch).

Last modified: 2020/01/11 09:48