Skip to contentSkip to conversation

regmap: irq: Use one way of setting all bits in the register

PATCH Superseded Andy Shevchenko 2 participants 3 messages Feb 6, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: irq: Use one way of setting all bits in the register

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.

---
 drivers/base/regmap/regmap-irq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/base/regmap/regmap-irq.c +3 -3
index 0bcd81389a29..c5fda76cd27e 100644
@@ -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);
 			}
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
maintainer
#1 lore raw
Quoted 4 lines · 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.

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.

#2 lore raw
Quoted 8 lines · Mark Brown
Quoted 4 lines · 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.

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!

Signature · 2 lines
With Best Regards,
Andy Shevchenko