All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] regmap: irq: Use one way of setting all bits in the register
@ 2025-02-06 16:29 Andy Shevchenko
  2025-02-06 16:51 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-02-06 16:29 UTC (permalink / raw)
  To: Mark Brown, Matti Vaittinen, linux-kernel
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Andy Shevchenko

Currently there are two ways of how we represent all bits set, i.e.
UINT_MAX and GENMASK(31, 0). Use the latter as the single way of
doing that, which is crystal clear on how many bits we are talking
about.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/regmap/regmap-irq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 0bcd81389a29..c5fda76cd27e 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -166,7 +166,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 				ret = regmap_write(map, reg, d->mask_buf[i]);
 			if (d->chip->clear_ack) {
 				if (d->chip->ack_invert && !ret)
-					ret = regmap_write(map, reg, UINT_MAX);
+					ret = regmap_write(map, reg, GENMASK(31, 0));
 				else if (!ret)
 					ret = regmap_write(map, reg, 0);
 			}
@@ -480,7 +480,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
 						data->status_buf[i]);
 			if (chip->clear_ack) {
 				if (chip->ack_invert && !ret)
-					ret = regmap_write(map, reg, UINT_MAX);
+					ret = regmap_write(map, reg, GENMASK(31, 0));
 				else if (!ret)
 					ret = regmap_write(map, reg, 0);
 			}
@@ -847,7 +847,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
 					d->status_buf[i] & d->mask_buf[i]);
 			if (chip->clear_ack) {
 				if (chip->ack_invert && !ret)
-					ret = regmap_write(map, reg, UINT_MAX);
+					ret = regmap_write(map, reg, GENMASK(31, 0));
 				else if (!ret)
 					ret = regmap_write(map, reg, 0);
 			}
-- 
2.43.0.rc1.1336.g36b5255a03ac


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] regmap: irq: Use one way of setting all bits in the register
  2025-02-06 16:29 [PATCH v1 1/1] regmap: irq: Use one way of setting all bits in the register Andy Shevchenko
@ 2025-02-06 16:51 ` Mark Brown
  2025-02-06 19:00   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2025-02-06 16:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Matti Vaittinen, linux-kernel, Greg Kroah-Hartman,
	Rafael J. Wysocki, Danilo Krummrich

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

On Thu, Feb 06, 2025 at 06:29:33PM +0200, Andy Shevchenko wrote:
> Currently there are two ways of how we represent all bits set, i.e.
> UINT_MAX and GENMASK(31, 0). Use the latter as the single way of
> doing that, which is crystal clear on how many bits we are talking
> about.

I think I'd rather go to UINT_MAX since it's more obviously correct if
we see platforms with int that isn't 32 bits.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] regmap: irq: Use one way of setting all bits in the register
  2025-02-06 16:51 ` Mark Brown
@ 2025-02-06 19:00   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-02-06 19:00 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matti Vaittinen, linux-kernel, Greg Kroah-Hartman,
	Rafael J. Wysocki, Danilo Krummrich

On Thu, Feb 06, 2025 at 04:51:35PM +0000, Mark Brown wrote:
> On Thu, Feb 06, 2025 at 06:29:33PM +0200, Andy Shevchenko wrote:
> > Currently there are two ways of how we represent all bits set, i.e.
> > UINT_MAX and GENMASK(31, 0). Use the latter as the single way of
> > doing that, which is crystal clear on how many bits we are talking
> > about.
> 
> I think I'd rather go to UINT_MAX since it's more obviously correct if
> we see platforms with int that isn't 32 bits.

Okay!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-06 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-06 16:29 [PATCH v1 1/1] regmap: irq: Use one way of setting all bits in the register Andy Shevchenko
2025-02-06 16:51 ` Mark Brown
2025-02-06 19:00   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.