Message ID | ca710d14a710fee44f7911f2a84b6a55570561ee.1679323449.git.william.gray@linaro.org |
---|---|
State | Accepted |
Commit | b5c506b163d305a8b6d5ead562699d3fc9935498 |
Headers | show |
Series | Drop map from handle_mask_sync() parameters | expand |
On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote: > On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote: > > A private data structure struct dio48e_gpio is introduced to facilitate > > passage of the regmap and IRQ mask state for the device to the callback > > dio48e_handle_mask_sync(). This is in preparation for the removal of the > > handle_mask_sync() map parameter in a subsequent patch. > > What's the story with this patch? Currently dio48e_handle_mask_sync() uses the map argument in its implementation. Once the map parameter is removed, the current implementation of dio48e_handle_mask_sync() will no longer build, so we must adjust the implementation to no longer depend on map. The reason for this particular patch is to keep the reimplementation of dio48e_handle_mask_sync() separate so that the handle_mask_sync() map parameter removal patch is simple. This keeps the git history clear and allows us to address any possible regressions to 104-dio-48e separately without affecting the handle_mask_sync() API. William Breathitt Gray
On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote: > A private data structure struct dio48e_gpio is introduced to facilitate > passage of the regmap and IRQ mask state for the device to the callback > dio48e_handle_mask_sync(). This is in preparation for the removal of the > handle_mask_sync() map parameter in a subsequent patch. What's the story with this patch?
On Tue, Apr 11, 2023 at 02:36:23PM -0400, William Breathitt Gray wrote: > On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote: > > On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote: > > > A private data structure struct dio48e_gpio is introduced to facilitate > > > passage of the regmap and IRQ mask state for the device to the callback > > > dio48e_handle_mask_sync(). This is in preparation for the removal of the > > > handle_mask_sync() map parameter in a subsequent patch. > > What's the story with this patch? > Currently dio48e_handle_mask_sync() uses the map argument in its > implementation. Once the map parameter is removed, the current > implementation of dio48e_handle_mask_sync() will no longer build, so we > must adjust the implementation to no longer depend on map. I mean what's the story with getting this patch applied? It doesn't seem to have been reviewed...
On Tue, Apr 11, 2023 at 10:15:54PM +0100, Mark Brown wrote: > On Tue, Apr 11, 2023 at 02:36:23PM -0400, William Breathitt Gray wrote: > > On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote: > > > On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote: > > > > A private data structure struct dio48e_gpio is introduced to facilitate > > > > passage of the regmap and IRQ mask state for the device to the callback > > > > dio48e_handle_mask_sync(). This is in preparation for the removal of the > > > > handle_mask_sync() map parameter in a subsequent patch. > > > > What's the story with this patch? > > > Currently dio48e_handle_mask_sync() uses the map argument in its > > implementation. Once the map parameter is removed, the current > > implementation of dio48e_handle_mask_sync() will no longer build, so we > > must adjust the implementation to no longer depend on map. > > I mean what's the story with getting this patch applied? It doesn't > seem to have been reviewed... I'm sorry, I forgot to add Linus' tag from v2 [0]. Linus, would you confirm you're still okay with this patch? William Breathitt Gray [0] https://lore.kernel.org/all/CACRpkdYFSu3DAY4+EeoRk4cTkypgWg1C=UgforDO7mT96f0GDQ@mail.gmail.com/
On Tue, Apr 11, 2023 at 11:35 PM William Breathitt Gray <william.gray@linaro.org> wrote: > On Tue, Apr 11, 2023 at 10:15:54PM +0100, Mark Brown wrote: > > On Tue, Apr 11, 2023 at 02:36:23PM -0400, William Breathitt Gray wrote: > > > On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote: > > > > On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote: > > > > > A private data structure struct dio48e_gpio is introduced to facilitate > > > > > passage of the regmap and IRQ mask state for the device to the callback > > > > > dio48e_handle_mask_sync(). This is in preparation for the removal of the > > > > > handle_mask_sync() map parameter in a subsequent patch. > > > > > > What's the story with this patch? > > > > > Currently dio48e_handle_mask_sync() uses the map argument in its > > > implementation. Once the map parameter is removed, the current > > > implementation of dio48e_handle_mask_sync() will no longer build, so we > > > must adjust the implementation to no longer depend on map. > > > > I mean what's the story with getting this patch applied? It doesn't > > seem to have been reviewed... > > I'm sorry, I forgot to add Linus' tag from v2 [0]. Linus, would you > confirm you're still okay with this patch? Oh of course. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index 74e2721f2613..3516321c92b0 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -99,13 +99,23 @@ static const struct regmap_irq dio48e_regmap_irqs[] = { DIO48E_REGMAP_IRQ(0), DIO48E_REGMAP_IRQ(1), }; +/** + * struct dio48e_gpio - GPIO device private data structure + * @map: Regmap for the device + * @irq_mask: Current IRQ mask state on the device + */ +struct dio48e_gpio { + struct regmap *map; + unsigned int irq_mask; +}; + static int dio48e_handle_mask_sync(struct regmap *const map, const int index, const unsigned int mask_buf_def, const unsigned int mask_buf, void *const irq_drv_data) { - unsigned int *const irq_mask = irq_drv_data; - const unsigned int prev_mask = *irq_mask; + struct dio48e_gpio *const dio48egpio = irq_drv_data; + const unsigned int prev_mask = dio48egpio->irq_mask; int err; unsigned int val; @@ -114,19 +124,19 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index, return 0; /* remember the current mask for the next mask sync */ - *irq_mask = mask_buf; + dio48egpio->irq_mask = mask_buf; /* if all previously masked, enable interrupts when unmasking */ if (prev_mask == mask_buf_def) { - err = regmap_write(map, DIO48E_CLEAR_INTERRUPT, 0x00); + err = regmap_write(dio48egpio->map, DIO48E_CLEAR_INTERRUPT, 0x00); if (err) return err; - return regmap_write(map, DIO48E_ENABLE_INTERRUPT, 0x00); + return regmap_write(dio48egpio->map, DIO48E_ENABLE_INTERRUPT, 0x00); } /* if all are currently masked, disable interrupts */ if (mask_buf == mask_buf_def) - return regmap_read(map, DIO48E_DISABLE_INTERRUPT, &val); + return regmap_read(dio48egpio->map, DIO48E_DISABLE_INTERRUPT, &val); return 0; } @@ -167,7 +177,7 @@ static int dio48e_probe(struct device *dev, unsigned int id) struct regmap *map; int err; struct regmap_irq_chip *chip; - unsigned int irq_mask; + struct dio48e_gpio *dio48egpio; struct regmap_irq_chip_data *chip_data; if (!devm_request_region(dev, base[id], DIO48E_EXTENT, name)) { @@ -185,12 +195,14 @@ static int dio48e_probe(struct device *dev, unsigned int id) return dev_err_probe(dev, PTR_ERR(map), "Unable to initialize register map\n"); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); - if (!chip) + dio48egpio = devm_kzalloc(dev, sizeof(*dio48egpio), GFP_KERNEL); + if (!dio48egpio) return -ENOMEM; - chip->irq_drv_data = devm_kzalloc(dev, sizeof(irq_mask), GFP_KERNEL); - if (!chip->irq_drv_data) + dio48egpio->map = map; + + chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + if (!chip) return -ENOMEM; chip->name = name; @@ -205,6 +217,7 @@ static int dio48e_probe(struct device *dev, unsigned int id) chip->irqs = dio48e_regmap_irqs; chip->num_irqs = ARRAY_SIZE(dio48e_regmap_irqs); chip->handle_mask_sync = dio48e_handle_mask_sync; + chip->irq_drv_data = dio48egpio; /* Initialize to prevent spurious interrupts before we're ready */ err = dio48e_irq_init_hw(map);
A private data structure struct dio48e_gpio is introduced to facilitate passage of the regmap and IRQ mask state for the device to the callback dio48e_handle_mask_sync(). This is in preparation for the removal of the handle_mask_sync() map parameter in a subsequent patch. Signed-off-by: William Breathitt Gray <william.gray@linaro.org> --- Changes in v3: - Inline dio48gpio->map usage in dio48e_handle_mask_sync() to avoid redefining map parameter drivers/gpio/gpio-104-dio-48e.c | 35 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)