From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Naveen N Rao <naveen@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Anatolij Gustschin <agust@denx.de>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 2/5] powerpc: 83xx/gpio: use new line value setter callbacks
Date: Wed, 30 Apr 2025 19:47:17 +0200 [thread overview]
Message-ID: <11e1a1e7-7bd3-4d48-804c-45b53b5e15d5@csgroup.eu> (raw)
In-Reply-To: <CAMRc=MesdgXAivzDnm1RW-jcxs_5goZiyKvK0-JLwqDv=9F6LQ@mail.gmail.com>
Le 30/04/2025 à 19:37, Bartosz Golaszewski a écrit :
> On Wed, Apr 30, 2025 at 7:33 PM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>>
>>
>> Le 08/04/2025 à 09:21, Bartosz Golaszewski a écrit :
>>> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>>
>>> struct gpio_chip now has callbacks for setting line values that return
>>> an integer, allowing to indicate failures. Convert the driver to using
>>> them.
>>>
>>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>> ---
>>> arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 6 ++++--
>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
>>> index 4d8fa9ed1a67..d4ba6dbb86b2 100644
>>> --- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
>>> +++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
>>> @@ -92,7 +92,7 @@ static void mcu_power_off(void)
>>> mutex_unlock(&mcu->lock);
>>> }
>>>
>>> -static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
>>> +static int mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
>>> {
>>> struct mcu *mcu = gpiochip_get_data(gc);
>>> u8 bit = 1 << (4 + gpio);
>>> @@ -105,6 +105,8 @@ static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
>>>
>>> i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL, mcu->reg_ctrl);
>>> mutex_unlock(&mcu->lock);
>>> +
>>> + return 0;
>>
>> i2c_smbus_write_byte_data() can fail, why not return the value returned
>> by i2c_smbus_write_byte_data() ?
>>
>
> The calls to i2c_smbus_write_byte_data() in this driver are
> universally not checked. I cannot test it and wasn't sure if that's on
> purpose so I decided to stay safe. Someone who has access to this
> platform could potentially fix it across the file.
As far as I can see this function is called three times in this file.
First time is in mcu_power_off(), which must return void.
Second time is inside a forever loop in shutdown_thread_fn(), and I
can't see what could be done with the returned value.
Last time is in the function you are changing. Wouldn't it make sense to
take the value into account here ? IIUC it is the purpose of the change,
isn't it ?
Christophe
next prev parent reply other threads:[~2025-04-30 18:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 7:21 [PATCH 0/5] powerpc: convert board-file GPIO chips to using new value setters Bartosz Golaszewski
2025-04-08 7:21 ` [PATCH 1/5] powerpc: sysdev/gpio: use new line value setter callbacks Bartosz Golaszewski
2025-04-30 17:35 ` Christophe Leroy
2025-04-08 7:21 ` [PATCH 2/5] powerpc: 83xx/gpio: " Bartosz Golaszewski
2025-04-30 17:33 ` Christophe Leroy
2025-04-30 17:37 ` Bartosz Golaszewski
2025-04-30 17:47 ` Christophe Leroy [this message]
2025-04-30 17:48 ` Bartosz Golaszewski
2025-04-08 7:21 ` [PATCH 3/5] powerpc: 44x/gpio: " Bartosz Golaszewski
2025-04-30 17:35 ` Christophe Leroy
2025-04-08 7:21 ` [PATCH 4/5] powerpc: 52xx/gpio: " Bartosz Golaszewski
2025-04-30 17:35 ` Christophe Leroy
2025-04-08 7:21 ` [PATCH 5/5] powerpc: 8xx/gpio: " Bartosz Golaszewski
2025-04-30 17:36 ` Christophe Leroy
2025-04-23 15:15 ` [PATCH 0/5] powerpc: convert board-file GPIO chips to using new value setters Bartosz Golaszewski
2025-04-24 8:53 ` Linus Walleij
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=11e1a1e7-7bd3-4d48-804c-45b53b5e15d5@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=agust@denx.de \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
/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).