linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2
@ 2009-12-14  0:00 re.emese
  2009-12-14  0:00 ` [PATCH 1/4] " re.emese
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: re.emese @ 2009-12-14  0:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, gregkh, torvalds, akpm, penberg

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

 drivers/base/bus.c      |    2 +-
 drivers/base/core.c     |    2 +-
 drivers/base/memory.c   |    2 +-
 fs/gfs2/sys.c           |    2 +-
 include/linux/kobject.h |   10 +++++-----
 kernel/params.c         |    2 +-
 lib/kobject.c           |    4 ++--
 lib/kobject_uevent.c    |    2 +-
 mm/slub.c               |    2 +-
 9 files changed, 14 insertions(+), 14 deletions(-)


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

* [PATCH 1/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2
  2009-12-14  0:00 [PATCH 0/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
@ 2009-12-14  0:00 ` re.emese
  2009-12-14  0:00 ` [PATCH 2/4] " re.emese
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: re.emese @ 2009-12-14  0:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, gregkh, torvalds, rjw, kay.sievers, akpm, mingo

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


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 drivers/base/bus.c      |    2 +-
 drivers/base/core.c     |    2 +-
 drivers/base/memory.c   |    2 +-
 include/linux/kobject.h |   10 +++++-----
 lib/kobject.c           |    4 ++--
 lib/kobject_uevent.c    |    2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 63c143e..c47cd56 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -154,7 +154,7 @@ static int bus_uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops bus_uevent_ops = {
+static const struct kset_uevent_ops bus_uevent_ops = {
 	.filter = bus_uevent_filter,
 };
 
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f1290cb..37e079b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -252,7 +252,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
 	return retval;
 }
 
-static struct kset_uevent_ops device_uevent_ops = {
+static const struct kset_uevent_ops device_uevent_ops = {
 	.filter =	dev_uevent_filter,
 	.name =		dev_uevent_name,
 	.uevent =	dev_uevent,
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 989429c..2272b00 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -44,7 +44,7 @@ static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uev
 	return retval;
 }
 
-static struct kset_uevent_ops memory_uevent_ops = {
+static const struct kset_uevent_ops memory_uevent_ops = {
 	.name		= memory_uevent_name,
 	.uevent		= memory_uevent,
 };
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 58ae8e0..57a1eaa 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -118,9 +118,9 @@ struct kobj_uevent_env {
 };
 
 struct kset_uevent_ops {
-	int (*filter)(struct kset *kset, struct kobject *kobj);
-	const char *(*name)(struct kset *kset, struct kobject *kobj);
-	int (*uevent)(struct kset *kset, struct kobject *kobj,
+	int (* const filter)(struct kset *kset, struct kobject *kobj);
+	const char *(* const name)(struct kset *kset, struct kobject *kobj);
+	int (* const uevent)(struct kset *kset, struct kobject *kobj,
 		      struct kobj_uevent_env *env);
 };
 
@@ -155,14 +155,14 @@ struct kset {
 	struct list_head list;
 	spinlock_t list_lock;
 	struct kobject kobj;
-	struct kset_uevent_ops *uevent_ops;
+	const struct kset_uevent_ops *uevent_ops;
 };
 
 extern void kset_init(struct kset *kset);
 extern int __must_check kset_register(struct kset *kset);
 extern void kset_unregister(struct kset *kset);
 extern struct kset * __must_check kset_create_and_add(const char *name,
-						struct kset_uevent_ops *u,
+						const struct kset_uevent_ops *u,
 						struct kobject *parent_kobj);
 
 static inline struct kset *to_kset(struct kobject *kobj)
diff --git a/lib/kobject.c b/lib/kobject.c
index b512b74..cecf5a0 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -789,7 +789,7 @@ static struct kobj_type kset_ktype = {
  * If the kset was not able to be created, NULL will be returned.
  */
 static struct kset *kset_create(const char *name,
-				struct kset_uevent_ops *uevent_ops,
+				const struct kset_uevent_ops *uevent_ops,
 				struct kobject *parent_kobj)
 {
 	struct kset *kset;
@@ -832,7 +832,7 @@ static struct kset *kset_create(const char *name,
  * If the kset was not able to be created, NULL will be returned.
  */
 struct kset *kset_create_and_add(const char *name,
-				 struct kset_uevent_ops *uevent_ops,
+				 const struct kset_uevent_ops *uevent_ops,
 				 struct kobject *parent_kobj)
 {
 	struct kset *kset;
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 920a3ca..c9d3a3e 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -95,7 +95,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 	const char *subsystem;
 	struct kobject *top_kobj;
 	struct kset *kset;
-	struct kset_uevent_ops *uevent_ops;
+	const struct kset_uevent_ops *uevent_ops;
 	u64 seq;
 	int i = 0;
 	int retval = 0;
-- 
1.6.5.3


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

* [PATCH 1/1] Constify struct kgdb_io for 2.6.32-git-053fe57ac v2
  2009-12-14  0:00 [PATCH 0/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
  2009-12-14  0:00 ` [PATCH 1/4] " re.emese
  2009-12-14  0:00 ` [PATCH 2/4] " re.emese
@ 2009-12-14  0:00 ` re.emese
  2009-12-14  0:00 ` [PATCH 3/4] Constify struct kset_uevent_ops " re.emese
  2009-12-14  0:00 ` [PATCH 4/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
  4 siblings, 0 replies; 18+ messages in thread
From: re.emese @ 2009-12-14  0:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, jason.wessel, akpm, steiner, torvalds

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


Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 drivers/misc/kgdbts.c   |    4 ++--
 drivers/serial/kgdboc.c |    4 ++--
 include/linux/kgdb.h    |   18 +++++++++---------
 kernel/kgdb.c           |    6 +++---
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index fcb6ec1..42f5558 100644
--- a/drivers/misc/kgdbts.c
+++ b/drivers/misc/kgdbts.c
@@ -118,7 +118,7 @@
 	} while (0)
 #define MAX_CONFIG_LEN		40
 
