Skip to contentSkip to conversation

mISDN: remove unneeded mISDN_class_release()

PATCH In review Greg Kroah-Hartman 3 participants 6 messages Mar 29, 2023 – Mar 31, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mISDN: remove unneeded mISDN_class_release()

The mISDN_class_release() is not needed at all, as the class structure is static, and it does not actually do anything either, so it is safe to remove as struct class does not require a release callback.

---
Note: I would like to take this through the driver-core tree as I have later struct class cleanups that depend on this change being made to the tree if that's ok with the maintainer of this file.

 drivers/isdn/mISDN/core.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/isdn/mISDN/core.c +0 -6
index f5989c9907ee..ab8513a7acd5 100644
@@ -152,17 +152,11 @@ static int mISDN_uevent(const struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
-static void mISDN_class_release(struct class *cls)
-{
-	/* do nothing, it's static */
-}
-
 static struct class mISDN_class = {
 	.name = "mISDN",
 	.dev_uevent = mISDN_uevent,
 	.dev_groups = mISDN_groups,
 	.dev_release = mISDN_dev_release,
-	.class_release = mISDN_class_release,
 };
 
 static int
Signature · 1 line
2.40.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Greg Kroah-Hartman

The mISDN_class_release() is not needed at all, as the class structure is static, and it does not actually do anything either, so it is safe to remove as struct class does not require a release callback.

Quoted 7 lines

---
Note: I would like to take this through the driver-core tree as I have later struct class cleanups that depend on this change being made to the tree if that's ok with the maintainer of this file.

 drivers/isdn/mISDN/core.c | 6 ------
 1 file changed, 6 deletions(-)

I assume this will hit the following in drivers/base/class.c:class_release():

        if (class->class_release)
                class->class_release(class);
        else
		pr_debug("class '%s' does not have a release() function, "
		"be careful\n", class->name);

So I also assume that you are being careful :)

Quoted 25 lines
drivers/isdn/mISDN/core.c +0 -6
index f5989c9907ee..ab8513a7acd5 100644
@@ -152,17 +152,11 @@ static int mISDN_uevent(const struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
-static void mISDN_class_release(struct class *cls)
-{
-	/* do nothing, it's static */
-}
-
 static struct class mISDN_class = {
 	.name = "mISDN",
 	.dev_uevent = mISDN_uevent,
 	.dev_groups = mISDN_groups,
 	.dev_release = mISDN_dev_release,
-	.class_release = mISDN_class_release,
 };
 
 static int
Signature · 1 line
2.40.0
#2 lore raw
Quoted 18 lines · Simon Horman
Quoted 7 lines · Greg Kroah-Hartman

The mISDN_class_release() is not needed at all, as the class structure is static, and it does not actually do anything either, so it is safe to remove as struct class does not require a release callback.

Quoted 7 lines

---
Note: I would like to take this through the driver-core tree as I have later struct class cleanups that depend on this change being made to the tree if that's ok with the maintainer of this file.

 drivers/isdn/mISDN/core.c | 6 ------
 1 file changed, 6 deletions(-)

I assume this will hit the following in drivers/base/class.c:class_release():

Quoted 7 lines
        if (class->class_release)
                class->class_release(class);
        else
		pr_debug("class '%s' does not have a release() function, "
		"be careful\n", class->name);

So I also assume that you are being careful :)

Yes, I am :)

I need to remove that debug line soon as I'm moving all struct class instances to be static and in read-only memory, which would mean that no release function is needed at all for them. Give me a few hundred more commits to get there...

thanks for the review!

greg k-h

#3 lore raw
Quoted 25 lines · Greg Kroah-Hartman
Quoted 24 lines · Simon Horman
Quoted 7 lines · Greg Kroah-Hartman

The mISDN_class_release() is not needed at all, as the class structure is static, and it does not actually do anything either, so it is safe to remove as struct class does not require a release callback.

Quoted 7 lines

---
Note: I would like to take this through the driver-core tree as I have later struct class cleanups that depend on this change being made to the tree if that's ok with the maintainer of this file.

 drivers/isdn/mISDN/core.c | 6 ------
 1 file changed, 6 deletions(-)

I assume this will hit the following in drivers/base/class.c:class_release():

        if (class->class_release)
                class->class_release(class);
        else
		pr_debug("class '%s' does not have a release() function, "
		"be careful\n", class->name);
Quoted 8 lines
Quoted 1 line

So I also assume that you are being careful :)

Yes, I am :)

I need to remove that debug line soon as I'm moving all struct class instances to be static and in read-only memory, which would mean that no release function is needed at all for them. Give me a few hundred more commits to get there...

Excellent, good luck with your journey of a few hundred patches.

maintainer Acked-by on v1 1/1
#4 lore raw
In reply to Greg Kroah-Hartman
Quoted 3 lines · On Wed, 29 Mar 2023 08:01:27 +0200 Greg Kroah-Hartman wrote:

Note: I would like to take this through the driver-core tree as I have later struct class cleanups that depend on this change being made to the tree if that's ok with the maintainer of this file.

It must be on top of .owner removal? Cause it doesn't apply for us:

#5 lore raw
Quoted 8 lines · Jakub Kicinski
Quoted 3 lines · On Wed, 29 Mar 2023 08:01:27 +0200 Greg Kroah-Hartman wrote:

Note: I would like to take this through the driver-core tree as I have later struct class cleanups that depend on this change being made to the tree if that's ok with the maintainer of this file.

It must be on top of .owner removal? Cause it doesn't apply for us:

Ah, yeah, it is, that's in my tree already.

thanks for the ack!

greg k-h