[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1204201156300.29484@pobox.suse.cz>
Date: Fri, 20 Apr 2012 12:05:21 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: Simon Wood <simon@...gewell.org>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Bauer <michael@...auer.org>,
Michal Maly <madcatxster@...il.com>
Subject: Re: [PATCH 1/2] HID: hid-lg4ff: Add support for G27 LEDs
On Wed, 18 Apr 2012, simon@...gewell.org wrote:
> > Putting the whole err: label outside the outer for cycle would make the
> > whole thing much more readable (and would save you the break). Could you
> > please redo this?
>
> The 'break' is actually not needed as 'j' has reached maximum value and
> the outer for loop would be at completion.
Ah, right, I have even missed this fact, that you are using the same index
in the inner loop as in the outter loop.
Quite unreadable indeed :)
> I put the 'break' there just to highlight this fact.
>
> Maybe just a comment would be OK, such as 'on error fall though to driver
> completion'.
>
> The reason I'd like this code here is that it seems traditional to output
> the following 'hid_info' line once the driver is fully active.
>
> >> hid_info(hid, "Force feedback for Logitech Speed Force Wireless by
> >> Simon Wood <simon@...gewell.org>\n");
>
> Moving the 'err:' code would have to:
> 1). Jump back to hit this hid_info line
> 2). Duplicate the hid_info line
> 3). Have err code called as a function
I am not getting it. Why can't you do just something like
for ( .... ) {
/* outter loop */
if (error) {
for ( ... ) {
/* inner loop */
}
goto out;
}
}
out:
hid_info(....);
return;
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists