Re: [PATCH v2 1/1] i2c: designware: set pinctrl recovery information from device pinctrl

Hawa, Hanna
2022-12-16T13:50:45Z

On 12/15/2022 12:27 PM, Andy Shevchenko wrote:
> OK, but why that function doesn't use the dev->pins->p if it's defined?
> (As a fallback when rinfo->pinctrl is NULL. >

The solution will look like the below diff (get_device_pinctrl() is new
function that i've added that return the dev->pins->p)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 7539b0740351..469344d4ee43 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -34,6 +34,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/devinfo.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/pm_wakeirq.h>
@@ -282,7 +283,11 @@ static void i2c_gpio_init_pinctrl_recovery(struct
i2c_adapter *adap)
{
struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
struct device *dev = &adap->dev;
- struct pinctrl *p = bri->pinctrl;
+ struct pinctrl *p;
+
+ if (!bri->pinctrl)
+ bri->pinctrl = get_device_pinctrl(dev->parent);
+ p = bri->pinctrl;

> Wolfram?
>
> Hanna, it seems you missed I²C maintainer to Cc...

I based my CC/TO on get_maintainer.pl script. Will make sure that
Wolfram on CC next time.