From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> To: Viresh Kumar <viresh.kumar@linaro.org> Cc: Stefan Agner <stefan@agner.ch>, linus.walleij@linaro.org, shawnguo@kernel.org, aalonso@freescale.com, b38343@freescale.com, ldewangan@nvidia.com, van.freenix@gmail.com, p.zabel@pengutronix.de, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pinctrl: freescale: avoid overwriting pin config when freeing GPIO Date: Thu, 29 Sep 2016 15:16:26 +0300 [thread overview] Message-ID: <77b229dc-3fce-b953-b53b-a94a1fb0e109@mentor.com> (raw) In-Reply-To: <20160929064605.GB14138@vireshk-i7> On 09/29/2016 09:46 AM, Viresh Kumar wrote: > On 28-09-16, 15:07, Vladimir Zapolskiy wrote: >> I would expect that the change below improves the situation, but I didn't >> perform any tests and here the core change is governed by the accepted >> i.MX i2c bus driver specific changes, thus conceptually it may be incorrect: >> >> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c >> index da3a02ef4a31..3a4f59c3c3e6 100644 >> --- a/drivers/i2c/i2c-core.c >> +++ b/drivers/i2c/i2c-core.c >> @@ -697,9 +697,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) >> struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; >> int i = 0, val = 1, ret = 0; >> - if (bri->prepare_recovery) >> - bri->prepare_recovery(adap); >> - >> bri->set_scl(adap, val); >> ndelay(RECOVERY_NDELAY); >> @@ -725,22 +722,34 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) >> ndelay(RECOVERY_NDELAY); >> } >> - if (bri->unprepare_recovery) >> - bri->unprepare_recovery(adap); >> - >> return ret; >> } >> int i2c_generic_scl_recovery(struct i2c_adapter *adap) >> { >> - return i2c_generic_recovery(adap); >> + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; >> + int ret; >> + >> + if (bri->prepare_recovery) >> + bri->prepare_recovery(adap); >> + >> + ret = i2c_generic_recovery(adap); >> + >> + if (bri->unprepare_recovery) >> + bri->unprepare_recovery(adap); >> + >> + return ret; >> } >> EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery); >> int i2c_generic_gpio_recovery(struct i2c_adapter *adap) >> { >> + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; >> int ret; >> + if (bri->prepare_recovery) >> + bri->prepare_recovery(adap); >> + >> ret = i2c_get_gpios_for_recovery(adap); >> if (ret) >> return ret; >> @@ -748,6 +757,9 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap) >> ret = i2c_generic_recovery(adap); >> i2c_put_gpios_for_recovery(adap); >> + if (bri->unprepare_recovery) >> + bri->unprepare_recovery(adap); >> + >> return ret; >> } >> EXPORT_SYMBOL_GPL(i2c_generic_gpio_recovery); > > That looks to like a hack made just to make things work on one platform. If you look at the top I agree that this solution may be only one platform specific, but it fixes the broken driver of i.MX I2C bus controller. Why do you get an impression that it looks like a hack? > I would rather wait for an answer to my query first, which I asked in a separate > email. > Why pinctrl_select_state() is not done in gpio_request_one()? Because the first function gets pin mux/config setting and the second does not. How do you intend to get pin mux/config setting in gpio_request_one()? Anyway I don't see any problems in pinctrl or gpio subsystems, the bugs must be addressed and fixed in i2c. -- With best wishes, Vladimir
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> To: Viresh Kumar <viresh.kumar@linaro.org> Cc: Stefan Agner <stefan@agner.ch>, <linus.walleij@linaro.org>, <shawnguo@kernel.org>, <aalonso@freescale.com>, <b38343@freescale.com>, <ldewangan@nvidia.com>, <van.freenix@gmail.com>, <p.zabel@pengutronix.de>, <linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: Re: [PATCH] pinctrl: freescale: avoid overwriting pin config when freeing GPIO Date: Thu, 29 Sep 2016 15:16:26 +0300 [thread overview] Message-ID: <77b229dc-3fce-b953-b53b-a94a1fb0e109@mentor.com> (raw) In-Reply-To: <20160929064605.GB14138@vireshk-i7> On 09/29/2016 09:46 AM, Viresh Kumar wrote: > On 28-09-16, 15:07, Vladimir Zapolskiy wrote: >> I would expect that the change below improves the situation, but I didn't >> perform any tests and here the core change is governed by the accepted >> i.MX i2c bus driver specific changes, thus conceptually it may be incorrect: >> >> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c >> index da3a02ef4a31..3a4f59c3c3e6 100644 >> --- a/drivers/i2c/i2c-core.c >> +++ b/drivers/i2c/i2c-core.c >> @@ -697,9 +697,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) >> struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; >> int i = 0, val = 1, ret = 0; >> - if (bri->prepare_recovery) >> - bri->prepare_recovery(adap); >> - >> bri->set_scl(adap, val); >> ndelay(RECOVERY_NDELAY); >> @@ -725,22 +722,34 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) >> ndelay(RECOVERY_NDELAY); >> } >> - if (bri->unprepare_recovery) >> - bri->unprepare_recovery(adap); >> - >> return ret; >> } >> int i2c_generic_scl_recovery(struct i2c_adapter *adap) >> { >> - return i2c_generic_recovery(adap); >> + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; >> + int ret; >> + >> + if (bri->prepare_recovery) >> + bri->prepare_recovery(adap); >> + >> + ret = i2c_generic_recovery(adap); >> + >> + if (bri->unprepare_recovery) >> + bri->unprepare_recovery(adap); >> + >> + return ret; >> } >> EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery); >> int i2c_generic_gpio_recovery(struct i2c_adapter *adap) >> { >> + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; >> int ret; >> + if (bri->prepare_recovery) >> + bri->prepare_recovery(adap); >> + >> ret = i2c_get_gpios_for_recovery(adap); >> if (ret) >> return ret; >> @@ -748,6 +757,9 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap) >> ret = i2c_generic_recovery(adap); >> i2c_put_gpios_for_recovery(adap); >> + if (bri->unprepare_recovery) >> + bri->unprepare_recovery(adap); >> + >> return ret; >> } >> EXPORT_SYMBOL_GPL(i2c_generic_gpio_recovery); > > That looks to like a hack made just to make things work on one platform. If you look at the top I agree that this solution may be only one platform specific, but it fixes the broken driver of i.MX I2C bus controller. Why do you get an impression that it looks like a hack? > I would rather wait for an answer to my query first, which I asked in a separate > email. > Why pinctrl_select_state() is not done in gpio_request_one()? Because the first function gets pin mux/config setting and the second does not. How do you intend to get pin mux/config setting in gpio_request_one()? Anyway I don't see any problems in pinctrl or gpio subsystems, the bugs must be addressed and fixed in i2c. -- With best wishes, Vladimir
next prev parent reply other threads:[~2016-09-29 12:16 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-09-27 0:26 [PATCH] pinctrl: freescale: avoid overwriting pin config when freeing GPIO Stefan Agner 2016-09-27 12:12 ` Vladimir Zapolskiy 2016-09-27 12:12 ` Vladimir Zapolskiy 2016-09-27 16:37 ` Stefan Agner 2016-09-27 18:17 ` Vladimir Zapolskiy 2016-09-27 18:17 ` Vladimir Zapolskiy 2016-09-27 19:34 ` Stefan Agner 2016-09-27 20:28 ` Vladimir Zapolskiy 2016-09-27 20:28 ` Vladimir Zapolskiy 2016-09-28 2:00 ` Viresh Kumar 2016-09-28 3:38 ` Stefan Agner 2016-09-28 4:14 ` Viresh Kumar 2016-09-29 16:33 ` Stefan Agner 2016-09-30 2:12 ` Viresh Kumar 2016-10-10 8:32 ` Linus Walleij 2016-09-28 12:07 ` Vladimir Zapolskiy 2016-09-28 12:07 ` Vladimir Zapolskiy 2016-09-29 6:46 ` Viresh Kumar 2016-09-29 12:16 ` Vladimir Zapolskiy [this message] 2016-09-29 12:16 ` Vladimir Zapolskiy 2016-09-30 2:22 ` Viresh Kumar 2016-10-10 8:33 ` 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=77b229dc-3fce-b953-b53b-a94a1fb0e109@mentor.com \ --to=vladimir_zapolskiy@mentor.com \ --cc=aalonso@freescale.com \ --cc=b38343@freescale.com \ --cc=ldewangan@nvidia.com \ --cc=linus.walleij@linaro.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=p.zabel@pengutronix.de \ --cc=shawnguo@kernel.org \ --cc=stefan@agner.ch \ --cc=van.freenix@gmail.com \ --cc=viresh.kumar@linaro.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.