Skip to contentSkip to conversation

gpio: 104-dio-48e: Utilize mask_buf_def in handle_mask_sync() callback

PATCH Applied William Breathitt Gray 2 participants 2 messages Feb 15, 2023 – Mar 6, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: 104-dio-48e: Utilize mask_buf_def in handle_mask_sync() callback

The mask_buf_def argument provides a mask of all the maskable lines. Utilize mask_buf_def rather than hardcode an "all_masked" mask.

---
 drivers/gpio/gpio-104-dio-48e.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpio-104-dio-48e.c +2 -3
index a3846faf3780..74e2721f2613 100644
@@ -106,7 +106,6 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 {
 	unsigned int *const irq_mask = irq_drv_data;
 	const unsigned int prev_mask = *irq_mask;
-	const unsigned int all_masked = GENMASK(1, 0);
 	int err;
 	unsigned int val;
 
@@ -118,7 +117,7 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 	*irq_mask = mask_buf;
 
 	/* if all previously masked, enable interrupts when unmasking */
-	if (prev_mask == all_masked) {
+	if (prev_mask == mask_buf_def) {
 		err = regmap_write(map, DIO48E_CLEAR_INTERRUPT, 0x00);
 		if (err)
 			return err;
@@ -126,7 +125,7 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 	}
 
 	/* if all are currently masked, disable interrupts */
-	if (mask_buf == all_masked)
+	if (mask_buf == mask_buf_def)
 		return regmap_read(map, DIO48E_DISABLE_INTERRUPT, &val);
 
 	return 0;

base-commit: 4827aae061337251bb91801b316157a78b845ec7

Signature · 1 line
2.39.1
#1 lore raw
Quoted 40 lines · William Breathitt Gray

The mask_buf_def argument provides a mask of all the maskable lines. Utilize mask_buf_def rather than hardcode an "all_masked" mask.

---
 drivers/gpio/gpio-104-dio-48e.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpio-104-dio-48e.c +2 -3
index a3846faf3780..74e2721f2613 100644
@@ -106,7 +106,6 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 {
        unsigned int *const irq_mask = irq_drv_data;
        const unsigned int prev_mask = *irq_mask;
-       const unsigned int all_masked = GENMASK(1, 0);
        int err;
        unsigned int val;
 
@@ -118,7 +117,7 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
        *irq_mask = mask_buf;
 
        /* if all previously masked, enable interrupts when unmasking */
-       if (prev_mask == all_masked) {
+       if (prev_mask == mask_buf_def) {
                err = regmap_write(map, DIO48E_CLEAR_INTERRUPT, 0x00);
                if (err)
                        return err;
@@ -126,7 +125,7 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
        }
 
        /* if all are currently masked, disable interrupts */
-       if (mask_buf == all_masked)
+       if (mask_buf == mask_buf_def)
                return regmap_read(map, DIO48E_DISABLE_INTERRUPT, &val);
 
        return 0;
Quoted 4 lines

base-commit: 4827aae061337251bb91801b316157a78b845ec7 --
2.39.1

Applied, thanks!

Bart