public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <william.gray@linaro.org>
To: broonie@kernel.org
Cc: linus.walleij@linaro.org, brgl@bgdev.pl,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH] regmap-irq: Drop map from handle_mask_sync() parameters
Date: Fri, 10 Mar 2023 07:14:45 -0500	[thread overview]
Message-ID: <ZAsfNel4835E+i6O@fedora> (raw)
In-Reply-To: <20230309232009.2938-1-william.gray@linaro.org>

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

On Thu, Mar 09, 2023 at 06:20:09PM -0500, William Breathitt Gray wrote:
> Remove the map parameter from the struct regmap_irq_chip callback
> handle_mask_sync() because it can be passed via the irq_drv_data
> parameter instead. The gpio-104-dio-48e driver is the only consumer of
> this callback and is thus updated accordingly.
> 
> Signed-off-by: William Breathitt Gray <william.gray@linaro.org>

[...]

> diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
> index a3846faf3..1de551677 100644
> --- a/drivers/gpio/gpio-104-dio-48e.c
> +++ b/drivers/gpio/gpio-104-dio-48e.c
> @@ -99,14 +99,25 @@ static const struct regmap_irq dio48e_regmap_irqs[] = {
>  	DIO48E_REGMAP_IRQ(0), DIO48E_REGMAP_IRQ(1),
>  };
>  
> -static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
> +/**
> + * 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(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;
>  	const unsigned int all_masked = GENMASK(1, 0);
> +	struct regmap *const map = dio48egpio->map;
>  	int err;
>  	unsigned int val;
>  
> @@ -115,7 +126,7 @@ 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 == all_masked) {

Mark,

These two hunks conflict with a minor gpio-104-dio-48e change in the
gpio/for-next branch [0]. I can rebase this patch on top of that change,
or would you prefer that this goes through the gpio tree?

I'll also split out the gpio-104-dio-48e changes to a precursor patch to
keep the focus here on the regmap-irq changes.

William Breathitt Gray

[0] Commit b961b2aa2f64 ("gpio: 104-dio-48e: Utilize mask_buf_def in handle_mask_sync() callback")

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

      reply	other threads:[~2023-03-10 12:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 23:20 [PATCH] regmap-irq: Drop map from handle_mask_sync() parameters William Breathitt Gray
2023-03-10 12:14 ` William Breathitt Gray [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZAsfNel4835E+i6O@fedora \
    --to=william.gray@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox