* [PATCH] dax: use assign_bit() where applicable
@ 2026-09-19 13:07 Peng Fan (OSS)
2026-09-21 8:24 ` Gupta, Pankaj
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Peng Fan (OSS) @ 2026-09-19 13:07 UTC (permalink / raw)
To: Dan Williams, Vishal Verma, Dave Jiang, Alison Schofield
Cc: linux-kernel, Peng Fan, nvdimm, linux-cxl
From: Peng Fan <peng.fan@nxp.com>
Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/dax/super.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 45f84b0eb909..60c4aec52ae1 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
void dax_write_cache(struct dax_device *dax_dev, bool wc)
{
- if (wc)
- set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
- else
- clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
+ assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
}
EXPORT_SYMBOL_GPL(dax_write_cache);
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] dax: use assign_bit() where applicable
2026-09-19 13:07 [PATCH] dax: use assign_bit() where applicable Peng Fan (OSS)
@ 2026-09-21 8:24 ` Gupta, Pankaj
2026-09-21 23:08 ` Jonathan Cameron
2026-09-21 23:10 ` Dave Jiang
2026-10-08 2:02 ` Alison Schofield
2 siblings, 1 reply; 7+ messages in thread
From: Gupta, Pankaj @ 2026-09-21 8:24 UTC (permalink / raw)
To: Peng Fan (OSS), Dan Williams, Vishal Verma, Dave Jiang,
Alison Schofield
Cc: linux-kernel, Peng Fan, nvdimm, linux-cxl
> [You don't often get email from peng.fan@oss.nxp.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Peng Fan <peng.fan@nxp.com>
>
> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
> ---
> drivers/dax/super.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 45f84b0eb909..60c4aec52ae1 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
>
> void dax_write_cache(struct dax_device *dax_dev, bool wc)
> {
> - if (wc)
> - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> - else
> - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> + assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
> }
> EXPORT_SYMBOL_GPL(dax_write_cache);
>
> --
> 2.51.0
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dax: use assign_bit() where applicable
2026-09-21 8:24 ` Gupta, Pankaj
@ 2026-09-21 23:08 ` Jonathan Cameron
2026-10-08 1:59 ` Alison Schofield
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2026-09-21 23:08 UTC (permalink / raw)
To: Gupta, Pankaj
Cc: Peng Fan (OSS), Dan Williams, Vishal Verma, Dave Jiang,
Alison Schofield, linux-kernel, Peng Fan, nvdimm, linux-cxl
On Mon, 21 Sep 2026 10:24:51 +0200
"Gupta, Pankaj" <pankaj.gupta@amd.com> wrote:
> > [You don't often get email from peng.fan@oss.nxp.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> >
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>
> Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
A bit marginal wrt to churn but a good change in general.
Up to DAX maintainers on whether they want this type of small
focused improvement.
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
>
> > ---
> > drivers/dax/super.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> > index 45f84b0eb909..60c4aec52ae1 100644
> > --- a/drivers/dax/super.c
> > +++ b/drivers/dax/super.c
> > @@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
> >
> > void dax_write_cache(struct dax_device *dax_dev, bool wc)
> > {
> > - if (wc)
> > - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> > - else
> > - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> > + assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
> > }
> > EXPORT_SYMBOL_GPL(dax_write_cache);
> >
> > --
> > 2.51.0
> >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dax: use assign_bit() where applicable
2026-09-19 13:07 [PATCH] dax: use assign_bit() where applicable Peng Fan (OSS)
2026-09-21 8:24 ` Gupta, Pankaj
@ 2026-09-21 23:10 ` Dave Jiang
2026-10-08 2:02 ` Alison Schofield
2 siblings, 0 replies; 7+ messages in thread
From: Dave Jiang @ 2026-09-21 23:10 UTC (permalink / raw)
To: Peng Fan (OSS), Dan Williams, Vishal Verma, Alison Schofield
Cc: linux-kernel, Peng Fan, nvdimm, linux-cxl
On 9/19/26 6:07 AM, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/dax/super.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 45f84b0eb909..60c4aec52ae1 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
>
> void dax_write_cache(struct dax_device *dax_dev, bool wc)
> {
> - if (wc)
> - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> - else
> - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> + assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
> }
> EXPORT_SYMBOL_GPL(dax_write_cache);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dax: use assign_bit() where applicable
2026-09-21 23:08 ` Jonathan Cameron
@ 2026-10-08 1:59 ` Alison Schofield
2026-10-08 3:00 ` Peng Fan
0 siblings, 1 reply; 7+ messages in thread
From: Alison Schofield @ 2026-10-08 1:59 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Gupta, Pankaj, Peng Fan (OSS), Dan Williams, Vishal Verma,
Dave Jiang, linux-kernel, Peng Fan, nvdimm, linux-cxl
On Tue, Sep 22, 2026 at 12:08:13AM +0100, Jonathan Cameron wrote:
> On Mon, 21 Sep 2026 10:24:51 +0200
> "Gupta, Pankaj" <pankaj.gupta@amd.com> wrote:
>
> > > [You don't often get email from peng.fan@oss.nxp.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> > >
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> >
> > Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
>
> A bit marginal wrt to churn but a good change in general.
> Up to DAX maintainers on whether they want this type of small
> focused improvement.
I didn't see the improvement. When I peruse the file I see set_bit and
clear_bit, and now I see a couple of those obfuscated by a new
assign_bit, needlessly.
If Peng wants to come back around with a 'why' then I'd take another
look. I shared my NAK story here:
https://lore.kernel.org/lkml/asb3hGpSWVQk93cX@aschofie-mobl2.lan/
>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
>
> >
> > > ---
> > > drivers/dax/super.c | 5 +----
> > > 1 file changed, 1 insertion(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> > > index 45f84b0eb909..60c4aec52ae1 100644
> > > --- a/drivers/dax/super.c
> > > +++ b/drivers/dax/super.c
> > > @@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
> > >
> > > void dax_write_cache(struct dax_device *dax_dev, bool wc)
> > > {
> > > - if (wc)
> > > - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> > > - else
> > > - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> > > + assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
> > > }
> > > EXPORT_SYMBOL_GPL(dax_write_cache);
> > >
> > > --
> > > 2.51.0
> > >
> > >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dax: use assign_bit() where applicable
2026-09-19 13:07 [PATCH] dax: use assign_bit() where applicable Peng Fan (OSS)
2026-09-21 8:24 ` Gupta, Pankaj
2026-09-21 23:10 ` Dave Jiang
@ 2026-10-08 2:02 ` Alison Schofield
2 siblings, 0 replies; 7+ messages in thread
From: Alison Schofield @ 2026-10-08 2:02 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Dan Williams, Vishal Verma, Dave Jiang, linux-kernel, Peng Fan,
nvdimm, linux-cxl
On Sat, Sep 19, 2026 at 09:07:50PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
NAK
See also:
https://lore.kernel.org/lkml/asb3hGpSWVQk93cX@aschofie-mobl2.lan/
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/dax/super.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 45f84b0eb909..60c4aec52ae1 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
>
> void dax_write_cache(struct dax_device *dax_dev, bool wc)
> {
> - if (wc)
> - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> - else
> - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> + assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
> }
> EXPORT_SYMBOL_GPL(dax_write_cache);
>
> --
> 2.51.0
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dax: use assign_bit() where applicable
2026-10-08 1:59 ` Alison Schofield
@ 2026-10-08 3:00 ` Peng Fan
0 siblings, 0 replies; 7+ messages in thread
From: Peng Fan @ 2026-10-08 3:00 UTC (permalink / raw)
To: Alison Schofield
Cc: Jonathan Cameron, Gupta, Pankaj, Dan Williams, Vishal Verma,
Dave Jiang, linux-kernel, Peng Fan, nvdimm, linux-cxl
Hi Alison,
On Wed, Oct 07, 2026 at 06:59:48PM -0700, Alison Schofield wrote:
>On Tue, Sep 22, 2026 at 12:08:13AM +0100, Jonathan Cameron wrote:
>> On Mon, 21 Sep 2026 10:24:51 +0200
>> "Gupta, Pankaj" <pankaj.gupta@amd.com> wrote:
>>
>> > > [You don't often get email from peng.fan@oss.nxp.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>> > >
>> > > From: Peng Fan <peng.fan@nxp.com>
>> > >
>> > > Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>> > >
>> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> >
>> > Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
>>
>> A bit marginal wrt to churn but a good change in general.
>> Up to DAX maintainers on whether they want this type of small
>> focused improvement.
>
>I didn't see the improvement. When I peruse the file I see set_bit and
>clear_bit, and now I see a couple of those obfuscated by a new
>assign_bit, needlessly.
>
>If Peng wants to come back around with a 'why' then I'd take another
>look. I shared my NAK story here:
>
>https://lore.kernel.org/lkml/asb3hGpSWVQk93cX@aschofie-mobl2.lan/
Thanks for taking the time to explain, and for the link to your
earlier reply - that was useful context.
This patch was done by a cocci rule.
sorry for not providing a justification for this particular conversion or
making the intent clearer. Converting only some of the call sites leaves the
file with a mix of styles.
Free to drop the patch.
Thanks
Peng
>
>
>>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
>>
>> >
>> > > ---
>> > > drivers/dax/super.c | 5 +----
>> > > 1 file changed, 1 insertion(+), 4 deletions(-)
>> > >
>> > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c
>> > > index 45f84b0eb909..60c4aec52ae1 100644
>> > > --- a/drivers/dax/super.c
>> > > +++ b/drivers/dax/super.c
>> > > @@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
>> > >
>> > > void dax_write_cache(struct dax_device *dax_dev, bool wc)
>> > > {
>> > > - if (wc)
>> > > - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
>> > > - else
>> > > - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
>> > > + assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
>> > > }
>> > > EXPORT_SYMBOL_GPL(dax_write_cache);
>> > >
>> > > --
>> > > 2.51.0
>> > >
>> > >
>> >
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-10-08 2:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-19 13:07 [PATCH] dax: use assign_bit() where applicable Peng Fan (OSS)
2026-09-21 8:24 ` Gupta, Pankaj
2026-09-21 23:08 ` Jonathan Cameron
2026-10-08 1:59 ` Alison Schofield
2026-10-08 3:00 ` Peng Fan
2026-09-21 23:10 ` Dave Jiang
2026-10-08 2:02 ` Alison Schofield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox