All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM: davinci: make function argument and structure const
@ 2017-10-16 10:08 ` Bhumika Goyal
  0 siblings, 0 replies; 10+ messages in thread
From: Bhumika Goyal @ 2017-10-16 10:08 UTC (permalink / raw)
  To: julia.lawall, nsekhar, khilman, linux, linux-arm-kernel, linux-kernel
  Cc: Bhumika Goyal

Make the function argument of davinci_common_init const. 
After doing this change make the structures davinci_soc_info const.

Bhumika Goyal (2):
  ARM: davinci: make the function argument as const
  ARM: davinci: make davinci_soc_info structures const

 arch/arm/mach-davinci/common.c              | 2 +-
 arch/arm/mach-davinci/da830.c               | 2 +-
 arch/arm/mach-davinci/da850.c               | 2 +-
 arch/arm/mach-davinci/dm355.c               | 2 +-
 arch/arm/mach-davinci/dm365.c               | 2 +-
 arch/arm/mach-davinci/dm644x.c              | 2 +-
 arch/arm/mach-davinci/dm646x.c              | 2 +-
 arch/arm/mach-davinci/include/mach/common.h | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 0/2] ARM: davinci: make function argument and structure const
@ 2017-10-16 10:08 ` Bhumika Goyal
  0 siblings, 0 replies; 10+ messages in thread
From: Bhumika Goyal @ 2017-10-16 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

Make the function argument of davinci_common_init const. 
After doing this change make the structures davinci_soc_info const.

Bhumika Goyal (2):
  ARM: davinci: make the function argument as const
  ARM: davinci: make davinci_soc_info structures const

 arch/arm/mach-davinci/common.c              | 2 +-
 arch/arm/mach-davinci/da830.c               | 2 +-
 arch/arm/mach-davinci/da850.c               | 2 +-
 arch/arm/mach-davinci/dm355.c               | 2 +-
 arch/arm/mach-davinci/dm365.c               | 2 +-
 arch/arm/mach-davinci/dm644x.c              | 2 +-
 arch/arm/mach-davinci/dm646x.c              | 2 +-
 arch/arm/mach-davinci/include/mach/common.h | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] ARM: davinci: make the function argument as const
  2017-10-16 10:08 ` Bhumika Goyal
@ 2017-10-16 10:08   ` Bhumika Goyal
  -1 siblings, 0 replies; 10+ messages in thread
From: Bhumika Goyal @ 2017-10-16 10:08 UTC (permalink / raw)
  To: julia.lawall, nsekhar, khilman, linux, linux-arm-kernel, linux-kernel
  Cc: Bhumika Goyal

Make the function argument of the function davinci_common_init
as const as it's memory contents are only copied during a
memcpy call. So, the fields of the structure to which the argument
soc_info points to never gets modified and therefore the argument can
be made const.
Add const to the prototype too.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/arm/mach-davinci/common.c              | 2 +-
 arch/arm/mach-davinci/include/mach/common.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index 9f9fbfa..bcb6a7b 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -77,7 +77,7 @@ static int __init davinci_init_id(struct davinci_soc_info *soc_info)
 	return -EINVAL;
 }
 
