Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1197186 > unrolled thread
| Started by | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| First post | 2015-07-31 19:00 +0200 |
| Last post | 2015-08-02 17:50 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-07-31 19:00 +0200
Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-01 13:30 +0200
Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) Pali Rohár <pali.rohar@gmail.com> - 2015-08-01 13:50 +0200
Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) Pali Rohár <pali.rohar@gmail.com> - 2015-08-02 18:00 +0200
Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) Pavel Machek <pavel@ucw.cz> - 2015-08-02 17:50 +0200
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Date | 2015-07-31 19:00 +0200 |
| Subject | Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) |
| Message-ID | <pSlP4-3eU-1@gated-at.bofh.it> |
On Fri, Jul 31, 2015 at 02:08:25PM +0530, Viresh Kumar wrote:
> IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there
> is no need to do that again from its callers. Drop it.
I'd rather keep it as it documents the expected behavior and double
unlikely should work just fine.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/input/mouse/alps.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index 113d6f1516a5..cef3611a4ccd 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -1365,7 +1365,7 @@ static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
> /* On V2 devices the DualPoint Stick reports bare packets */
> dev = priv->dev2;
> dev2 = psmouse->dev;
> - } else if (unlikely(IS_ERR_OR_NULL(priv->dev3))) {
> + } else if (IS_ERR_OR_NULL(priv->dev3)) {
> /* Register dev3 mouse if we received PS/2 packet first time */
> if (!IS_ERR(priv->dev3))
> psmouse_queue_work(psmouse, &priv->dev3_register_work,
> --
> 2.4.0
>
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2015-08-01 13:30 +0200 |
| Message-ID | <pSD9f-3gj-1@gated-at.bofh.it> |
| In reply to | #1197186 |
On 31-07-15, 09:58, Dmitry Torokhov wrote: > On Fri, Jul 31, 2015 at 02:08:25PM +0530, Viresh Kumar wrote: > > IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there > > is no need to do that again from its callers. Drop it. > > I'd rather keep it as it documents the expected behavior and double > unlikely should work just fine. TBH, I don't really agree that it is there for documentation. The only purpose of such compiler flags is to try make code more efficient. Anyway, I got to this series as someone asked me to fix this for one of my patches which used unlikely(IS_ERR_OR_NULL()). And so I thought about fixing all sites that are doing double unlikely (that shouldn't hurt for sure). I will leave it to you. -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Pali Rohár <pali.rohar@gmail.com> |
|---|---|
| Date | 2015-08-01 13:50 +0200 |
| Subject | Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) |
| Message-ID | <pSDsB-3CW-3@gated-at.bofh.it> |
| In reply to | #1197976 |
[Multipart message — attachments visible in raw view] — view raw
On Saturday 01 August 2015 13:22:51 Viresh Kumar wrote: > On 31-07-15, 09:58, Dmitry Torokhov wrote: > > On Fri, Jul 31, 2015 at 02:08:25PM +0530, Viresh Kumar wrote: > > > IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and > > > there is no need to do that again from its callers. Drop it. > > > > I'd rather keep it as it documents the expected behavior and double > > unlikely should work just fine. > > TBH, I don't really agree that it is there for documentation. The > only purpose of such compiler flags is to try make code more > efficient. > > Anyway, I got to this series as someone asked me to fix this for one > of my patches which used unlikely(IS_ERR_OR_NULL()). And so I > thought about fixing all sites that are doing double unlikely (that > shouldn't hurt for sure). > > I will leave it to you. I think that unlikely() macro here make code more readable. Yes, it is also for compiler optimization, but also for me it looks like Clean Code pattern <https://de.wikipedia.org/wiki/Clean_Code> -- is not it? -- Pali Rohár pali.rohar@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Pali Rohár <pali.rohar@gmail.com> |
|---|---|
| Date | 2015-08-02 18:00 +0200 |
| Subject | Re: [PATCH 05/15] drivers: input: Drop unlikely before IS_ERR(_OR_NULL) |
| Message-ID | <pT3Q6-59-13@gated-at.bofh.it> |
| In reply to | #1197981 |
[Multipart message — attachments visible in raw view] — view raw
On Sunday 02 August 2015 17:43:52 Pavel Machek wrote: > On Sat 2015-08-01 13:44:59, Pali Rohár wrote: > > On Saturday 01 August 2015 13:22:51 Viresh Kumar wrote: > > > On 31-07-15, 09:58, Dmitry Torokhov wrote: > > > > On Fri, Jul 31, 2015 at 02:08:25PM +0530, Viresh Kumar wrote: > > > > > IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag > > > > > and there is no need to do that again from its callers. Drop > > > > > it. > > > > > > > > I'd rather keep it as it documents the expected behavior and > > > > double unlikely should work just fine. > > > > > > TBH, I don't really agree that it is there for documentation. The > > > only purpose of such compiler flags is to try make code more > > > efficient. > > > > > > Anyway, I got to this series as someone asked me to fix this for > > > one of my patches which used unlikely(IS_ERR_OR_NULL()). And so > > > I thought about fixing all sites that are doing double unlikely > > > (that shouldn't hurt for sure). > > > > > > I will leave it to you. > > > > I think that unlikely() macro here make code more readable. Yes, it > > is also for compiler optimization, but also for me it looks like > > Clean Code pattern <https://de.wikipedia.org/wiki/Clean_Code> -- > > is not it? > > People know that errors are unlikely, no need to tell them. I'd > remove it. > Pavel Errors and bugs are always unlikely ;-) -- Pali Rohár pali.rohar@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2015-08-02 17:50 +0200 |
| Message-ID | <pT3Gq-8ld-21@gated-at.bofh.it> |
| In reply to | #1197981 |
On Sat 2015-08-01 13:44:59, Pali Rohár wrote: > On Saturday 01 August 2015 13:22:51 Viresh Kumar wrote: > > On 31-07-15, 09:58, Dmitry Torokhov wrote: > > > On Fri, Jul 31, 2015 at 02:08:25PM +0530, Viresh Kumar wrote: > > > > IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and > > > > there is no need to do that again from its callers. Drop it. > > > > > > I'd rather keep it as it documents the expected behavior and double > > > unlikely should work just fine. > > > > TBH, I don't really agree that it is there for documentation. The > > only purpose of such compiler flags is to try make code more > > efficient. > > > > Anyway, I got to this series as someone asked me to fix this for one > > of my patches which used unlikely(IS_ERR_OR_NULL()). And so I > > thought about fixing all sites that are doing double unlikely (that > > shouldn't hurt for sure). > > > > I will leave it to you. > > I think that unlikely() macro here make code more readable. Yes, it is > also for compiler optimization, but also for me it looks like Clean Code > pattern <https://de.wikipedia.org/wiki/Clean_Code> -- is not it? People know that errors are unlikely, no need to tell them. I'd remove it. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web