Thread (16 messages) 16 messages, 5 authors, 2021-12-15

Re: [PATCH 2/2] i2c: tegra: Add SMBus block read and SMBus alert functions

From: Andy Shevchenko <hidden>
Date: 2021-12-09 15:39:05
Also in: dri-devel, linux-i2c, linux-media, linux-tegra, lkml

On Thu, Dec 9, 2021 at 5:30 PM Dmitry Osipenko [off-list ref] wrote:
09.12.2021 18:05, Akhil R пишет:
quoted
+static int tegra_i2c_setup_smbalert(struct tegra_i2c_dev *i2c_dev)
+{
+     struct tegra_i2c_smbalert *smbalert = &i2c_dev->smbalert;
+     struct gpio_desc *alert_gpiod;
+     struct i2c_client *ara;
+
+     alert_gpiod = devm_gpiod_get(i2c_dev->dev, "smbalert", GPIOD_IN);
+     if (IS_ERR(alert_gpiod))
+             return PTR_ERR(alert_gpiod);
+
+     smbalert->alert_data.irq = gpiod_to_irq(alert_gpiod);
+     if (smbalert->alert_data.irq <= 0)
+             return smbalert->alert_data.irq;
0 is the error condition.
I'm not sure what you implied here. gpiod_to_irq() returns 0 if and
only if it goes to the architectures where it might be possible to
have valid vIRQ 0, but this is not the case (at least I never heard of
a such) for GPIO controllers on such platforms. So, looking at the
above code I may tell that the '=' part is redundant.

-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help