From: b-cousson@ti.com (Cousson, Benoit)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/3] OMAP2+ hwmod fixes
Date: Fri, 18 Feb 2011 15:44:58 +0100 [thread overview]
Message-ID: <4D5E85EA.70605@ti.com> (raw)
In-Reply-To: <6cc4b2788ff1e15c22987d5db91f0395@mail.gmail.com>
Hi Rajendra,
On 2/16/2011 2:43 PM, Nayak, Rajendra wrote:
> Hi Benoit,
>
>> -----Original Message-----
>> From: Cousson, Benoit [mailto:b-cousson at ti.com]
>> Sent: Wednesday, February 16, 2011 6:37 PM
>> To: Nayak, Rajendra
>> Cc: linux-omap at vger.kernel.org; paul at pwsan.com;
> linux-arm-kernel at lists.infradead.org
>> Subject: Re: [PATCH 0/3] OMAP2+ hwmod fixes
>>
>> Hi Rajendra,
>>
>> On 2/16/2011 1:11 PM, Nayak, Rajendra wrote:
>>> This series fixes some hwmod api return values
>>> and also adds some state checks.
>>> The hwmod iterator functions are made to
>>> continue and not break if one of the
>>> callback functions ends up with an error.
>>
>> By doing that, you change the behavior of this function.
>> I'm not sure I fully understand why.
>> Could you elaborate on the use case?
>
> Since these functions iterate over all hwmods
> calling a common callback function, there might
> be cases wherein the callback function for *some*
> hwmods might fail. For instance, if you run through
> all hwmods and try to clear the context registers
> for all of them, for some hwmods which might
> not have context registers the callback function
> might return a -EINVAL, however that should not
> stop you from attempting to clear the context
> registers for the rest of the hwmods which have
> them and abort the function midway, no?
> This is more hypothetical, however the real usecase
> that prompted me with this patch was when I
> had some wrong state check in _setup function,
> and the iterator would stop with the first failure
> and not even attempt to setup the rest of the
> hwmods.
Yeah, but by using that function you implicitly accept that an error
will break the loop, so the function you pass to the iterator should be
written for that. Meaning if you do not want to exit on error you should
not report an error.
>> To avoid that behavior in the past, I was just returning
>> 0 in case of failure to avoid stopping the iteration.
>> It looks like you do not want to stop the iteration but still
>> retrieve the error.
>> I do not see in this series what you plan to do with the
>> error at the end of the iteration.
>
> Most users of these iterators would just use the non-zero
> return value to throw an error/warning out stating there
> were failures running through all the callback functions.
> That does not change with this patch, and they can still
> do it.
Except that now, the iterator is not able anymore to stop on error if
needed potentially.
My point is that you are changing the behavior of this function without
maintaining the legacy.
So maybe creating a new iterator is a better approach.
Even is this feature is not used today I have some secret plan for this
behavior in the near future :-)
But my initial comment is still valid, if you do not care about the
final error status after the iteration, you'd better not return any
error at the beginning.
This was the behavior or the _setup until now.
Regards,
Benoit
next prev parent reply other threads:[~2011-02-18 14:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-16 12:11 [PATCH 0/3] OMAP2+ hwmod fixes Rajendra Nayak
2011-02-16 12:11 ` [PATCH 1/3] OMAP2+: hwmod: Avoid setup if clock lookup failed Rajendra Nayak
2011-02-16 12:11 ` [PATCH 2/3] OMAP2+: hwmod: Fix what _init_clock returns Rajendra Nayak
2011-02-16 12:11 ` [PATCH 3/3] OMAP2+: hwmod: Do not break iterator fn's if one fails Rajendra Nayak
2011-02-18 14:51 ` [PATCH 2/3] OMAP2+: hwmod: Fix what _init_clock returns Cousson, Benoit
2011-02-16 12:35 ` [PATCH 1/3] OMAP2+: hwmod: Avoid setup if clock lookup failed Sergei Shtylyov
2011-02-18 17:34 ` Cousson, Benoit
2011-02-16 13:07 ` [PATCH 0/3] OMAP2+ hwmod fixes Cousson, Benoit
2011-02-16 13:43 ` Rajendra Nayak
2011-02-18 14:44 ` Cousson, Benoit [this message]
2011-02-21 16:55 ` Paul Walmsley
2011-02-22 13:11 ` Rajendra Nayak
2011-02-22 19:09 ` Paul Walmsley
2011-02-23 10:05 ` Rajendra Nayak
2011-03-01 16:57 ` Cousson, Benoit
2011-03-03 6:08 ` Paul Walmsley
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=4D5E85EA.70605@ti.com \
--to=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.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: 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).