public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
@ 2009-12-13 23:59 re.emese
  2009-12-13 23:59 ` [PATCH 1/8] " re.emese
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, torvalds, akpm, benh, jason.wessel

From: Emese Revfy <re.emese@gmail.com>

Hello everyone!

The following patch series attempts to constify several structures
that hold function pointers. This is only the initial batch, there
are about over 150 candidate structures, some of which can be
constified as well, I plan to submit them in the future.

The list of constified structures in this series (* marks this thread):
acpi_dock_ops
address_space_operations
backlight_ops
block_device_operations
dma_map_ops
extent_io_ops
file_lock_operations
file_operations
hv_ops
intel_dvo_dev_ops
item_operations
iwl_ops
* kgdb_arch
kgdb_io
kset_uevent_ops
lock_manager_operations
microcode_ops
mtrr_ops
neigh_ops
nlmsvc_binding
pci_raw_ops
platform_hibernation_ops
platform_suspend_ops
snd_ac97_build_ops
sysfs_ops
usb_mon_operations
wd_ops

There are certain exceptions where a given instance of the structure
cannot be const, they are marked with a comment in the patch.

The patches compile fine with an allyesconfig kernel on i386 and x86_64.

Please let me know if any of these structures should not be constified
and any other issues you see with them.


Changelog:
----------
v1 -> v2
	- updated to linus-git-053fe57
	- extended comments with a reference to code that prevents constification
	- split up patches by subsystem as suggested by Greg KH, Jiri Slaby
	- added all Acked-by's received so far
	- removed patch for super_operations for now
	- removed patch for ptmx_fops

Thanks,
   Emese

 arch/arm/kernel/kgdb.c      |    2 +-
 arch/blackfin/kernel/kgdb.c |    2 +-
 arch/mips/kernel/kgdb.c     |    1 +
 arch/powerpc/kernel/kgdb.c  |    4 ++--
 arch/sh/kernel/kgdb.c       |    2 +-
 arch/sparc/kernel/kgdb_32.c |    2 +-
 arch/sparc/kernel/kgdb_64.c |    2 +-
 arch/x86/kernel/kgdb.c      |    2 +-
 include/linux/kgdb.h        |    2 +-
 9 files changed, 10 insertions(+), 9 deletions(-)


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

* [PATCH 1/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 2/8] " re.emese
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, linux, torvalds

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 arch/arm/kernel/kgdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index ba8ccfe..2dc34dc 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -190,7 +190,7 @@ void kgdb_arch_exit(void)
  * and we handle the normal undef case within the do_undefinstr
  * handler.
  */
-struct kgdb_arch arch_kgdb_ops = {
+const struct kgdb_arch arch_kgdb_ops = {
 #ifndef __ARMEB__
 	.gdb_bpt_instr		= {0xfe, 0xde, 0xff, 0xe7}
 #else /* ! __ARMEB__ */
-- 
1.6.5.3


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

* [PATCH 2/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
  2009-12-13 23:59 ` [PATCH 1/8] " re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 3/8] " re.emese
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, vapier, torvalds

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 arch/blackfin/kernel/kgdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c
index cce79d0..c406c85 100644
--- a/arch/blackfin/kernel/kgdb.c
+++ b/arch/blackfin/kernel/kgdb.c
@@ -428,7 +428,7 @@ int kgdb_arch_handle_exception(int vector, int signo,
 	return -1;		/* this means that we do not want to exit from the handler */
 }
 
