Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
Subsystems (10)
PATCH 1/1 Constify struct iwl_ops for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- 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(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +1 -1
@@ -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,
drivers/net/wireless/iwlwifi/iwl-3945.c +1 -1
@@ -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,
drivers/net/wireless/iwlwifi/iwl-4965.c +1 -1
@@ -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,
drivers/net/wireless/iwlwifi/iwl-5000.c +2 -2
@@ -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,
drivers/net/wireless/iwlwifi/iwl-6000.c +2 -2
@@ -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,
Signature · 1 line
1.6.5.3
PATCH 6/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- arch/sh/kernel/kgdb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/sh/kernel/kgdb.c +1 -1
@@ -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 },
Signature · 1 line
1.6.5.3
PATCH 7/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- arch/x86/kernel/kgdb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/kgdb.c +1 -1
@@ -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 ,
Signature · 1 line
1.6.5.3
PATCH 8/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- arch/powerpc/kernel/kgdb.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/kgdb.c +2 -2
@@ -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 }, };
Signature · 1 line
1.6.5.3
cover Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
From: Emese Revfy <[email protected]>
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_opsaddress_space_operationsbacklight_opsblock_device_operationsdma_map_opsextent_io_opsfile_lock_operationsfile_operationshv_opsintel_dvo_dev_opsitem_operationsiwl_ops
* kgdb_archkgdb_iokset_uevent_opslock_manager_operationsmicrocode_opsmtrr_opsneigh_opsnlmsvc_bindingpci_raw_opsplatform_hibernation_opsplatform_suspend_opssnd_ac97_build_opssysfs_opsusb_mon_operationswd_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(-)
PATCH 5/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
From: Emese Revfy <[email protected]>
--- arch/sparc/kernel/kgdb_32.c | 2 +- arch/sparc/kernel/kgdb_64.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/sparc/kernel/kgdb_32.c +1 -1
@@ -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 }, };
arch/sparc/kernel/kgdb_64.c +1 -1
@@ -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 }, };
Signature · 1 line
1.6.5.3
PATCH 4/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- arch/mips/kernel/kgdb.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/mips/kernel/kgdb.c +1 -0
@@ -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;/*
Signature · 1 line
1.6.5.3
PATCH 2/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- arch/blackfin/kernel/kgdb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/blackfin/kernel/kgdb.c +1 -1
@@ -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,
Signature · 1 line
1.6.5.3
PATCH 1/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- arch/arm/kernel/kgdb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/kernel/kgdb.c +1 -1
@@ -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__ */
Signature · 1 line
1.6.5.3
PATCH 3/8 Constify struct kgdb_arch for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- include/linux/kgdb.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/kgdb.h +1 -1
@@ -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);
Signature · 1 line
1.6.5.3