-void __init davinci_common_init(struct davinci_soc_info *soc_info)
+void __init davinci_common_init(const struct davinci_soc_info *soc_info)
 {
 	int ret;
 
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 037aa66..433a008 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -79,7 +79,7 @@ struct davinci_soc_info {
 
 extern struct davinci_soc_info davinci_soc_info;
 
-extern void davinci_common_init(struct davinci_soc_info *soc_info);
+extern void davinci_common_init(const struct davinci_soc_info *soc_info);
 extern void davinci_init_ide(void);
 void davinci_restart(enum reboot_mode mode, const char *cmd);
 void davinci_init_late(void);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/2] ARM: davinci: make the function argument as const
@ 2017-10-16 10:08   ` Bhumika Goyal
  0 siblings, 0 replies; 10+ messages in thread
From: Bhumika Goyal @ 2017-10-16 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

Make the function argument of the function davinci_common_init
as const as it's memory contents are only copied during a
memcpy call. So, the fields of the structure to which the argument
soc_info points to never gets modified and therefore the argument can
be made const.
Add const to the prototype too.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/arm/mach-davinci/common.c              | 2 +-
 arch/arm/mach-davinci/include/mach/common.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index 9f9fbfa..bcb6a7b 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -77,7 +77,7 @@ static int __init davinci_init_id(struct davinci_soc_info *soc_info)
 	return -EINVAL;
 }
 
-void __init davinci_common_init(struct davinci_soc_info *soc_info)
+void __init davinci_common_init(const struct davinci_soc_info *soc_info)
 {
 	int ret;
 
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 037aa66..433a008 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -79,7 +79,7 @@ struct davinci_soc_info {
 
 extern struct davinci_soc_info davinci_soc_info;
 
-extern void davinci_common_init(struct davinci_soc_info *soc_info);
+extern void davinci_common_init(const struct davinci_soc_info *soc_info);
 extern void davinci_init_ide(void);
 void davinci_restart(enum reboot_mode mode, const char *cmd);
 void davinci_init_late(void);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] ARM: davinci: make davinci_soc_info structures const
  2017-10-16 10:08 ` Bhumika Goyal
@ 2017-10-16 10:08   ` Bhumika Goyal
  -1 siblings, 0 replies; 10+ messages in thread
From: Bhumika Goyal @ 2017-10-16 10:08 UTC (permalink / raw)
  To: julia.lawall, nsekhar, khilman, linux, linux-arm-kernel, linux-kernel
  Cc: Bhumika Goyal

This is a followup patch for [PATCH 1/2].

Make the structures const as they are either passed to the function
davinci_common_init having the argument as const or their field cpu_clks
of type struct clk_lookup * is passed to the function davinci_clk_init.
So, the fields are never modified and the structures can be const. 

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/arm/mach-davinci/da830.c  | 2 +-
 arch/arm/mach-davinci/da850.c  | 2 +-
 arch/arm/mach-davinci/dm355.c  | 2 +-
 arch/arm/mach-davinci/dm365.c  | 2 +-
 arch/arm/mach-davinci/dm644x.c | 2 +-
 arch/arm/mach-davinci/dm646x.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index bd88470..ed0b700 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1194,7 +1194,7 @@ int __init da830_register_gpio(void)
 	.clocksource_id	= T0_BOT,
 };
 
-static struct davinci_soc_info davinci_soc_info_da830 = {
+static const struct davinci_soc_info davinci_soc_info_da830 = {
 	.io_desc		= da830_io_desc,
 	.io_desc_num		= ARRAY_SIZE(da830_io_desc),
 	.jtag_id_reg		= DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 07d6f0e..04a58a3 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1347,7 +1347,7 @@ int __init da850_register_gpio(void)
 	return da8xx_register_gpio(&da850_gpio_platform_data);
 }
 
-static struct davinci_soc_info davinci_soc_info_da850 = {
+static const struct davinci_soc_info davinci_soc_info_da850 = {
 	.io_desc		= da850_io_desc,
 	.io_desc_num		= ARRAY_SIZE(da850_io_desc),
 	.jtag_id_reg		= DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index bd50367..938747f 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -1006,7 +1006,7 @@ struct platform_device dm355_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm355 = {
+static const struct davinci_soc_info davinci_soc_info_dm355 = {
 	.io_desc		= dm355_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm355_io_desc),
 	.jtag_id_reg		= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 8be04ec..bcf1494 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1108,7 +1108,7 @@ struct platform_device dm365_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm365 = {
+static const struct davinci_soc_info davinci_soc_info_dm365 = {
 	.io_desc		= dm365_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm365_io_desc),
 	.jtag_id_reg		= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index b437c37..6b41e1c 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -899,7 +899,7 @@ struct platform_device dm644x_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm644x = {
+static const struct davinci_soc_info davinci_soc_info_dm644x = {
 	.io_desc		= dm644x_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm644x_io_desc),
 	.jtag_id_reg		= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index da21353..b72e04a 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -882,7 +882,7 @@ struct platform_device dm646x_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm646x = {
+static const struct davinci_soc_info davinci_soc_info_dm646x = {
 	.io_desc		= dm646x_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm646x_io_desc),
 	.jtag_id_reg		= 0x01c40028,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] ARM: davinci: make davinci_soc_info structures const
@ 2017-10-16 10:08   ` Bhumika Goyal
  0 siblings, 0 replies; 10+ messages in thread
From: Bhumika Goyal @ 2017-10-16 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

This is a followup patch for [PATCH 1/2].

Make the structures const as they are either passed to the function
davinci_common_init having the argument as const or their field cpu_clks
of type struct clk_lookup * is passed to the function davinci_clk_init.
So, the fields are never modified and the structures can be const. 

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/arm/mach-davinci/da830.c  | 2 +-
 arch/arm/mach-davinci/da850.c  | 2 +-
 arch/arm/mach-davinci/dm355.c  | 2 +-
 arch/arm/mach-davinci/dm365.c  | 2 +-
 arch/arm/mach-davinci/dm644x.c | 2 +-
 arch/arm/mach-davinci/dm646x.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index bd88470..ed0b700 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1194,7 +1194,7 @@ int __init da830_register_gpio(void)
 	.clocksource_id	= T0_BOT,
 };
 
