Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-19 Thread Jonathan Cameron
On Thu, 14 Dec 2023 22:25:27 -0700 Vishal Verma wrote: > Use the guard(device) macro to lock a 'struct device', and unlock it > automatically when going out of scope using Scope Based Resource > Management semantics. A lot of the sysfs attribute writes in > drivers/dax/bus.c benefit from a

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-15 Thread gre...@linuxfoundation.org
On Fri, Dec 15, 2023 at 05:32:50PM +, Verma, Vishal L wrote: > On Fri, 2023-12-15 at 09:15 -0800, Dan Williams wrote: > > Greg Kroah-Hartman wrote: > > > On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > > > > Use the guard(device) macro to lock a 'struct device', and unlock it >

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-15 Thread Verma, Vishal L
On Fri, 2023-12-15 at 09:15 -0800, Dan Williams wrote: > Greg Kroah-Hartman wrote: > > On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > > > Use the guard(device) macro to lock a 'struct device', and unlock it > > > automatically when going out of scope using Scope Based Resource > >

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-15 Thread Dan Williams
Greg Kroah-Hartman wrote: > On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > > Use the guard(device) macro to lock a 'struct device', and unlock it > > automatically when going out of scope using Scope Based Resource > > Management semantics. A lot of the sysfs attribute writes in >

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-15 Thread gre...@linuxfoundation.org
On Fri, Dec 15, 2023 at 06:33:58AM +, Verma, Vishal L wrote: > On Fri, 2023-12-15 at 05:56 +, Matthew Wilcox wrote: > > On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > > > @@ -294,13 +294,10 @@ static ssize_t available_size_show(struct device > > > *dev, > > >  

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-14 Thread Greg Kroah-Hartman
On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > Use the guard(device) macro to lock a 'struct device', and unlock it > automatically when going out of scope using Scope Based Resource > Management semantics. A lot of the sysfs attribute writes in > drivers/dax/bus.c benefit from a

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-14 Thread Verma, Vishal L
On Fri, 2023-12-15 at 05:56 +, Matthew Wilcox wrote: > On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > > @@ -294,13 +294,10 @@ static ssize_t available_size_show(struct device *dev, > > struct device_attribute *attr, char *buf) > >  { > > struct

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-14 Thread Matthew Wilcox
On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > @@ -294,13 +294,10 @@ static ssize_t available_size_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > struct dax_region *dax_region = dev_get_drvdata(dev); > - unsigned long long size;

[PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-14 Thread Vishal Verma
Use the guard(device) macro to lock a 'struct device', and unlock it automatically when going out of scope using Scope Based Resource Management semantics. A lot of the sysfs attribute writes in drivers/dax/bus.c benefit from a cleanup using these, so change these where applicable. Cc: Joao