linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Artur Weber <aweber.kernel@gmail.com>
To: Florian Fainelli <florian.fainelli@broadcom.com>,
	Ray Jui <rjui@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Scott Branden <sbranden@broadcom.com>,
	Markus Mayer <markus.mayer@linaro.org>,
	Tim Kryger <tim.kryger@linaro.org>,
	Matt Porter <matt.porter@linaro.org>,
	Markus Mayer <mmayer@broadcom.com>,
	Christian Daudt <csd@broadcom.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH 2/3] gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ
Date: Thu, 30 Jan 2025 22:46:01 +0100	[thread overview]
Message-ID: <4af2c24d-1c79-4119-a112-eeac1112d49c@gmail.com> (raw)
In-Reply-To: <9965d0b3-f169-45c4-9345-8588865a2ca4@broadcom.com>

On 30.01.2025 22:35, Florian Fainelli wrote:
> On 1/30/25 09:10, Artur Weber wrote:
>> diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
>> index 
>> 77bd4ec93a231472d7bc40db9d5db12d20bb1611..eeaa921df6f072129dbdf1c73d6da2bd7c1fe716 100644
>> --- a/drivers/gpio/gpio-bcm-kona.c
>> +++ b/drivers/gpio/gpio-bcm-kona.c
>> ...
>> @@ -87,14 +103,25 @@ static void bcm_kona_gpio_lock_gpio(struct 
>> bcm_kona_gpio *kona_gpio,
>>       unsigned long flags;
>>       int bank_id = GPIO_BANK(gpio);
>>       int bit = GPIO_BIT(gpio);
>> +    struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id];
>> -    raw_spin_lock_irqsave(&kona_gpio->lock, flags);
>> +    if (bank->gpio_unlock_count[bit] == 0) {
>> +        dev_err(kona_gpio->gpio_chip.parent,
>> +            "Unbalanced locks for GPIO %u\n", gpio);
>> +        return;
> 
> Don't you want to release &kona_gpio->lock here?
> 

If you're talking about the "raw_spin_lock_irqsave" call above the if
condition - note that it has been removed and was actually moved below:

>> +    if (bank->gpio_unlock_count[bit] == 0) {
>> +        raw_spin_lock_irqsave(&kona_gpio->lock, flags);
>> +
>> +        val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));
>> +        val |= BIT(bit);
>> +        bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, 
>> val);
>> +
>> +        raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);
>> +    }

In general, the diff for this patch did not generate very well, sorry
about that. I'll see if there's anything I can do to improve that in the
future.

Best regards
Artur

  reply	other threads:[~2025-01-30 21:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 17:10 [PATCH 0/3] gpio: bcm-kona: Various GPIO fixups Artur Weber
2025-01-30 17:10 ` [PATCH 1/3] gpio: bcm-kona: Fix GPIO lock/unlock for banks above bank 0 Artur Weber
2025-01-30 21:33   ` Florian Fainelli
2025-01-30 22:00     ` Markus Mayer
2025-01-30 17:10 ` [PATCH 2/3] gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ Artur Weber
2025-01-30 21:35   ` Florian Fainelli
2025-01-30 21:46     ` Artur Weber [this message]
2025-01-30 22:07       ` Florian Fainelli
2025-01-30 22:13   ` Florian Fainelli
2025-01-30 22:36   ` Markus Mayer
2025-01-30 17:10 ` [PATCH 3/3] gpio: bcm-kona: Add missing newline to dev_err format string Artur Weber
2025-01-30 18:41   ` Florian Fainelli
2025-01-30 22:08     ` Markus Mayer
2025-02-06  9:34 ` [PATCH 0/3] gpio: bcm-kona: Various GPIO fixups Linus Walleij
2025-02-06  9:36   ` Linus Walleij
2025-02-06 15:37   ` Artur Weber
2025-02-06 17:48     ` Artur Weber

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=4af2c24d-1c79-4119-a112-eeac1112d49c@gmail.com \
    --to=aweber.kernel@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=brgl@bgdev.pl \
    --cc=csd@broadcom.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus.mayer@linaro.org \
    --cc=matt.porter@linaro.org \
    --cc=mmayer@broadcom.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=tim.kryger@linaro.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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;
as well as URLs for NNTP newsgroup(s).