kobject: remove kset from struct kset_uevent_ops callbacks
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 1/1 kobject: remove kset from struct kset_uevent_ops callbacks
There is no need to pass the pointer to the kset in the struct kset_uevent_ops callbacks as no one uses it, so just remove that pointer entirely.
--- Documentation/core-api/kobject.rst | 7 +++---- Documentation/translations/zh_CN/core-api/kobject.rst | 7 +++---- drivers/base/bus.c | 2 +- drivers/base/core.c | 11 +++++------ drivers/dma-buf/dma-buf-sysfs-stats.c | 2 +- fs/dlm/lockspace.c | 3 +-- fs/gfs2/sys.c | 3 +-- include/linux/kobject.h | 7 +++---- kernel/params.c | 2 +- lib/kobject_uevent.c | 6 +++--- 10 files changed, 22 insertions(+), 28 deletions(-)
Documentation/core-api/kobject.rst +3 -4
@@ -373,10 +373,9 @@ If a kset wishes to control the uevent operations of the kobjects associated with it, it can use the struct kset_uevent_ops to handle it:: struct kset_uevent_ops { - 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); + int (* const filter)(struct kobject *kobj); + const char *(* const name)(struct kobject *kobj); + int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env); };
Documentation/translations/zh_CN/core-api/kobject.rst +3 -4
@@ -325,10 +325,9 @@ ksets 结构体kset_uevent_ops来处理它:: struct kset_uevent_ops { - 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); + int (* const filter)(struct kobject *kobj); + const char *(* const name)(struct kobject *kobj); + int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env); };
drivers/base/bus.c +1 -1
@@ -163,7 +163,7 @@ static struct kobj_type bus_ktype = { .release = bus_release, }; -static int bus_uevent_filter (struct kset *kset,struct kobject *kobj) +static int bus_uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);
drivers/base/core.c +5 -6
@@ -2261,7 +2261,7 @@ static struct kobj_type device_ktype = { }; -static int dev_uevent_filter (struct kset *kset,struct kobject *kobj) +static int dev_uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);
@@ -2275,7 +2275,7 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)return 0 ; } -static const char *dev_uevent_name (struct kset *kset,struct kobject *kobj) +static const char *dev_uevent_name (struct kobject *kobj) {struct device *dev =kobj_to_dev (kobj);
@@ -2286,8 +2286,7 @@ static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj)return NULL ; } -static int dev_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int dev_uevent (struct kobject *kobj,struct kobj_uevent_env *env) {struct device *dev =kobj_to_dev (kobj);int retval =0 ;
@@ -2382,7 +2381,7 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,/* respect filter */ if (kset->uevent_ops && kset->uevent_ops->filter) -if (!kset->uevent_ops->filter (kset, &dev->kobj)) +if (!kset->uevent_ops->filter (&dev->kobj)) goto out; env =kzalloc (sizeof (struct kobj_uevent_env ),GFP_KERNEL );
@@ -2390,7 +2389,7 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,return -ENOMEM ;/* let the kset specific function add its keys */ - retval = kset->uevent_ops->uevent (kset, &dev->kobj, env); + retval = kset->uevent_ops->uevent (&dev->kobj, env);if (retval) goto out;
drivers/dma-buf/dma-buf-sysfs-stats.c +1 -1
@@ -132,7 +132,7 @@ void dma_buf_stats_teardown(struct dma_buf *dmabuf)/* Statistics files do not need to send uevents. */ -static int dmabuf_sysfs_uevent_filter (struct kset *kset,struct kobject *kobj) +static int dmabuf_sysfs_uevent_filter (struct kobject *kobj) {return 0 ; }
fs/dlm/lockspace.c +1 -2
@@ -216,8 +216,7 @@ static int do_uevent(struct dlm_ls *ls, int in)return ls->ls_uevent_result; } -static int dlm_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int dlm_uevent (struct kobject *kobj,struct kobj_uevent_env *env) { struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);
fs/gfs2/sys.c +1 -2
@@ -767,8 +767,7 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)wait_for_completion (&sdp->sd_kobj_unregister); } -static int gfs2_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int gfs2_uevent (struct kobject *kobj,struct kobj_uevent_env *env) { struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);struct super_block *s = sdp->sd_vfs;
include/linux/kobject.h +3 -4
@@ -153,10 +153,9 @@ struct kobj_uevent_env { };struct kset_uevent_ops { -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); +int (*const filter)(struct kobject *kobj); +const char *(*const name)(struct kobject *kobj); +int (*const uevent)(struct kobject *kobj,struct kobj_uevent_env *env); };struct kobj_attribute {
kernel/params.c +1 -1
@@ -926,7 +926,7 @@ static const struct sysfs_ops module_sysfs_ops = { .store = module_attr_store, }; -static int uevent_filter (struct kset *kset,struct kobject *kobj) +static int uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);
lib/kobject_uevent.c +3 -3
@@ -501,7 +501,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, }/* skip the event, if the filter returns zero. */ if (uevent_ops && uevent_ops->filter) -if (!uevent_ops->filter (kset, kobj)) { +if (!uevent_ops->filter (kobj)) {pr_debug ("kobject: '%s' (%p): %s: filter function " "caused the event to drop!\n" ,kobject_name (kobj), kobj, __func__);
@@ -510,7 +510,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,/* originating subsystem */ if (uevent_ops && uevent_ops->name) - subsystem = uevent_ops->name (kset, kobj); + subsystem = uevent_ops->name (kobj);else subsystem =kobject_name (&kset->kobj);if (!subsystem) {
@@ -554,7 +554,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,/* let the kset specific function add its stuff */ if (uevent_ops && uevent_ops->uevent) { - retval = uevent_ops->uevent (kset, kobj, env); + retval = uevent_ops->uevent (kobj, env);if (retval) { pr_debug("kobject: '%s' (%p): %s: uevent() returned " "%d\n", kobject_name(kobj), kobj,
Signature · 1 line
2.34.1
Quoted 8 lines · Greg Kroah-Hartman
There is no need to pass the pointer to the kset in the struct
kset_uevent_opscallbacks as no one uses it, so just remove that pointer entirely.Cc Rafael J. Wysocki <[email protected]>Cc Wedson Almeida Filho <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 218 lines
--- Documentation/core-api/kobject.rst | 7 +++---- Documentation/translations/zh_CN/core-api/kobject.rst | 7 +++---- drivers/base/bus.c | 2 +- drivers/base/core.c | 11 +++++------ drivers/dma-buf/dma-buf-sysfs-stats.c | 2 +- fs/dlm/lockspace.c | 3 +-- fs/gfs2/sys.c | 3 +-- include/linux/kobject.h | 7 +++---- kernel/params.c | 2 +- lib/kobject_uevent.c | 6 +++--- 10 files changed, 22 insertions(+), 28 deletions(-)Documentation/core-api/kobject.rst +3
-4@@ -373,10 +373,9 @@ If a kset wishes to control the uevent operations of the kobjects associated with it, it can use the struct kset_uevent_ops to handle it:: struct kset_uevent_ops { - 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); + int (* const filter)(struct kobject *kobj); + const char *(* const name)(struct kobject *kobj); + int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env); };Documentation/translations/zh_CN/core-api/kobject.rst +3
-4@@ -325,10 +325,9 @@ ksets 结构体kset_uevent_ops来处理它:: struct kset_uevent_ops { - 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); + int (* const filter)(struct kobject *kobj); + const char *(* const name)(struct kobject *kobj); + int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env); };drivers/base/bus.c +1
-1@@ -163,7 +163,7 @@ static struct kobj_type bus_ktype = { .release = bus_release, }; -static int bus_uevent_filter (struct kset *kset,struct kobject *kobj) +static int bus_uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);drivers/base/core.c +5
-6@@ -2261,7 +2261,7 @@ static struct kobj_type device_ktype = { }; -static int dev_uevent_filter (struct kset *kset,struct kobject *kobj) +static int dev_uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);@@ -2275,7 +2275,7 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)return 0 ; } -static const char *dev_uevent_name (struct kset *kset,struct kobject *kobj) +static const char *dev_uevent_name (struct kobject *kobj) {struct device *dev =kobj_to_dev (kobj);@@ -2286,8 +2286,7 @@ static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj)return NULL ; } -static int dev_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int dev_uevent (struct kobject *kobj,struct kobj_uevent_env *env) {struct device *dev =kobj_to_dev (kobj);int retval =0 ;@@ -2382,7 +2381,7 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,/* respect filter */ if (kset->uevent_ops && kset->uevent_ops->filter) -if (!kset->uevent_ops->filter (kset, &dev->kobj)) +if (!kset->uevent_ops->filter (&dev->kobj)) goto out; env =kzalloc (sizeof (struct kobj_uevent_env ),GFP_KERNEL );@@ -2390,7 +2389,7 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,return -ENOMEM ;/* let the kset specific function add its keys */ - retval = kset->uevent_ops->uevent (kset, &dev->kobj, env); + retval = kset->uevent_ops->uevent (&dev->kobj, env);if (retval) goto out;drivers/dma-buf/dma-buf-sysfs-stats.c +1
-1@@ -132,7 +132,7 @@ void dma_buf_stats_teardown(struct dma_buf *dmabuf)/* Statistics files do not need to send uevents. */ -static int dmabuf_sysfs_uevent_filter (struct kset *kset,struct kobject *kobj) +static int dmabuf_sysfs_uevent_filter (struct kobject *kobj) {return 0 ; }fs/dlm/lockspace.c +1
-2@@ -216,8 +216,7 @@ static int do_uevent(struct dlm_ls *ls, int in)return ls->ls_uevent_result; } -static int dlm_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int dlm_uevent (struct kobject *kobj,struct kobj_uevent_env *env) { struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);fs/gfs2/sys.c +1
-2@@ -767,8 +767,7 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)wait_for_completion (&sdp->sd_kobj_unregister); } -static int gfs2_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int gfs2_uevent (struct kobject *kobj,struct kobj_uevent_env *env) { struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);struct super_block *s = sdp->sd_vfs;include/linux/kobject.h +3
-4@@ -153,10 +153,9 @@ struct kobj_uevent_env { };struct kset_uevent_ops { -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); +int (*const filter)(struct kobject *kobj); +const char *(*const name)(struct kobject *kobj); +int (*const uevent)(struct kobject *kobj,struct kobj_uevent_env *env); };struct kobj_attribute {kernel/params.c +1
-1@@ -926,7 +926,7 @@ static const struct sysfs_ops module_sysfs_ops = { .store = module_attr_store, }; -static int uevent_filter (struct kset *kset,struct kobject *kobj) +static int uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);lib/kobject_uevent.c +3
-4@@ -501,7 +501,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, }/* skip the event, if the filter returns zero. */ if (uevent_ops && uevent_ops->filter) -if (!uevent_ops->filter (kset, kobj)) { +if (!uevent_ops->filter (kobj)) {pr_debug ("kobject: '%s' (%p): %s: filter function " "caused the event to drop!\n" ,kobject_name (kobj), kobj, __func__);@@ -510,7 +510,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,/* originating subsystem */ if (uevent_ops && uevent_ops->name) - subsystem = uevent_ops->name (kset, kobj); + subsystem = uevent_ops->name (kobj);else subsystem =kobject_name (&kset->kobj);if (!subsystem) {@@ -554,7 +554,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,/* let the kset specific function add its stuff */ if (uevent_ops && uevent_ops->uevent) { - retval = uevent_ops->uevent (kset, kobj, env); + retval = uevent_ops->uevent (kobj, env);if (retval) { pr_debug("kobject: '%s' (%p): %s: uevent() returned " "%d\n", kobject_name(kobj), kobj, --2.34.1
Quoted 3 lines · Greg Kroah-Hartman
There is no need to pass the pointer to the kset in the struct
kset_uevent_opscallbacks as no one uses it, so just remove that pointer entirely.
In the future, if someone needs the kset they can always find it by looking for the first non-null kset in the kobject or its parent chain, right? IOW, we're not losing any information by removing this.
Quoted 4 lines
Cc Rafael J. Wysocki <[email protected]>Cc Wedson Almeida Filho <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 218 lines
--- Documentation/core-api/kobject.rst | 7 +++---- Documentation/translations/zh_CN/core-api/kobject.rst | 7 +++---- drivers/base/bus.c | 2 +- drivers/base/core.c | 11 +++++------ drivers/dma-buf/dma-buf-sysfs-stats.c | 2 +- fs/dlm/lockspace.c | 3 +-- fs/gfs2/sys.c | 3 +-- include/linux/kobject.h | 7 +++---- kernel/params.c | 2 +- lib/kobject_uevent.c | 6 +++--- 10 files changed, 22 insertions(+), 28 deletions(-)Documentation/core-api/kobject.rst +3
-4@@ -373,10 +373,9 @@ If a kset wishes to control the uevent operations of the kobjects associated with it, it can use the struct kset_uevent_ops to handle it:: struct kset_uevent_ops { - 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); + int (* const filter)(struct kobject *kobj); + const char *(* const name)(struct kobject *kobj); + int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env); };Documentation/translations/zh_CN/core-api/kobject.rst +3
-4@@ -325,10 +325,9 @@ ksets 结构体kset_uevent_ops来处理它:: struct kset_uevent_ops { - 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); + int (* const filter)(struct kobject *kobj); + const char *(* const name)(struct kobject *kobj); + int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env); };drivers/base/bus.c +1
-1@@ -163,7 +163,7 @@ static struct kobj_type bus_ktype = { .release = bus_release, }; -static int bus_uevent_filter (struct kset *kset,struct kobject *kobj) +static int bus_uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);drivers/base/core.c +5
-6@@ -2261,7 +2261,7 @@ static struct kobj_type device_ktype = { }; -static int dev_uevent_filter (struct kset *kset,struct kobject *kobj) +static int dev_uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);@@ -2275,7 +2275,7 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)return 0 ; } -static const char *dev_uevent_name (struct kset *kset,struct kobject *kobj) +static const char *dev_uevent_name (struct kobject *kobj) {struct device *dev =kobj_to_dev (kobj);@@ -2286,8 +2286,7 @@ static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj)return NULL ; } -static int dev_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int dev_uevent (struct kobject *kobj,struct kobj_uevent_env *env) {struct device *dev =kobj_to_dev (kobj);int retval =0 ;@@ -2382,7 +2381,7 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,/* respect filter */ if (kset->uevent_ops && kset->uevent_ops->filter) -if (!kset->uevent_ops->filter (kset, &dev->kobj)) +if (!kset->uevent_ops->filter (&dev->kobj)) goto out; env =kzalloc (sizeof (struct kobj_uevent_env ),GFP_KERNEL );@@ -2390,7 +2389,7 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,return -ENOMEM ;/* let the kset specific function add its keys */ - retval = kset->uevent_ops->uevent (kset, &dev->kobj, env); + retval = kset->uevent_ops->uevent (&dev->kobj, env);if (retval) goto out;drivers/dma-buf/dma-buf-sysfs-stats.c +1
-1@@ -132,7 +132,7 @@ void dma_buf_stats_teardown(struct dma_buf *dmabuf)/* Statistics files do not need to send uevents. */ -static int dmabuf_sysfs_uevent_filter (struct kset *kset,struct kobject *kobj) +static int dmabuf_sysfs_uevent_filter (struct kobject *kobj) {return 0 ; }fs/dlm/lockspace.c +1
-2@@ -216,8 +216,7 @@ static int do_uevent(struct dlm_ls *ls, int in)return ls->ls_uevent_result; } -static int dlm_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int dlm_uevent (struct kobject *kobj,struct kobj_uevent_env *env) { struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);fs/gfs2/sys.c +1
-2@@ -767,8 +767,7 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)wait_for_completion (&sdp->sd_kobj_unregister); } -static int gfs2_uevent (struct kset *kset,struct kobject *kobj, -struct kobj_uevent_env *env) +static int gfs2_uevent (struct kobject *kobj,struct kobj_uevent_env *env) { struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);struct super_block *s = sdp->sd_vfs;include/linux/kobject.h +3
-4@@ -153,10 +153,9 @@ struct kobj_uevent_env { };struct kset_uevent_ops { -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); +int (*const filter)(struct kobject *kobj); +const char *(*const name)(struct kobject *kobj); +int (*const uevent)(struct kobject *kobj,struct kobj_uevent_env *env); };struct kobj_attribute {kernel/params.c +1
-1@@ -926,7 +926,7 @@ static const struct sysfs_ops module_sysfs_ops = { .store = module_attr_store, }; -static int uevent_filter (struct kset *kset,struct kobject *kobj) +static int uevent_filter (struct kobject *kobj) {const struct kobj_type *ktype =get_ktype (kobj);lib/kobject_uevent.c +3
-3@@ -501,7 +501,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, }/* skip the event, if the filter returns zero. */ if (uevent_ops && uevent_ops->filter) -if (!uevent_ops->filter (kset, kobj)) { +if (!uevent_ops->filter (kobj)) {pr_debug ("kobject: '%s' (%p): %s: filter function " "caused the event to drop!\n" ,kobject_name (kobj), kobj, __func__);@@ -510,7 +510,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,/* originating subsystem */ if (uevent_ops && uevent_ops->name) - subsystem = uevent_ops->name (kset, kobj); + subsystem = uevent_ops->name (kobj);else subsystem =kobject_name (&kset->kobj);if (!subsystem) {@@ -554,7 +554,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,/* let the kset specific function add its stuff */ if (uevent_ops && uevent_ops->uevent) { - retval = uevent_ops->uevent (kset, kobj, env); + retval = uevent_ops->uevent (kobj, env);if (retval) { pr_debug("kobject: '%s' (%p): %s: uevent() returned " "%d\n", kobject_name(kobj), kobj,Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerQuoted 8 lines · Wedson Almeida Filho
Quoted 3 lines · Greg Kroah-Hartman
There is no need to pass the pointer to the kset in the struct
kset_uevent_opscallbacks as no one uses it, so just remove that pointer entirely.In the future, if someone needs the kset they can always find it by looking for the first non-null kset in the kobject or its parent chain, right? IOW, we're not losing any information by removing this.
Or even easier, we can add it back if needed :)
Quoted 6 lines
Quoted 4 lines
Cc Rafael J. Wysocki <[email protected]>Cc Wedson Almeida Filho <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Reviewed-by Wedson Almeida Filho <[email protected]>
Thanks for the review.
greg k-h