Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1448768 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2016-07-22 22:40 +0200 |
| Last post | 2016-07-23 17:20 +0200 |
| Articles | 5 — 2 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] PM-wakeup: Delete unnecessary checks before two function calls SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-22 22:40 +0200
Re: [PATCH] PM-wakeup: Delete unnecessary checks before two function calls "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-22 23:50 +0200
Re: PM-wakeup: Delete unnecessary checks before two function calls SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-23 07:40 +0200
Re: PM-wakeup: Delete unnecessary checks before two function calls "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-23 14:20 +0200
[PATCH] PM-wakeup: Delete unnecessary checks before three function calls SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-23 17:20 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-07-22 22:40 +0200 |
| Subject | Re: [PATCH] PM-wakeup: Delete unnecessary checks before two function calls |
| Message-ID | <rXPoL-2cw-35@gated-at.bofh.it> |
Am 28.06.2015 um 12:21 schrieb SF Markus Elfring:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 28 Jun 2015 12:14:43 +0200
>
> The functions dev_pm_disarm_wake_irq() and wakeup_source_unregister() test
> whether their argument is NULL and then return immediately.
> Thus the test around the calls is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/base/power/wakeup.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> index 40f7160..3741bc2 100644
> --- a/drivers/base/power/wakeup.c
> +++ b/drivers/base/power/wakeup.c
> @@ -341,8 +341,7 @@ void device_wakeup_arm_wake_irqs(void)
>
> rcu_read_lock();
> list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
> - if (ws->wakeirq)
> - dev_pm_arm_wake_irq(ws->wakeirq);
> + dev_pm_arm_wake_irq(ws->wakeirq);
> }
> rcu_read_unlock();
> }
> @@ -358,8 +357,7 @@ void device_wakeup_disarm_wake_irqs(void)
>
> rcu_read_lock();
> list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
> - if (ws->wakeirq)
> - dev_pm_disarm_wake_irq(ws->wakeirq);
> + dev_pm_disarm_wake_irq(ws->wakeirq);
> }
> rcu_read_unlock();
> }
> @@ -396,9 +394,7 @@ int device_wakeup_disable(struct device *dev)
> return -EINVAL;
>
> ws = device_wakeup_detach(dev);
> - if (ws)
> - wakeup_source_unregister(ws);
> -
> + wakeup_source_unregister(ws);
> return 0;
> }
> EXPORT_SYMBOL_GPL(device_wakeup_disable);
>
How do you think about to integrate this update suggestion
into another source code repository?
Regards,
Markus
[toc] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2016-07-22 23:50 +0200 |
| Subject | Re: [PATCH] PM-wakeup: Delete unnecessary checks before two function calls |
| Message-ID | <rXQut-2Qh-1@gated-at.bofh.it> |
| In reply to | #1448768 |
On Friday, July 22, 2016 10:35:27 PM SF Markus Elfring wrote:
> Am 28.06.2015 um 12:21 schrieb SF Markus Elfring:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Sun, 28 Jun 2015 12:14:43 +0200
> >
> > The functions dev_pm_disarm_wake_irq() and wakeup_source_unregister() test
> > whether their argument is NULL and then return immediately.
> > Thus the test around the calls is not needed.
> >
> > This issue was detected by using the Coccinelle software.
> >
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> > drivers/base/power/wakeup.c | 10 +++-------
> > 1 file changed, 3 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> > index 40f7160..3741bc2 100644
> > --- a/drivers/base/power/wakeup.c
> > +++ b/drivers/base/power/wakeup.c
> > @@ -341,8 +341,7 @@ void device_wakeup_arm_wake_irqs(void)
> >
> > rcu_read_lock();
> > list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
> > - if (ws->wakeirq)
> > - dev_pm_arm_wake_irq(ws->wakeirq);
> > + dev_pm_arm_wake_irq(ws->wakeirq);
> > }
> > rcu_read_unlock();
> > }
> > @@ -358,8 +357,7 @@ void device_wakeup_disarm_wake_irqs(void)
> >
> > rcu_read_lock();
> > list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
> > - if (ws->wakeirq)
> > - dev_pm_disarm_wake_irq(ws->wakeirq);
> > + dev_pm_disarm_wake_irq(ws->wakeirq);
> > }
> > rcu_read_unlock();
> > }
> > @@ -396,9 +394,7 @@ int device_wakeup_disable(struct device *dev)
> > return -EINVAL;
> >
> > ws = device_wakeup_detach(dev);
> > - if (ws)
> > - wakeup_source_unregister(ws);
> > -
> > + wakeup_source_unregister(ws);
> > return 0;
> > }
> > EXPORT_SYMBOL_GPL(device_wakeup_disable);
> >
>
> How do you think about to integrate this update suggestion
> into another source code repository?
I'm not really sure what you mean.
Thanks,
Rafael
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-07-23 07:40 +0200 |
| Subject | Re: PM-wakeup: Delete unnecessary checks before two function calls |
| Message-ID | <rXXPk-7o1-3@gated-at.bofh.it> |
| In reply to | #1448803 |
>> How do you think about to integrate this update suggestion >> into another source code repository? > > I'm not really sure what you mean. Do you find the suggested source code change acceptable? http://article.gmane.org/gmane.linux.power-management.general/61766 https://lkml.org/lkml/2015/6/28/21 Who would dare to commit it? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2016-07-23 14:20 +0200 |
| Subject | Re: PM-wakeup: Delete unnecessary checks before two function calls |
| Message-ID | <rY44u-2Gq-13@gated-at.bofh.it> |
| In reply to | #1448876 |
On Saturday, July 23, 2016 07:32:22 AM SF Markus Elfring wrote: > >> How do you think about to integrate this update suggestion > >> into another source code repository? > > > > I'm not really sure what you mean. > > Do you find the suggested source code change acceptable? > > http://article.gmane.org/gmane.linux.power-management.general/61766 > https://lkml.org/lkml/2015/6/28/21 Yes, it is acceptable, but you also should remove some braces that aren't necessary any more. Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-07-23 17:20 +0200 |
| Subject | [PATCH] PM-wakeup: Delete unnecessary checks before three function calls |
| Message-ID | <rY6SC-4me-7@gated-at.bofh.it> |
| In reply to | #1448940 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 23 Jul 2016 17:04:00 +0200
The following functions test whether their argument is NULL
and then return immediately.
* dev_pm_arm_wake_irq
* dev_pm_disarm_wake_irq
* wakeup_source_unregister
Thus the test around the calls is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/base/power/wakeup.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 5fb7718..c35d3f5 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -334,10 +334,8 @@ void device_wakeup_arm_wake_irqs(void)
struct wakeup_source *ws;
rcu_read_lock();
- list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
- if (ws->wakeirq)
- dev_pm_arm_wake_irq(ws->wakeirq);
- }
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry)
+ dev_pm_arm_wake_irq(ws->wakeirq);
rcu_read_unlock();
}
@@ -351,10 +349,8 @@ void device_wakeup_disarm_wake_irqs(void)
struct wakeup_source *ws;
rcu_read_lock();
- list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
- if (ws->wakeirq)
- dev_pm_disarm_wake_irq(ws->wakeirq);
- }
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry)
+ dev_pm_disarm_wake_irq(ws->wakeirq);
rcu_read_unlock();
}
@@ -390,9 +386,7 @@ int device_wakeup_disable(struct device *dev)
return -EINVAL;
ws = device_wakeup_detach(dev);
- if (ws)
- wakeup_source_unregister(ws);
-
+ wakeup_source_unregister(ws);
return 0;
}
EXPORT_SYMBOL_GPL(device_wakeup_disable);
--
2.9.2
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web