linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Michal Simek <michal.simek@xilinx.com>,
	Dejin Zheng <zhengdejin5@gmail.com>,
	Wolfram Sang <wsa@kernel.org>
Cc: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<f.fainelli@gmail.com>, <rjui@broadcom.com>,
	<sbranden@broadcom.com>, <baruch@tkos.co.il>,
	<paul@crapouillou.net>, <khilman@baylibre.com>,
	<shawnguo@kernel.org>, <festevam@gmail.com>, <vz@mleia.com>,
	<heiko@sntech.de>, <linus.walleij@linaro.org>,
	<baohua@kernel.org>, <ardb@kernel.org>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 0/2] drivers: provide devm_platform_request_irq()
Date: Tue, 26 May 2020 20:13:25 +0300	[thread overview]
Message-ID: <52fdb5f6-2108-4857-8d0f-3f17ee863781@ti.com> (raw)
In-Reply-To: <ad90d9b5-5906-fef3-85b8-00c7eff70e61@xilinx.com>



On 25/05/2020 10:05, Michal Simek wrote:
> On 23. 05. 20 19:09, Dejin Zheng wrote:
>> On Sat, May 23, 2020 at 06:08:29PM +0200, Wolfram Sang wrote:
>>> On Sat, May 23, 2020 at 10:51:55PM +0800, Dejin Zheng wrote:
>>>> It will call devm_request_irq() after platform_get_irq() function
>>>> in many drivers, sometimes, it is not right for the error handling
>>>> of these two functions in some drivers. so provide this function
>>>> to simplify the driver.
>>>>
>>>> the first patch will provide devm_platform_request_irq(), and the
>>>> other patch will convert to devm_platform_request_irq() in some
>>>> i2c bus dirver.
>>>>
>>>> v1 -> v2:
>>>> 	- I give up this series of patches in v1 version. I resend this
>>>> 	  patches v2 by that discussion:
>>>> 	  https://patchwork.ozlabs.org/project/linux-i2c/patch/20200520144821.8069-1-zhengdejin5@gmail.com/
>>>> 	  The patch content has not changed.
>>>
>>> I don't understand. v1 has been nacked because of technical reasons. How
>>> did the discussion above change the situation? Am I missing something?
>>>
>> No, you are not missing something. Maybe I did not explain clearly.
>>
>> The v1 has been nacked because Grygorii told me that the
>> function platform_get_irq() should be done as early as possible to avoid
>> unnecessary initialization steps, and the function devm_request_irq()
>> should be done late in probe when driver and HW are actually ready to
>> handle IRQs. It can do the other things between the two funtions. I agree
>> with him that it may be necessary in some complex drives. So abandon the
>> patch v1.
>>
>> Base on the discussion of you and Michal, I think maybe this patch is also
>> needed for the simple driver or the driver of already use it like that:
>> 	
>> 	irq = platform_get_irq(pdev, 0);
>> 	if (irq < 0)
>> 		return irq;
>> 	ret = devm_request_irq()
>>
>> It provides a common error handling and reduce one function call for each
>> drivers, more easier to use and simplify code. So resend it.
>>
>> BR,
>> Dejin
>>
>>>>
>>>> Dejin Zheng (2):
>>>>    drivers: provide devm_platform_request_irq()
>>>>    i2c: busses: convert to devm_platform_request_irq()
>>>>
>>>>   drivers/base/platform.c            | 33 ++++++++++++++++++++++++++++++
>>>>   drivers/i2c/busses/i2c-bcm-kona.c  | 16 +++------------
>>>>   drivers/i2c/busses/i2c-cadence.c   | 10 +++------
>>>>   drivers/i2c/busses/i2c-digicolor.c | 10 +++------
>>>>   drivers/i2c/busses/i2c-emev2.c     |  5 ++---
>>>>   drivers/i2c/busses/i2c-jz4780.c    |  5 ++---
>>>>   drivers/i2c/busses/i2c-meson.c     | 13 ++++--------
>>>>   drivers/i2c/busses/i2c-mxs.c       |  9 +++-----
>>>>   drivers/i2c/busses/i2c-pnx.c       |  9 ++------
>>>>   drivers/i2c/busses/i2c-rcar.c      |  9 +++-----
>>>>   drivers/i2c/busses/i2c-rk3x.c      | 14 +++----------
>>>>   drivers/i2c/busses/i2c-sirf.c      | 10 ++-------
>>>>   drivers/i2c/busses/i2c-stu300.c    |  4 ++--
>>>>   drivers/i2c/busses/i2c-synquacer.c | 12 +++--------
>>>>   include/linux/platform_device.h    |  4 ++++
>>>>   15 files changed, 72 insertions(+), 91 deletions(-)
> 
> If you look at all driver except for cadence one it doesn't do any
> change and I can't see any issue with it because sequences are the same
> as were before.
> 
> Regarding Cadence and Grygorii's comments:
> We are not checking that id->irq is valid that's why even if that fails
> driver continues to work. Which means that this change doesn't increase
> boot time or change code flow.
> On Xilinx devices cadence i2c is connected to ARM GIC which is
> initialized very early and IRC controller should be up and running all
> the time.
> That's why I can't see any issue which this change on Cadence driver too.


My main point was to pay attention on changes, which may be risky
especially when they are part of bulk changes (such optimization tend to spread
fast and all over the kernel without proper review).

Sry, if i introduced some misunderstanding, but it seems worked and this patch has got more attention.
There are no objection from my side to use devm_platform_get_and_ioremap_resource() if driver
owners find it acceptable.

-- 
Best regards,
grygorii

  reply	other threads:[~2020-05-26 17:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 14:51 [PATCH v2 0/2] drivers: provide devm_platform_request_irq() Dejin Zheng
2020-05-23 14:51 ` [PATCH v2 1/2] " Dejin Zheng
2020-05-26 17:11   ` Grygorii Strashko
2020-05-27 13:31     ` Dejin Zheng
2020-05-23 14:51 ` [PATCH v2 2/2] i2c: busses: convert to devm_platform_request_irq() Dejin Zheng
2020-05-25 11:42   ` Linus Walleij
2020-05-23 16:08 ` [PATCH v2 0/2] drivers: provide devm_platform_request_irq() Wolfram Sang
2020-05-23 17:09   ` Dejin Zheng
2020-05-25  7:05     ` Michal Simek
2020-05-26 17:13       ` Grygorii Strashko [this message]
2020-05-27 13:47         ` Dejin Zheng

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=52fdb5f6-2108-4857-8d0f-3f17ee863781@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=ardb@kernel.org \
    --cc=baohua@kernel.org \
    --cc=baruch@tkos.co.il \
    --cc=f.fainelli@gmail.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=khilman@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=paul@crapouillou.net \
    --cc=rafael@kernel.org \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=shawnguo@kernel.org \
    --cc=vz@mleia.com \
    --cc=wsa@kernel.org \
    --cc=zhengdejin5@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).