Subject: Re: [PATCH] net: sysfs: Fix weird usage of class's namespace relevant fields

From: Simon Horman <[email-masked]>
Date: Fri, 6 Sep 2024 11:21:50 +0100

On Thu, Sep 05, 2024 at 07:35:38AM +0800, Zijun Hu wrote:
> From: Zijun Hu <[email-masked]>
> 
> Device class has two namespace relevant fields which are associated by
> the following usage:
> 
> struct class {
> 	...
> 	const struct kobj_ns_type_operations *ns_type;
> 	const void *(*namespace)(const struct device *dev);
> 	...
> }
> if (dev->class && dev->class->ns_type)
> 	dev->class->namespace(dev);
> 
> The usage looks weird since it checks @ns_type but calls namespace()
> it is found for all existing class definitions that the other filed is
> also assigned once one is assigned in current kernel tree, so fix this
> weird usage by checking @namespace to call namespace().
> 
> Signed-off-by: Zijun Hu <[email-masked]>
> ---
> driver-core tree has similar fix as shown below:
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=a169a663bfa8198f33a5c1002634cc89e5128025

Thanks,

I agree that this change is consistent with the one at the link above.
And that, given your explanation there and here, this change
makes sense.

Reviewed-by: Simon Horman <[email-masked]>

I don't think there is a need to repost because of this, but for future
reference, please keep in mind that patches like this - non bug fixes for
Networking code - should, in general, be targeted at net-next.

Subject: [PATCH net-next] ...

See: https://docs.kernel.org/process/maintainer-netdev.html