-static struct kgdb_io kgdbts_io_ops;
+static const struct kgdb_io kgdbts_io_ops;
 static char get_buf[BUFMAX];
 static int get_buf_cnt;
 static char put_buf[BUFMAX];
@@ -1108,7 +1108,7 @@ static void kgdbts_post_exp_handler(void)
 		module_put(THIS_MODULE);
 }
 
-static struct kgdb_io kgdbts_io_ops = {
+static const struct kgdb_io kgdbts_io_ops = {
 	.name			= "kgdbts",
 	.read_char		= kgdbts_get_char,
 	.write_char		= kgdbts_put_char,
diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c
index eadc1ab..2d81457 100644
--- a/drivers/serial/kgdboc.c
+++ b/drivers/serial/kgdboc.c
@@ -18,7 +18,7 @@
 
 #define MAX_CONFIG_LEN		40
 
-static struct kgdb_io		kgdboc_io_ops;
+static const struct kgdb_io	kgdboc_io_ops;
 
 /* -1 = init not run yet, 0 = unconfigured, 1 = configured. */
 static int configured		= -1;
@@ -154,7 +154,7 @@ static void kgdboc_post_exp_handler(void)
 		module_put(THIS_MODULE);
 }
 
-static struct kgdb_io kgdboc_io_ops = {
+static const struct kgdb_io kgdboc_io_ops = {
 	.name			= "kgdboc",
 	.read_char		= kgdboc_get_char,
 	.write_char		= kgdboc_put_char,
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 6adcc29..ba61222 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -251,20 +251,20 @@ struct kgdb_arch {
  */
 struct kgdb_io {
 	const char		*name;
-	int			(*read_char) (void);
-	void			(*write_char) (u8);
-	void			(*flush) (void);
-	int			(*init) (void);
-	void			(*pre_exception) (void);
-	void			(*post_exception) (void);
+	int			(* const read_char) (void);
+	void			(* const write_char) (u8);
+	void			(* const flush) (void);
+	int			(* const init) (void);
+	void			(* const pre_exception) (void);
+	void			(* const post_exception) (void);
 };
 
-extern struct kgdb_arch		arch_kgdb_ops;
+extern struct kgdb_arch	arch_kgdb_ops;
 
 extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
 
-extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
-extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
+extern int kgdb_register_io_module(const struct kgdb_io *local_kgdb_io_ops);
+extern void kgdb_unregister_io_module(const struct kgdb_io *local_kgdb_io_ops);
 
 extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
 extern int kgdb_mem2hex(char *mem, char *buf, int count);
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index 2eb517e..a66317a 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -86,7 +86,7 @@ static int			kgdb_io_module_registered;
 /* Guard for recursive entry */
 static int			exception_level;
 
-static struct kgdb_io		*kgdb_io_ops;
+static const struct kgdb_io	*kgdb_io_ops;
 static DEFINE_SPINLOCK(kgdb_registration_lock);
 
 /* kgdb console driver is loaded */
@@ -1661,7 +1661,7 @@ static void kgdb_initial_breakpoint(void)
  *
  *	Register it with the KGDB core.
  */
-int kgdb_register_io_module(struct kgdb_io *new_kgdb_io_ops)
+int kgdb_register_io_module(const struct kgdb_io *new_kgdb_io_ops)
 {
 	int err;
 
@@ -1706,7 +1706,7 @@ EXPORT_SYMBOL_GPL(kgdb_register_io_module);
  *
  *	Unregister it with the KGDB core.
  */
-void kgdb_unregister_io_module(struct kgdb_io *old_kgdb_io_ops)
+void kgdb_unregister_io_module(const struct kgdb_io *old_kgdb_io_ops)
 {
 	BUG_ON(kgdb_connected);
 
-- 
1.6.5.3


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

* [PATCH 2/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2
  2009-12-14  0:00 [PATCH 0/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
  2009-12-14  0:00 ` [PATCH 1/4] " re.emese
@ 2009-12-14  0:00 ` re.emese
  2009-12-14 10:22   ` Steven Whitehouse
  2009-12-14  0:00 ` [PATCH 1/1] Constify struct kgdb_io " re.emese
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 18+ messages in thread
From: re.emese @ 2009-12-14  0:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, swhiteho, bmarzins, torvalds

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


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

diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index c5dad1e..2d9b7ed 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -586,7 +586,7 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 	return 0;
 }
 
-static struct kset_uevent_ops gfs2_uevent_ops = {
+static const struct kset_uevent_ops gfs2_uevent_ops = {
 	.uevent = gfs2_uevent,
 };
 
-- 
1.6.5.3


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

* [PATCH 3/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2
  2009-12-14  0:00 [PATCH 0/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
                   ` (2 preceding siblings ...)
  2009-12-14  0:00 ` [PATCH 1/1] Constify struct kgdb_io " re.emese
@ 2009-12-14  0:00 ` re.emese
  2009-12-25 11:31   ` Pekka Enberg
  2009-12-14  0:00 ` [PATCH 4/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
  4 siblings, 1 reply; 18+ messages in thread
From: re.emese @ 2009-12-14  0:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, penberg, rientjes, cl, torvalds

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


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

diff --git a/mm/slub.c b/mm/slub.c
index 4996fc7..fb63aca 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops slab_uevent_ops = {
+static const struct kset_uevent_ops slab_uevent_ops = {
 	.filter = uevent_filter,
 };
 
-- 
1.6.5.3


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

* [PATCH 4/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2
  2009-12-14  0:00 [PATCH 0/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
                   ` (3 preceding siblings ...)
  2009-12-14  0:00 ` [PATCH 3/4] Constify struct kset_uevent_ops " re.emese
@ 2009-12-14  0:00 ` re.emese
  4 siblings, 0 replies; 18+ messages in thread
From: re.emese @ 2009-12-14  0:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Emese Revfy, akpm, rusty, torvalds

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


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

diff --git a/kernel/params.c b/kernel/params.c
index d656c27..e9d197e 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -739,7 +739,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops module_uevent_ops = {
+static const struct kset_uevent_ops module_uevent_ops = {
 	.filter = uevent_filter,
 };
 
-- 
1.6.5.3


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

* Re: [PATCH 2/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2
  2009-12-14  0:00 ` [PATCH 2/4] " re.emese
@ 2009-12-14 10:22   ` Steven Whitehouse
  0 siblings, 0 replies; 18+ messages in thread
From: Steven Whitehouse @ 2009-12-14 10:22 UTC (permalink / raw)
  To: re.emese; +Cc: linux-kernel, bmarzins, torvalds

On Mon, 2009-12-14 at 01:00 +0100, re.emese@gmail.com wrote:
> From: Emese Revfy <re.emese@gmail.com>
> 
> 
> Signed-off-by: Emese Revfy <re.emese@gmail.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>


Steve.

> ---
>  fs/gfs2/sys.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index c5dad1e..2d9b7ed 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -586,7 +586,7 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
>  	return 0;
>  }
>  
> -static struct kset_uevent_ops gfs2_uevent_ops = {
> +static const struct kset_uevent_ops gfs2_uevent_ops = {
>  	.uevent = gfs2_uevent,
>  };
>  



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

* Re: [PATCH 3/4] Constify struct kset_uevent_ops for  2.6.32-git-053fe57ac v2
  2009-12-14  0:00 ` [PATCH 3/4] Constify struct kset_uevent_ops " re.emese
@ 2009-12-25 11:31   ` Pekka Enberg
  2009-12-26  0:38     ` Emese Revfy
  0 siblings, 1 reply; 18+ messages in thread
From: Pekka Enberg @ 2009-12-25 11:31 UTC (permalink / raw)
  To: re.emese; +Cc: linux-kernel, rientjes, cl, torvalds

On Mon, Dec 14, 2009 at 2:00 AM,  <re.emese@gmail.com> wrote:
> From: Emese Revfy <re.emese@gmail.com>
>
>
> Signed-off-by: Emese Revfy <re.emese@gmail.com>
> ---
>  mm/slub.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 4996fc7..fb63aca 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
>        return 0;
>  }
>
> -static struct kset_uevent_ops slab_uevent_ops = {
> +static const struct kset_uevent_ops slab_uevent_ops = {
>        .filter = uevent_filter,
>  };

  CC      mm/slub.o
mm/slub.c: In function 'slab_sysfs_init':
mm/slub.c:4679: warning: passing argument 2 of 'kset_create_and_add'
discards qualifiers from pointer target type
include/linux/kobject.h:164: note: expected 'struct kset_uevent_ops *'
but argument is of type 'const struct kset_uevent_ops *'

Hmm?

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

* Re: [PATCH 3/4] Constify struct kset_uevent_ops for  2.6.32-git-053fe57ac v2
  2009-12-25 11:31   ` Pekka Enberg
@ 2009-12-26  0:38     ` Emese Revfy
  2009-12-28 20:46       ` David Rientjes
  2009-12-29  7:24       ` Pekka Enberg
  0 siblings, 2 replies; 18+ messages in thread
From: Emese Revfy @ 2009-12-26  0:38 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: linux-kernel, rientjes, cl, torvalds

Pekka Enberg wrote:
> On Mon, Dec 14, 2009 at 2:00 AM,  <re.emese@gmail.com> wrote:
>> From: Emese Revfy <re.emese@gmail.com>
>>
>>
>> Signed-off-by: Emese Revfy <re.emese@gmail.com>
>> ---
>>  mm/slub.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/slub.c b/mm/slub.c
>> index 4996fc7..fb63aca 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
>>        return 0;
>>  }
>>
>> -static struct kset_uevent_ops slab_uevent_ops = {
>> +static const struct kset_uevent_ops slab_uevent_ops = {
>>        .filter = uevent_filter,
>>  };
> 
>   CC      mm/slub.o
> mm/slub.c: In function 'slab_sysfs_init':
> mm/slub.c:4679: warning: passing argument 2 of 'kset_create_and_add'
> discards qualifiers from pointer target type
> include/linux/kobject.h:164: note: expected 'struct kset_uevent_ops *'
> but argument is of type 'const struct kset_uevent_ops *'
> 
> Hmm?
> 

I double checked both the declaration and definitions of the affected
function/structure and they are consistently const here.
Can you tell me what patch/tree combination you encountered this warning with?
Thanks, Emese

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

* Re: [PATCH 3/4] Constify struct kset_uevent_ops for  2.6.32-git-053fe57ac v2
  2009-12-26  0:38     ` Emese Revfy
@ 2009-12-28 20:46       ` David Rientjes
  2009-12-29 20:50         ` Emese Revfy
  2009-12-29  7:24       ` Pekka Enberg
  1 sibling, 1 reply; 18+ messages in thread
From: David Rientjes @ 2009-12-28 20:46 UTC (permalink / raw)
  To: Emese Revfy; +Cc: Pekka Enberg, linux-kernel, cl, torvalds

On Sat, 26 Dec 2009, Emese Revfy wrote:

> >> diff --git a/mm/slub.c b/mm/slub.c
> >> index 4996fc7..fb63aca 100644
> >> --- a/mm/slub.c
> >> +++ b/mm/slub.c
> >> @@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
> >>        return 0;
> >>  }
> >>
> >> -static struct kset_uevent_ops slab_uevent_ops = {
> >> +static const struct kset_uevent_ops slab_uevent_ops = {
> >>        .filter = uevent_filter,
> >>  };
> > 
> >   CC      mm/slub.o
> > mm/slub.c: In function 'slab_sysfs_init':
> > mm/slub.c:4679: warning: passing argument 2 of 'kset_create_and_add'
> > discards qualifiers from pointer target type
> > include/linux/kobject.h:164: note: expected 'struct kset_uevent_ops *'
> > but argument is of type 'const struct kset_uevent_ops *'
> > 
> > Hmm?
> > 
> 
> I double checked both the declaration and definitions of the affected
> function/structure and they are consistently const here.
> Can you tell me what patch/tree combination you encountered this warning with?
> Thanks, Emese
> 

The warning emitted by gcc is pretty explicit; the second formal of 
kset_create_and_add() takes a 'struct kset_uevent_ops *' type while you're 
now passing 'const struct kset_uevent_ops *' as the result of your change.  
That said, kset_create() could probably be modified with the const 
qualifier, but that's outside the scope of your patchset and would have to 
be proposed seperately.

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

* Re: [PATCH 3/4] Constify struct kset_uevent_ops for  2.6.32-git-053fe57ac v2
  2009-12-26  0:38     ` Emese Revfy
  2009-12-28 20:46       ` David Rientjes
@ 2009-12-29  7:24       ` Pekka Enberg
  2009-12-29 20:58         ` [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2 Emese Revfy
  1 sibling, 1 reply; 18+ messages in thread
From: Pekka Enberg @ 2009-12-29  7:24 UTC (permalink / raw)
  To: Emese Revfy; +Cc: linux-kernel, rientjes, cl, torvalds

Emese Revfy kirjoitti:
> Pekka Enberg wrote:
>> On Mon, Dec 14, 2009 at 2:00 AM,  <re.emese@gmail.com> wrote:
>>> From: Emese Revfy <re.emese@gmail.com>
>>>
>>>
>>> Signed-off-by: Emese Revfy <re.emese@gmail.com>
>>> ---
>>>  mm/slub.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/mm/slub.c b/mm/slub.c
>>> index 4996fc7..fb63aca 100644
>>> --- a/mm/slub.c
>>> +++ b/mm/slub.c
>>> @@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
>>>        return 0;
>>>  }
>>>
>>> -static struct kset_uevent_ops slab_uevent_ops = {
>>> +static const struct kset_uevent_ops slab_uevent_ops = {
>>>        .filter = uevent_filter,
>>>  };
>>   CC      mm/slub.o
>> mm/slub.c: In function 'slab_sysfs_init':
>> mm/slub.c:4679: warning: passing argument 2 of 'kset_create_and_add'
>> discards qualifiers from pointer target type
>> include/linux/kobject.h:164: note: expected 'struct kset_uevent_ops *'
>> but argument is of type 'const struct kset_uevent_ops *'
>>
>> Hmm?
>>
> 
> I double checked both the declaration and definitions of the affected
> function/structure and they are consistently const here.
> Can you tell me what patch/tree combination you encountered this warning with?

2.6.33-rc2 with your patch.

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

* Re: [PATCH 3/4] Constify struct kset_uevent_ops for  2.6.32-git-053fe57ac v2
  2009-12-28 20:46       ` David Rientjes
@ 2009-12-29 20:50         ` Emese Revfy
  2009-12-29 20:51           ` Pekka Enberg
  0 siblings, 1 reply; 18+ messages in thread
From: Emese Revfy @ 2009-12-29 20:50 UTC (permalink / raw)
  To: David Rientjes; +Cc: Pekka Enberg, linux-kernel, cl, torvalds

David Rientjes wrote:
> On Sat, 26 Dec 2009, Emese Revfy wrote:
> 
>>>> diff --git a/mm/slub.c b/mm/slub.c
>>>> index 4996fc7..fb63aca 100644
>>>> --- a/mm/slub.c
>>>> +++ b/mm/slub.c
>>>> @@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
>>>>        return 0;
>>>>  }
>>>>
>>>> -static struct kset_uevent_ops slab_uevent_ops = {
>>>> +static const struct kset_uevent_ops slab_uevent_ops = {
>>>>        .filter = uevent_filter,
>>>>  };
>>>   CC      mm/slub.o
>>> mm/slub.c: In function 'slab_sysfs_init':
>>> mm/slub.c:4679: warning: passing argument 2 of 'kset_create_and_add'
>>> discards qualifiers from pointer target type
>>> include/linux/kobject.h:164: note: expected 'struct kset_uevent_ops *'
>>> but argument is of type 'const struct kset_uevent_ops *'
>>>
>>> Hmm?
>>>
>> I double checked both the declaration and definitions of the affected
>> function/structure and they are consistently const here.
>> Can you tell me what patch/tree combination you encountered this warning with?
>> Thanks, Emese
>>
> 
> The warning emitted by gcc is pretty explicit; the second formal of 
> kset_create_and_add() takes a 'struct kset_uevent_ops *' type while you're 
> now passing 'const struct kset_uevent_ops *' as the result of your change.  
> That said, kset_create() could probably be modified with the const 
> qualifier, but that's outside the scope of your patchset and would have to 
> be proposed seperately.

I see what you mean, this was part of [PATCH 1/4] that I forgot to CC to you.
Emese


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

* Re: [PATCH 3/4] Constify struct kset_uevent_ops for  2.6.32-git-053fe57ac v2
  2009-12-29 20:50         ` Emese Revfy
@ 2009-12-29 20:51           ` Pekka Enberg
  0 siblings, 0 replies; 18+ messages in thread
From: Pekka Enberg @ 2009-12-29 20:51 UTC (permalink / raw)
  To: Emese Revfy; +Cc: David Rientjes, linux-kernel, cl, torvalds, Andrew Morton

Hi Emese,

On Tue, Dec 29, 2009 at 10:50 PM, Emese Revfy <re.emese@gmail.com> wrote:
> David Rientjes wrote:
>> On Sat, 26 Dec 2009, Emese Revfy wrote:
>>
>>>>> diff --git a/mm/slub.c b/mm/slub.c
>>>>> index 4996fc7..fb63aca 100644
>>>>> --- a/mm/slub.c
>>>>> +++ b/mm/slub.c
>>>>> @@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
>>>>>        return 0;
>>>>>  }
>>>>>
>>>>> -static struct kset_uevent_ops slab_uevent_ops = {
>>>>> +static const struct kset_uevent_ops slab_uevent_ops = {
>>>>>        .filter = uevent_filter,
>>>>>  };
>>>>   CC      mm/slub.o
>>>> mm/slub.c: In function 'slab_sysfs_init':
>>>> mm/slub.c:4679: warning: passing argument 2 of 'kset_create_and_add'
>>>> discards qualifiers from pointer target type
>>>> include/linux/kobject.h:164: note: expected 'struct kset_uevent_ops *'
>>>> but argument is of type 'const struct kset_uevent_ops *'
>>>>
>>>> Hmm?
>>>>
>>> I double checked both the declaration and definitions of the affected
>>> function/structure and they are consistently const here.
>>> Can you tell me what patch/tree combination you encountered this warning with?
>>> Thanks, Emese
>>>
>>
>> The warning emitted by gcc is pretty explicit; the second formal of
>> kset_create_and_add() takes a 'struct kset_uevent_ops *' type while you're
>> now passing 'const struct kset_uevent_ops *' as the result of your change.
>> That said, kset_create() could probably be modified with the const
>> qualifier, but that's outside the scope of your patchset and would have to
>> be proposed seperately.
>
> I see what you mean, this was part of [PATCH 1/4] that I forgot to CC to you.

Then you might as well fold everything in one patch and send it to
Andrew. I can't apply both in my tree and I don't want to apply
something that doesn't compile cleanly.

                         Pekka

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

* Re: [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2
  2009-12-29  7:24       ` Pekka Enberg
@ 2009-12-29 20:58         ` Emese Revfy
  2009-12-30  0:11           ` Greg KH
  0 siblings, 1 reply; 18+ messages in thread
From: Emese Revfy @ 2009-12-29 20:58 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: linux-kernel, rientjes, cl, torvalds, akpm, rjw, rusty, Greg KH

>> I double checked both the declaration and definitions of the affected
>> function/structure and they are consistently const here.
>> Can you tell me what patch/tree combination you encountered this
>> warning with?
> 
> 2.6.33-rc2 with your patch.

Here is the updated patch for 2.6.33-rc2 in one piece.
Emese


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

Constify struct kset_uevent_ops.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
---

 drivers/base/bus.c      |    2 +-
 drivers/base/core.c     |    2 +-
 drivers/base/memory.c   |    2 +-
 fs/gfs2/sys.c           |    2 +-
 include/linux/kobject.h |   10 +++++-----
 kernel/params.c         |    2 +-
 lib/kobject.c           |    4 ++--
 lib/kobject_uevent.c    |    2 +-
 mm/slub.c               |    2 +-
 9 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index c0c5a43..2afe599 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -154,7 +154,7 @@ static int bus_uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops bus_uevent_ops = {
+static const struct kset_uevent_ops bus_uevent_ops = {
 	.filter = bus_uevent_filter,
 };
 
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2820257..82bd3ff 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -252,7 +252,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
 	return retval;
 }
 
-static struct kset_uevent_ops device_uevent_ops = {
+static const struct kset_uevent_ops device_uevent_ops = {
 	.filter =	dev_uevent_filter,
 	.name =		dev_uevent_name,
 	.uevent =	dev_uevent,
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index d7d77d4..0bcf8c2 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -44,7 +44,7 @@ static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uev
 	return retval;
 }
 
-static struct kset_uevent_ops memory_uevent_ops = {
+static const struct kset_uevent_ops memory_uevent_ops = {
 	.name		= memory_uevent_name,
 	.uevent		= memory_uevent,
 };
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 0dc3462..9be733e 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -576,7 +576,7 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 	return 0;
 }
 
-static struct kset_uevent_ops gfs2_uevent_ops = {
+static const struct kset_uevent_ops gfs2_uevent_ops = {
 	.uevent = gfs2_uevent,
 };
 
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 58ae8e0..57a1eaa 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -118,9 +118,9 @@ struct kobj_uevent_env {
 };
 
 struct kset_uevent_ops {
-	int (*filter)(struct kset *kset, struct kobject *kobj);
-	const char *(*name)(struct kset *kset, struct kobject *kobj);
-	int (*uevent)(struct kset *kset, struct kobject *kobj,
+	int (* const filter)(struct kset *kset, struct kobject *kobj);
+	const char *(* const name)(struct kset *kset, struct kobject *kobj);
+	int (* const uevent)(struct kset *kset, struct kobject *kobj,
 		      struct kobj_uevent_env *env);
 };
 
@@ -155,14 +155,14 @@ struct kset {
 	struct list_head list;
 	spinlock_t list_lock;
 	struct kobject kobj;
-	struct kset_uevent_ops *uevent_ops;
+	const struct kset_uevent_ops *uevent_ops;
 };
 
 extern void kset_init(struct kset *kset);
 extern int __must_check kset_register(struct kset *kset);
 extern void kset_unregister(struct kset *kset);
 extern struct kset * __must_check kset_create_and_add(const char *name,
-						struct kset_uevent_ops *u,
+						const struct kset_uevent_ops *u,
 						struct kobject *parent_kobj);
 
 static inline struct kset *to_kset(struct kobject *kobj)
diff --git a/kernel/params.c b/kernel/params.c
index cf1b691..ac5de7d 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -737,7 +737,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops module_uevent_ops = {
+static const struct kset_uevent_ops module_uevent_ops = {
 	.filter = uevent_filter,
 };
 
diff --git a/lib/kobject.c b/lib/kobject.c
index b512b74..cecf5a0 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -789,7 +789,7 @@ static struct kobj_type kset_ktype = {
  * If the kset was not able to be created, NULL will be returned.
  */
 static struct kset *kset_create(const char *name,
-				struct kset_uevent_ops *uevent_ops,
+				const struct kset_uevent_ops *uevent_ops,
 				struct kobject *parent_kobj)
 {
 	struct kset *kset;
@@ -832,7 +832,7 @@ static struct kset *kset_create(const char *name,
  * If the kset was not able to be created, NULL will be returned.
  */
 struct kset *kset_create_and_add(const char *name,
-				 struct kset_uevent_ops *uevent_ops,
+				 const struct kset_uevent_ops *uevent_ops,
 				 struct kobject *parent_kobj)
 {
 	struct kset *kset;
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 920a3ca..c9d3a3e 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -95,7 +95,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 	const char *subsystem;
 	struct kobject *top_kobj;
 	struct kset *kset;
-	struct kset_uevent_ops *uevent_ops;
+	const struct kset_uevent_ops *uevent_ops;
 	u64 seq;
 	int i = 0;
 	int retval = 0;
diff --git a/mm/slub.c b/mm/slub.c
index 8d71aaf..02b5a83 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4538,7 +4538,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops slab_uevent_ops = {
+static const struct kset_uevent_ops slab_uevent_ops = {
 	.filter = uevent_filter,
 };
 



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

* Re: [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2
  2009-12-29 20:58         ` [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2 Emese Revfy
@ 2009-12-30  0:11           ` Greg KH
  2009-12-31  0:16             ` Emese Revfy
  0 siblings, 1 reply; 18+ messages in thread
From: Greg KH @ 2009-12-30  0:11 UTC (permalink / raw)
  To: Emese Revfy
  Cc: Pekka Enberg, linux-kernel, rientjes, cl, torvalds, akpm, rjw, rusty

On Tue, Dec 29, 2009 at 09:58:11PM +0100, Emese Revfy wrote:
> >> I double checked both the declaration and definitions of the affected
> >> function/structure and they are consistently const here.
> >> Can you tell me what patch/tree combination you encountered this
> >> warning with?
> > 
> > 2.6.33-rc2 with your patch.
> 
> Here is the updated patch for 2.6.33-rc2 in one piece.
> Emese
> 
> 
> From: Emese Revfy <re.emese@gmail.com>
> 
> Constify struct kset_uevent_ops.

Why is this needed?  What does it accomplish?

thanks,

greg k-h

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

* Re: [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2
  2009-12-30  0:11           ` Greg KH
@ 2009-12-31  0:16             ` Emese Revfy
  2009-12-31  4:40               ` Greg KH
  0 siblings, 1 reply; 18+ messages in thread
From: Emese Revfy @ 2009-12-31  0:16 UTC (permalink / raw)
  To: Greg KH
  Cc: Pekka Enberg, linux-kernel, rientjes, cl, torvalds, akpm, rjw,
	rusty, Arjan van de Ven

Greg KH wrote:
> On Tue, Dec 29, 2009 at 09:58:11PM +0100, Emese Revfy wrote:
>>>> I double checked both the declaration and definitions of the affected
>>>> function/structure and they are consistently const here.
>>>> Can you tell me what patch/tree combination you encountered this
>>>> warning with?
>>> 2.6.33-rc2 with your patch.
>> Here is the updated patch for 2.6.33-rc2 in one piece.
>> Emese
>>
>>
>> From: Emese Revfy <re.emese@gmail.com>
>>
>> Constify struct kset_uevent_ops.
> 
> Why is this needed?  What does it accomplish?

This is my contribution to the ops structure constification effort
that some developers started a few years ago (Arjan, Al Viro, etc.)
and that has been worked on somewhat sporadically ever since. For a
summary of why this is useful please see Arjan's email:
http://lkml.org/lkml/2009/12/14/216
--
Emese



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

* Re: [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2
  2009-12-31  0:16             ` Emese Revfy
@ 2009-12-31  4:40               ` Greg KH
  2009-12-31 13:52                 ` Emese Revfy
  0 siblings, 1 reply; 18+ messages in thread
From: Greg KH @ 2009-12-31  4:40 UTC (permalink / raw)
  To: Emese Revfy
  Cc: Pekka Enberg, linux-kernel, rientjes, cl, torvalds, akpm, rjw,
	rusty, Arjan van de Ven

On Thu, Dec 31, 2009 at 01:16:58AM +0100, Emese Revfy wrote:
> Greg KH wrote:
> > On Tue, Dec 29, 2009 at 09:58:11PM +0100, Emese Revfy wrote:
> >>>> I double checked both the declaration and definitions of the affected
> >>>> function/structure and they are consistently const here.
> >>>> Can you tell me what patch/tree combination you encountered this
> >>>> warning with?
> >>> 2.6.33-rc2 with your patch.
> >> Here is the updated patch for 2.6.33-rc2 in one piece.
> >> Emese
> >>
> >>
> >> From: Emese Revfy <re.emese@gmail.com>
> >>
> >> Constify struct kset_uevent_ops.
> > 
> > Why is this needed?  What does it accomplish?
> 
> This is my contribution to the ops structure constification effort
> that some developers started a few years ago (Arjan, Al Viro, etc.)
> and that has been worked on somewhat sporadically ever since. For a
> summary of why this is useful please see Arjan's email:
> http://lkml.org/lkml/2009/12/14/216

Then please insert this kind of information in the patch itself,
otherwise it is totally unknown.

Care to resend with the proper information in it?

thanks,

greg k-h

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

* Re: [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2
  2009-12-31  4:40               ` Greg KH
@ 2009-12-31 13:52                 ` Emese Revfy
  0 siblings, 0 replies; 18+ messages in thread
From: Emese Revfy @ 2009-12-31 13:52 UTC (permalink / raw)
  To: Greg KH
  Cc: Pekka Enberg, linux-kernel, rientjes, cl, torvalds, akpm, rjw,
	rusty, Arjan van de Ven

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

Constify struct kset_uevent_ops.

This is part of the ops structure constification
effort started by Arjan van de Ven et al.

Benefits of this constification:

 * prevents modification of data that is shared
   (referenced) by many other structure instances
   at runtime

 * detects/prevents accidental (but not intentional)
   modification attempts on archs that enforce
   read-only kernel data at runtime

 * potentially better optimized code as the compiler
   can assume that the const data cannot be changed

 * the compiler/linker move const data into .rodata
   and therefore exclude them from false sharing

Signed-off-by: Emese Revfy <re.emese@gmail.com>
---

 drivers/base/bus.c      |    2 +-
 drivers/base/core.c     |    2 +-
 drivers/base/memory.c   |    2 +-
 fs/gfs2/sys.c           |    2 +-
 include/linux/kobject.h |   10 +++++-----
 kernel/params.c         |    2 +-
 lib/kobject.c           |    4 ++--
 lib/kobject_uevent.c    |    2 +-
 mm/slub.c               |    2 +-
 9 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index c0c5a43..2afe599 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -154,7 +154,7 @@ static int bus_uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops bus_uevent_ops = {
+static const struct kset_uevent_ops bus_uevent_ops = {
 	.filter = bus_uevent_filter,
 };
 
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2820257..82bd3ff 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -252,7 +252,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
 	return retval;
 }
 
-static struct kset_uevent_ops device_uevent_ops = {
+static const struct kset_uevent_ops device_uevent_ops = {
 	.filter =	dev_uevent_filter,
 	.name =		dev_uevent_name,
 	.uevent =	dev_uevent,
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index d7d77d4..0bcf8c2 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -44,7 +44,7 @@ static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uev
 	return retval;
 }
 
-static struct kset_uevent_ops memory_uevent_ops = {
+static const struct kset_uevent_ops memory_uevent_ops = {
 	.name		= memory_uevent_name,
 	.uevent		= memory_uevent,
 };
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 0dc3462..9be733e 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -576,7 +576,7 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 	return 0;
 }
 
-static struct kset_uevent_ops gfs2_uevent_ops = {
+static const struct kset_uevent_ops gfs2_uevent_ops = {
 	.uevent = gfs2_uevent,
 };
 
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 58ae8e0..57a1eaa 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -118,9 +118,9 @@ struct kobj_uevent_env {
 };
 
 struct kset_uevent_ops {
-	int (*filter)(struct kset *kset, struct kobject *kobj);
-	const char *(*name)(struct kset *kset, struct kobject *kobj);
-	int (*uevent)(struct kset *kset, struct kobject *kobj,
+	int (* const filter)(struct kset *kset, struct kobject *kobj);
+	const char *(* const name)(struct kset *kset, struct kobject *kobj);
+	int (* const uevent)(struct kset *kset, struct kobject *kobj,
 		      struct kobj_uevent_env *env);
 };
 
@@ -155,14 +155,14 @@ struct kset {
 	struct list_head list;
 	spinlock_t list_lock;
 	struct kobject kobj;
-	struct kset_uevent_ops *uevent_ops;
+	const struct kset_uevent_ops *uevent_ops;
 };
 
 extern void kset_init(struct kset *kset);
 extern int __must_check kset_register(struct kset *kset);
 extern void kset_unregister(struct kset *kset);
 extern struct kset * __must_check kset_create_and_add(const char *name,
-						struct kset_uevent_ops *u,
+						const struct kset_uevent_ops *u,
 						struct kobject *parent_kobj);
 
 static inline struct kset *to_kset(struct kobject *kobj)
diff --git a/kernel/params.c b/kernel/params.c
index cf1b691..ac5de7d 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -737,7 +737,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops module_uevent_ops = {
+static const struct kset_uevent_ops module_uevent_ops = {
 	.filter = uevent_filter,
 };
 
diff --git a/lib/kobject.c b/lib/kobject.c
index b512b74..cecf5a0 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -789,7 +789,7 @@ static struct kobj_type kset_ktype = {
  * If the kset was not able to be created, NULL will be returned.
  */
 static struct kset *kset_create(const char *name,
-				struct kset_uevent_ops *uevent_ops,
+				const struct kset_uevent_ops *uevent_ops,
 				struct kobject *parent_kobj)
 {
 	struct kset *kset;
@@ -832,7 +832,7 @@ static struct kset *kset_create(const char *name,
  * If the kset was not able to be created, NULL will be returned.
  */
 struct kset *kset_create_and_add(const char *name,
-				 struct kset_uevent_ops *uevent_ops,
+				 const struct kset_uevent_ops *uevent_ops,
 				 struct kobject *parent_kobj)
 {
 	struct kset *kset;
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 920a3ca..c9d3a3e 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -95,7 +95,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 	const char *subsystem;
 	struct kobject *top_kobj;
 	struct kset *kset;
-	struct kset_uevent_ops *uevent_ops;
+	const struct kset_uevent_ops *uevent_ops;
 	u64 seq;
 	int i = 0;
 	int retval = 0;
diff --git a/mm/slub.c b/mm/slub.c
index 8d71aaf..02b5a83 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4538,7 +4538,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)
 	return 0;
 }
 
-static struct kset_uevent_ops slab_uevent_ops = {
+static const struct kset_uevent_ops slab_uevent_ops = {
 	.filter = uevent_filter,
 };
 

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

end of thread, other threads:[~2009-12-31 13:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-14  0:00 [PATCH 0/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese
2009-12-14  0:00 ` [PATCH 1/4] " re.emese
2009-12-14  0:00 ` [PATCH 2/4] " re.emese
2009-12-14 10:22   ` Steven Whitehouse
2009-12-14  0:00 ` [PATCH 1/1] Constify struct kgdb_io " re.emese
2009-12-14  0:00 ` [PATCH 3/4] Constify struct kset_uevent_ops " re.emese
2009-12-25 11:31   ` Pekka Enberg
2009-12-26  0:38     ` Emese Revfy
2009-12-28 20:46       ` David Rientjes
2009-12-29 20:50         ` Emese Revfy
2009-12-29 20:51           ` Pekka Enberg
2009-12-29  7:24       ` Pekka Enberg
2009-12-29 20:58         ` [PATCH 1/1] Constify struct kset_uevent_ops for 2.6.33-rc2 Emese Revfy
2009-12-30  0:11           ` Greg KH
2009-12-31  0:16             ` Emese Revfy
2009-12-31  4:40               ` Greg KH
2009-12-31 13:52                 ` Emese Revfy
2009-12-14  0:00 ` [PATCH 4/4] Constify struct kset_uevent_ops for 2.6.32-git-053fe57ac v2 re.emese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).