Skip to contentSkip to conversation

kobject: remove unused kobject action

PATCH Superseded Garrit Franke 2 participants 5 messages Jul 13, 2020 – Jul 16, 2020 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kobject: remove unused kobject action

I noticed that the KOBJ_MAX action is never used. Does it serve any purpose, or can it be removed? As far as I know, Kobjects shouldn't be used for drivers and more higher level abstraction layers, so I figured it isn't used by user-provided code either.

Regards
Garrit Franke

---
 include/linux/kobject.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/kobject.h +1 -2
index 6cba088bee24..fd99c5d2d8b7 100644
@@ -58,8 +58,7 @@ enum kobject_action {
 	KOBJ_ONLINE,
 	KOBJ_OFFLINE,
 	KOBJ_BIND,
-	KOBJ_UNBIND,
-	KOBJ_MAX
+	KOBJ_UNBIND
 };
 
 struct kobject {
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 2 lines · Garrit Franke

I noticed that the KOBJ_MAX action is never used. Does it serve any purpose, or can it be removed?

Don't ask questions in a changelog comment that you don't also answer :)

Quoted 3 lines

As far as I know, Kobjects shouldn't be
used for drivers and more higher level abstraction layers, so I figured it isn't used by user-provided code either.

Userspace sees these uevents, right?

Quoted 3 lines

Regards
Garrit Franke

This isn't needed in a changelog text.

Try running and testing this a bit more before sending it for inclusion please.

Quoted 11 lines
---
 include/linux/kobject.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/kobject.h +0 -0
index 6cba088bee24..fd99c5d2d8b7 100644

include/linux/kobject.h enum kobject_action { · line 61

Quoted 6 lines
include/linux/kobject.h +1 -2
@@ -58,8 +58,7 @@ enum kobject_action {
 	KOBJ_ONLINE,
 	KOBJ_OFFLINE,
 	KOBJ_BIND,
-	KOBJ_UNBIND,
-	KOBJ_MAX
+	KOBJ_UNBIND

No need to drop that trailing ','

thanks,

greg k-h

#2 lore raw

PATCH v2 1/1 kobject: remove unused KOBJ_MAX action

The loop in lib/kobject_uevent.c that checked for KOBJ_MAX is no longer present, we do a much more sane ARRAY_SIZE() check instead (see 5c5daf657cb5). Therefore, the KOBJ_MAX is not used anymore.

---
 include/linux/kobject.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/kobject.h +0 -1
index 6cba088bee24..ea30529fba08 100644
@@ -59,7 +59,6 @@ enum kobject_action {
 	KOBJ_OFFLINE,
 	KOBJ_BIND,
 	KOBJ_UNBIND,
-	KOBJ_MAX
 };
 
 struct kobject {
Signature · 1 line
2.25.1
maintainer
#3 lore raw

Re: [PATCH v2] kobject: remove unused KOBJ_MAX action

Quoted 2 lines · Garrit Franke

The loop in lib/kobject_uevent.c that checked for KOBJ_MAX is no longer present, we do a much more sane ARRAY_SIZE() check instead (see 5c5daf657cb5).

Odd line wrapping :(

When you specify a git commit, use the format as documented in the submitting patches file:
5c5daf657cb5 ("Driver core: exclude kobject_uevent.c for !CONFIG_HOTPLUG")

Quoted 1 line

Therefore, the KOBJ_MAX is not used anymore.

That sentence does not make much sense :(

thanks,

greg k-h

#4 lore raw

PATCH v3 1/1 kobject: remove unused KOBJ_MAX action

The loop in libb/kobj_uevent.c that checked for KOBBJ_MAX is no longer present, we do a much more sane ARRAY_SIZE() check instead. See 5c5daf657cb5 ("Driver core: exclude kobject_uevent.c for !CONFIG_HOTPLUG").

---
 include/linux/kobject.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/kobject.h +0 -1
index 6cba088bee24..ea30529fba08 100644
@@ -59,7 +59,6 @@ enum kobject_action {
 	KOBJ_OFFLINE,
 	KOBJ_BIND,
 	KOBJ_UNBIND,
-	KOBJ_MAX
 };
 
 struct kobject {
Signature · 1 line
2.25.1