From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Laxman Dewangan <ldewangan@nvidia.com>, Lee Jones <lee.jones@linaro.org>
Cc: milo.kim@ti.com, cw00.choi@samsung.com, sbkim73@samsung.com,
tony@atomide.com, linux-kernel@vger.kernel.org,
linux-samsung-soc@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
Date: Thu, 28 Apr 2016 12:39:36 +0200 [thread overview]
Message-ID: <5721E868.6090003@samsung.com> (raw)
In-Reply-To: <5721DFC2.4070301@nvidia.com>
On 04/28/2016 12:02 PM, Laxman Dewangan wrote:
>
> On Thursday 28 April 2016 02:31 PM, Lee Jones wrote:
>> On Mon, 25 Apr 2016, Krzysztof Kozlowski wrote:
>>
>>> On 04/21/2016 02:25 PM, Laxman Dewangan wrote:
>>>> Use devm_mfd_add_devices() for adding MFD child devices and
>>>> devm_regmap_add_irq_chip() for IRQ chip registration.
>>>>
>>>> This reduces the error code path and .remove callback for removing
>>>> MFD child devices and deleting IRQ chip data.
>>>>
>>>> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
>>>> CC: Chanwoo Choi <cw00.choi@samsung.com>
>>>> CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>>>> ---
>>>> drivers/mfd/max77686.c | 31 ++++++++-----------------------
>>>> 1 file changed, 8 insertions(+), 23 deletions(-)
>>> Switching existing code to devm-like interface doesn't bring huge
>>> benefits but looks okay and I'm fine with it:
>> This is pretty much my view, but it get's Laxman's patch count up. ;)
>
> Yaah. :-)
The patch was applied so discussion seems useful only for future work. I
don't agree with some of your motivation.
> There is some other motivation of doing this:
> * I got the review comment about the resource leak and sequencing in my
> max77620. It was silly mistake done by me and it causes recycle of
> patch. To avoid this in future, devm_ was better option.
This is new code. You made error in new code... this is not an argument
to change something in existing well tested code.
> * Spent lots of time on unbinding test during my RTC patch. Although fix
> was not related to the devm_ but gave the impression that something we
> are doing on probe. devm_ looks straight forward.
Nope, the opposite. Usage of devm-like interface hides the order of
cleaning up. With explicit clean it is easy to spot the reverse work of
probe and to find the differences (like when the code is not in the
exact reverse order).
> - Some of code quality tools suggest to avoid goto statement. Only
> possible if we dont have any code in error path i.e. return from any place.
The 'goto' with one exit point is a part of kernel coding style. Of
course lack of error paths is easier to read... usually.
> - If we have devm_ apis for few resource and some does not support then
> difficult to use them as this affect the sequence of deallocation.
> Existing devm_ can be used effectively only if we have all resource
> allocation using devm_.
Ekhm? I don't understand.
> - Reducing code size always better.
Usually... but (again) introducing such questionable improvements for
existing code which was well tested and is working fine:
1. May introduce bugs. Code is already working, error path maybe was or
was not tested. At least it was reviewed. Your change may break this.
2. Is unnecessary code churn. If there are no clear benefits (and for me
in case of max77686 there are no benefits) you just used mine and
maintainer's time.
This is even different kind of change than improvements for defensive
coding (like adding 'consts'). Here, the code does not necessarily
improve. Error paths and order of cleanup are hidden.
Best regards,
Krzysztof
next prev parent reply other threads:[~2016-04-28 10:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 12:25 [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan
2016-04-21 12:25 ` [PATCH 1/7] mfd: as3722: " Laxman Dewangan
2016-04-28 9:07 ` Lee Jones
2016-04-21 12:25 ` [PATCH 2/7] mfd: lp8788: " Laxman Dewangan
2016-04-21 23:15 ` Kim, Milo
2016-04-22 8:50 ` Laxman Dewangan
2016-04-21 12:25 ` [PATCH 3/7] mfd: max77686: " Laxman Dewangan
2016-04-25 10:57 ` Krzysztof Kozlowski
2016-04-28 9:01 ` Lee Jones
2016-04-28 10:02 ` Laxman Dewangan
2016-04-28 10:39 ` Krzysztof Kozlowski [this message]
2016-04-28 9:08 ` Lee Jones
2016-04-21 12:25 ` [PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq Laxman Dewangan
2016-04-28 9:08 ` Lee Jones
2016-04-21 12:25 ` [PATCH 5/7] mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan
2016-04-25 12:45 ` Krzysztof Kozlowski
2016-04-28 9:10 ` Lee Jones
2016-04-21 12:25 ` [PATCH 6/7] mfd: tps65910: " Laxman Dewangan
2016-04-28 9:10 ` Lee Jones
2016-04-21 12:25 ` [PATCH 7/7] mfd: wl1273-core: Use devm_mfd_add_devices() for mfd_device registration Laxman Dewangan
2016-04-28 9:11 ` Lee Jones
2016-04-25 10:56 ` [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Krzysztof Kozlowski
2016-04-25 12:52 ` Laxman Dewangan
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=5721E868.6090003@samsung.com \
--to=k.kozlowski@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=ldewangan@nvidia.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=milo.kim@ti.com \
--cc=sbkim73@samsung.com \
--cc=tony@atomide.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