-static struct davinci_soc_info davinci_soc_info_da830 = {
+static const struct davinci_soc_info davinci_soc_info_da830 = {
 	.io_desc		= da830_io_desc,
 	.io_desc_num		= ARRAY_SIZE(da830_io_desc),
 	.jtag_id_reg		= DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 07d6f0e..04a58a3 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1347,7 +1347,7 @@ int __init da850_register_gpio(void)
 	return da8xx_register_gpio(&da850_gpio_platform_data);
 }
 
-static struct davinci_soc_info davinci_soc_info_da850 = {
+static const struct davinci_soc_info davinci_soc_info_da850 = {
 	.io_desc		= da850_io_desc,
 	.io_desc_num		= ARRAY_SIZE(da850_io_desc),
 	.jtag_id_reg		= DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index bd50367..938747f 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -1006,7 +1006,7 @@ struct platform_device dm355_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm355 = {
+static const struct davinci_soc_info davinci_soc_info_dm355 = {
 	.io_desc		= dm355_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm355_io_desc),
 	.jtag_id_reg		= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 8be04ec..bcf1494 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1108,7 +1108,7 @@ struct platform_device dm365_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm365 = {
+static const struct davinci_soc_info davinci_soc_info_dm365 = {
 	.io_desc		= dm365_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm365_io_desc),
 	.jtag_id_reg		= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index b437c37..6b41e1c 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -899,7 +899,7 @@ struct platform_device dm644x_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm644x = {
+static const struct davinci_soc_info davinci_soc_info_dm644x = {
 	.io_desc		= dm644x_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm644x_io_desc),
 	.jtag_id_reg		= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index da21353..b72e04a 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -882,7 +882,7 @@ struct platform_device dm646x_serial_device[] = {
 	}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm646x = {
+static const struct davinci_soc_info davinci_soc_info_dm646x = {
 	.io_desc		= dm646x_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm646x_io_desc),
 	.jtag_id_reg		= 0x01c40028,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] ARM: davinci: make the function argument as const
  2017-10-16 10:08   ` Bhumika Goyal
@ 2017-11-27 12:14     ` Sekhar Nori
  -1 siblings, 0 replies; 10+ messages in thread
From: Sekhar Nori @ 2017-11-27 12:14 UTC (permalink / raw)
  To: Bhumika Goyal, julia.lawall, khilman, linux, linux-arm-kernel,
	linux-kernel

On Monday 16 October 2017 03:38 PM, Bhumika Goyal wrote:
> Make the function argument of the function davinci_common_init
> as const as it's memory contents are only copied during a
> memcpy call. So, the fields of the structure to which the argument
> soc_info points to never gets modified and therefore the argument can
> be made const.
> Add const to the prototype too.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

The subject line is written too generically. I changed that to

"
ARM: davinci: make argument to davinci_common_init() as const
"

while applying to v4.16/fixes-non-critical

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] ARM: davinci: make the function argument as const
@ 2017-11-27 12:14     ` Sekhar Nori
  0 siblings, 0 replies; 10+ messages in thread
From: Sekhar Nori @ 2017-11-27 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 16 October 2017 03:38 PM, Bhumika Goyal wrote:
> Make the function argument of the function davinci_common_init
> as const as it's memory contents are only copied during a
> memcpy call. So, the fields of the structure to which the argument
> soc_info points to never gets modified and therefore the argument can
> be made const.
> Add const to the prototype too.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

The subject line is written too generically. I changed that to

"
ARM: davinci: make argument to davinci_common_init() as const
"

while applying to v4.16/fixes-non-critical

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] ARM: davinci: make davinci_soc_info structures const
  2017-10-16 10:08   ` Bhumika Goyal
@ 2017-11-27 12:42     ` Sekhar Nori
  -1 siblings, 0 replies; 10+ messages in thread
From: Sekhar Nori @ 2017-11-27 12:42 UTC (permalink / raw)
  To: Bhumika Goyal, julia.lawall, khilman, linux, linux-arm-kernel,
	linux-kernel

On Monday 16 October 2017 03:38 PM, Bhumika Goyal wrote:
> This is a followup patch for [PATCH 1/2].

This line is not relevant once the patch gets committed.

> 
> Make the structures const as they are either passed to the function

Patch description should be readable independent of subject line so we
need to be more specific than "the structures"

> davinci_common_init having the argument as const or their field cpu_clks
> of type struct clk_lookup * is passed to the function davinci_clk_init.
> So, the fields are never modified and the structures can be const. 
> 
> Done using Coccinelle.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

I made fixes to commit description per above and here is the updated text.

"
ARM: davinci: make davinci_soc_info structures const

Make davinci_soc_info structures const as they are either passed to the
function davinci_common_init having the argument as const or their field
cpu_clks of type struct clk_lookup * is passed to the function
davinci_clk_init.

So, the fields are never modified and the structures can be const.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
[nsekhar@ti.com: minor commit message adjustment]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
"

With that I applied the patch to v4.16/fixes-non-critical

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] ARM: davinci: make davinci_soc_info structures const
@ 2017-11-27 12:42     ` Sekhar Nori
  0 siblings, 0 replies; 10+ messages in thread
From: Sekhar Nori @ 2017-11-27 12:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 16 October 2017 03:38 PM, Bhumika Goyal wrote:
> This is a followup patch for [PATCH 1/2].

This line is not relevant once the patch gets committed.

> 
> Make the structures const as they are either passed to the function

Patch description should be readable independent of subject line so we
need to be more specific than "the structures"

> davinci_common_init having the argument as const or their field cpu_clks
> of type struct clk_lookup * is passed to the function davinci_clk_init.
> So, the fields are never modified and the structures can be const. 
> 
> Done using Coccinelle.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

I made fixes to commit description per above and here is the updated text.

"
ARM: davinci: make davinci_soc_info structures const

Make davinci_soc_info structures const as they are either passed to the
function davinci_common_init having the argument as const or their field
cpu_clks of type struct clk_lookup * is passed to the function
davinci_clk_init.

So, the fields are never modified and the structures can be const.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
[nsekhar at ti.com: minor commit message adjustment]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
"

With that I applied the patch to v4.16/fixes-non-critical

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-11-27 12:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 10:08 [PATCH 0/2] ARM: davinci: make function argument and structure const Bhumika Goyal
2017-10-16 10:08 ` Bhumika Goyal
2017-10-16 10:08 ` [PATCH 1/2] ARM: davinci: make the function argument as const Bhumika Goyal
2017-10-16 10:08   ` Bhumika Goyal
2017-11-27 12:14   ` Sekhar Nori
2017-11-27 12:14     ` Sekhar Nori
2017-10-16 10:08 ` [PATCH 2/2] ARM: davinci: make davinci_soc_info structures const Bhumika Goyal
2017-10-16 10:08   ` Bhumika Goyal
2017-11-27 12:42   ` Sekhar Nori
2017-11-27 12:42     ` Sekhar Nori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.