Re: [RFC PATCH v5 2/2] Use kernfs_break_active_protection() for device online store callbacks

From: Tejun Heo
Date: Mon Apr 21 2014 - 18:46:17 EST


Hello,

On Mon, Apr 21, 2014 at 05:23:50PM +0800, Li Zhong wrote:

Proper /** function comment would be nice.

> +struct kernfs_node *lock_device_hotplug_sysfs(struct device *dev,
> + struct device_attribute *attr)

I can see why you did this but let's please not require the user of
this function to see how the thing is working internally. Let's
return int and keep track of (or look up again) the kernfs_node
internally.

> {
...
> + /*
> + * We assume device_hotplug_lock must be acquired before removing

Is this assumption true? If so, can we add lockdep assertions in
places to verify and enforce this? If not, aren't we just feeling
good when the reality is broken?

...

Function comment please.
> +void unlock_device_hotplug_sysfs(struct device *dev,
> + struct kernfs_node *kn)
> +{
> + unlock_device_hotplug();
> + kernfs_unbreak_active_protection(kn);
> + put_device(dev);
> + kernfs_put(kn);
> }

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/