Re: [PATCH v2] misc/pvpanic: share the shutdown handler across devices

From: Greg Kroah-Hartman

Date: Wed Nov 25 2026 - 05:06:54 EST


On Wed, Nov 25, 2026 at 05:15:20PM +0800, Zhu GuangLei wrote:
> @@ -141,6 +151,8 @@ static ssize_t events_show(struct device *dev, struct device_attribute *attr, ch
> {
> struct pvpanic_instance *pi = dev_get_drvdata(dev);
>
> + guard(mutex)(&pvpanic_sys_off_lock);
> +
> return sysfs_emit(buf, "%x\n", pi->events);
> }

Why do you need a lock to read a single value that could change right
after it is read?

thanks,

greg k-h