-struct kgdb_arch arch_kgdb_ops = {
+const struct kgdb_arch arch_kgdb_ops = {
 	.gdb_bpt_instr = {0xa1},
 #ifdef CONFIG_SMP
 	.flags = KGDB_HW_BREAKPOINT|KGDB_THR_PROC_SWAP,
-- 
1.6.5.3


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

* [PATCH 3/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
  2009-12-13 23:59 ` [PATCH 1/8] " re.emese
  2009-12-13 23:59 ` [PATCH 2/8] " re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 4/8] " re.emese
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, jason.wessel, torvalds, mingo, akpm

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 include/linux/kgdb.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 6adcc29..360613c 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -259,7 +259,7 @@ struct kgdb_io {
 	void			(*post_exception) (void);
 };
 
-extern struct kgdb_arch		arch_kgdb_ops;
+extern const struct kgdb_arch arch_kgdb_ops;
 
 extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
 
-- 
1.6.5.3


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

* [PATCH 4/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
                   ` (2 preceding siblings ...)
  2009-12-13 23:59 ` [PATCH 3/8] " re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 5/8] " re.emese
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, ralf, torvalds

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 arch/mips/kernel/kgdb.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 50c9bb8..6d160e3 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -245,6 +245,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
 	return -1;
 }
 
+/* cannot be const, see kgdb_arch_init */
 struct kgdb_arch arch_kgdb_ops;
 
 /*
-- 
1.6.5.3


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

* [PATCH 1/1] Constify struct iwl_ops for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
                   ` (4 preceding siblings ...)
  2009-12-13 23:59 ` [PATCH 5/8] " re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 6/8] Constify struct kgdb_arch " re.emese
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, netdev, ilw, linville, reinette.chatre, yi.zhu

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 drivers/net/wireless/iwlwifi/iwl-1000.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-3945.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-6000.c |    4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 8414178..ea0150e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -140,7 +140,7 @@ static struct iwl_lib_ops iwl1000_lib = {
 	 },
 };
 
-static struct iwl_ops iwl1000_ops = {
+static const struct iwl_ops iwl1000_ops = {
 	.ucode = &iwl5000_ucode,
 	.lib = &iwl1000_lib,
 	.hcmd = &iwl5000_hcmd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 7da1dab..3708b5c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2811,7 +2811,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
 	.rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag,
 };
 
-static struct iwl_ops iwl3945_ops = {
+static const struct iwl_ops iwl3945_ops = {
 	.ucode = &iwl3945_ucode,
 	.lib = &iwl3945_lib,
 	.hcmd = &iwl3945_hcmd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 386513b..4cfb503 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2208,7 +2208,7 @@ static struct iwl_lib_ops iwl4965_lib = {
 	},
 };
 
-static struct iwl_ops iwl4965_ops = {
+static const struct iwl_ops iwl4965_ops = {
 	.ucode = &iwl4965_ucode,
 	.lib = &iwl4965_lib,
 	.hcmd = &iwl4965_hcmd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index e2f8615..bf44b29 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1554,7 +1554,7 @@ static struct iwl_lib_ops iwl5150_lib = {
 	 },
 };
 
-static struct iwl_ops iwl5000_ops = {
+static const struct iwl_ops iwl5000_ops = {
 	.ucode = &iwl5000_ucode,
 	.lib = &iwl5000_lib,
 	.hcmd = &iwl5000_hcmd,
@@ -1562,7 +1562,7 @@ static struct iwl_ops iwl5000_ops = {
 	.led = &iwlagn_led_ops,
 };
 
-static struct iwl_ops iwl5150_ops = {
+static const struct iwl_ops iwl5150_ops = {
 	.ucode = &iwl5000_ucode,
 	.lib = &iwl5150_lib,
 	.hcmd = &iwl5000_hcmd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 74e5710..4c19d72 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -252,7 +252,7 @@ static struct iwl_lib_ops iwl6000_lib = {
 	 },
 };
 
-static struct iwl_ops iwl6000_ops = {
+static const struct iwl_ops iwl6000_ops = {
 	.ucode = &iwl5000_ucode,
 	.lib = &iwl6000_lib,
 	.hcmd = &iwl5000_hcmd,
@@ -267,7 +267,7 @@ static struct iwl_hcmd_utils_ops iwl6050_hcmd_utils = {
 	.calc_rssi = iwl5000_calc_rssi,
 };
 
-static struct iwl_ops iwl6050_ops = {
+static const struct iwl_ops iwl6050_ops = {
 	.ucode = &iwl5000_ucode,
 	.lib = &iwl6000_lib,
 	.hcmd = &iwl5000_hcmd,
-- 
1.6.5.3


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

* [PATCH 5/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
                   ` (3 preceding siblings ...)
  2009-12-13 23:59 ` [PATCH 4/8] " re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 1/1] Constify struct iwl_ops " re.emese
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, davem, torvalds

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 arch/sparc/kernel/kgdb_32.c |    2 +-
 arch/sparc/kernel/kgdb_64.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c
index 04df4ed..55c4b6e 100644
--- a/arch/sparc/kernel/kgdb_32.c
+++ b/arch/sparc/kernel/kgdb_32.c
@@ -158,7 +158,7 @@ void kgdb_arch_exit(void)
 {
 }
 
-struct kgdb_arch arch_kgdb_ops = {
+const struct kgdb_arch arch_kgdb_ops = {
 	/* Breakpoint instruction: ta 0x7d */
 	.gdb_bpt_instr		= { 0x91, 0xd0, 0x20, 0x7d },
 };
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index f5a0fd4..d886f71 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -180,7 +180,7 @@ void kgdb_arch_exit(void)
 {
 }
 
-struct kgdb_arch arch_kgdb_ops = {
+const struct kgdb_arch arch_kgdb_ops = {
 	/* Breakpoint instruction: ta 0x72 */
 	.gdb_bpt_instr		= { 0x91, 0xd0, 0x20, 0x72 },
 };
-- 
1.6.5.3


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

* [PATCH 6/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
                   ` (5 preceding siblings ...)
  2009-12-13 23:59 ` [PATCH 1/1] Constify struct iwl_ops " re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 7/8] " re.emese
  2009-12-13 23:59 ` [PATCH 8/8] " re.emese
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, lethal, torvalds

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 arch/sh/kernel/kgdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/sh/kernel/kgdb.c b/arch/sh/kernel/kgdb.c
index 3e532d0..9faa306 100644
--- a/arch/sh/kernel/kgdb.c
+++ b/arch/sh/kernel/kgdb.c
@@ -271,7 +271,7 @@ void kgdb_arch_exit(void)
 {
 }
 
-struct kgdb_arch arch_kgdb_ops = {
+const struct kgdb_arch arch_kgdb_ops = {
 	/* Breakpoint instruction: trapa #0x3c */
 #ifdef CONFIG_CPU_LITTLE_ENDIAN
 	.gdb_bpt_instr		= { 0x3c, 0xc3 },
-- 
1.6.5.3


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

* [PATCH 7/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
                   ` (6 preceding siblings ...)
  2009-12-13 23:59 ` [PATCH 6/8] Constify struct kgdb_arch " re.emese
@ 2009-12-13 23:59 ` re.emese
  2009-12-13 23:59 ` [PATCH 8/8] " re.emese
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, mingo, hpa, tglx, akpm, adobriyan, torvalds

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 arch/x86/kernel/kgdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index dd74fe7..d1bc0f1 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -582,7 +582,7 @@ unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs)
 	return instruction_pointer(regs);
 }
 
-struct kgdb_arch arch_kgdb_ops = {
+const struct kgdb_arch arch_kgdb_ops = {
 	/* Breakpoint instruction: */
 	.gdb_bpt_instr		= { 0xcc },
 	.flags			= KGDB_HW_BREAKPOINT,
-- 
1.6.5.3


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

* [PATCH 8/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
  2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
                   ` (7 preceding siblings ...)
  2009-12-13 23:59 ` [PATCH 7/8] " re.emese
@ 2009-12-13 23:59 ` re.emese
  8 siblings, 0 replies; 10+ messages in thread
From: re.emese @ 2009-12-13 23:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, benh, torvalds, jkosina

From: Emese Revfy <re.emese@gmail.com>


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 arch/powerpc/kernel/kgdb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index b6bd1ea..1e433f7 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -126,7 +126,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
 	if (kgdb_handle_exception(0, SIGTRAP, 0, regs) != 0)
 		return 0;
 
-	if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
+	if (*(u32 *) (regs->nip) == *(const u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
 		regs->nip += 4;
 
 	return 1;
@@ -353,7 +353,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
 /*
  * Global data
  */
-struct kgdb_arch arch_kgdb_ops = {
+const struct kgdb_arch arch_kgdb_ops = {
 	.gdb_bpt_instr = {0x7d, 0x82, 0x10, 0x08},
 };
 
-- 
1.6.5.3


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

end of thread, other threads:[~2009-12-14  0:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-13 23:59 [PATCH 0/8] Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2 re.emese
2009-12-13 23:59 ` [PATCH 1/8] " re.emese
2009-12-13 23:59 ` [PATCH 2/8] " re.emese
2009-12-13 23:59 ` [PATCH 3/8] " re.emese
2009-12-13 23:59 ` [PATCH 4/8] " re.emese
2009-12-13 23:59 ` [PATCH 5/8] " re.emese
2009-12-13 23:59 ` [PATCH 1/1] Constify struct iwl_ops " re.emese
2009-12-13 23:59 ` [PATCH 6/8] Constify struct kgdb_arch " re.emese
2009-12-13 23:59 ` [PATCH 7/8] " re.emese
2009-12-13 23:59 ` [PATCH 8/8] " re.emese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox