[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2018dc60-1cec-4575-9005-cb543c7c1856@broadcom.com>
Date: Thu, 30 Jan 2025 14:07:12 -0800
From: Florian Fainelli <florian.fainelli@...adcom.com>
To: Artur Weber <aweber.kernel@...il.com>, Ray Jui <rjui@...adcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski
<brgl@...ev.pl>, Scott Branden <sbranden@...adcom.com>,
Markus Mayer <markus.mayer@...aro.org>, Tim Kryger <tim.kryger@...aro.org>,
Matt Porter <matt.porter@...aro.org>, Markus Mayer <mmayer@...adcom.com>,
Christian Daudt <csd@...adcom.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
~postmarketos/upstreaming@...ts.sr.ht
Subject: Re: [PATCH 2/3] gpio: bcm-kona: Make sure GPIO bits are unlocked when
requesting IRQ
On 1/30/25 13:46, Artur Weber wrote:
> 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:
Oh my bad, my eye corrected that - to a + somehow.
>
>>> + 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.
Nah that's fine, thanks!
--
Florian
Powered by blists - more mailing lists