* [PATCH] PCI / PM: Remove unnecessary error variable from acpi_dev_run_wake()
@ 2011-09-27 22:01 Rafael J. Wysocki
2011-09-28 19:27 ` Bjorn Helgaas
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2011-09-27 22:01 UTC (permalink / raw)
To: Jesse Barnes
Cc: LKML, Linux PM mailing list, ACPI Devel Mailing List, linux-pci
From: Rafael J. Wysocki <rjw@sisk.pl>
The error variable in acpi_dev_run_wake() is not really used, so
remove it.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/pci/pci-acpi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: linux/drivers/pci/pci-acpi.c
===================================================================
--- linux.orig/drivers/pci/pci-acpi.c
+++ linux/drivers/pci/pci-acpi.c
@@ -282,7 +282,6 @@ static int acpi_dev_run_wake(struct devi
{
struct acpi_device *dev;
acpi_handle handle;
- int error = -ENODEV;
if (!device_run_wake(phys_dev))
return -EINVAL;
@@ -302,7 +301,7 @@ static int acpi_dev_run_wake(struct devi
acpi_disable_wakeup_device_power(dev);
}
- return error;
+ return 0;
}
static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] PCI / PM: Remove unnecessary error variable from acpi_dev_run_wake() 2011-09-27 22:01 [PATCH] PCI / PM: Remove unnecessary error variable from acpi_dev_run_wake() Rafael J. Wysocki @ 2011-09-28 19:27 ` Bjorn Helgaas 2011-09-28 19:44 ` Rafael J. Wysocki 0 siblings, 1 reply; 4+ messages in thread From: Bjorn Helgaas @ 2011-09-28 19:27 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Jesse Barnes, LKML, Linux PM mailing list, ACPI Devel Mailing List, linux-pci On Tue, Sep 27, 2011 at 4:01 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote: > From: Rafael J. Wysocki <rjw@sisk.pl> > > The error variable in acpi_dev_run_wake() is not really used, so > remove it. > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> > --- > drivers/pci/pci-acpi.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > Index: linux/drivers/pci/pci-acpi.c > =================================================================== > --- linux.orig/drivers/pci/pci-acpi.c > +++ linux/drivers/pci/pci-acpi.c > @@ -282,7 +282,6 @@ static int acpi_dev_run_wake(struct devi > { > struct acpi_device *dev; > acpi_handle handle; > - int error = -ENODEV; > > if (!device_run_wake(phys_dev)) > return -EINVAL; > @@ -302,7 +301,7 @@ static int acpi_dev_run_wake(struct devi > acpi_disable_wakeup_device_power(dev); > } > > - return error; > + return 0; > } > > static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable) This looks like the right thing to do, but the current changelog suggests that we're just removing unused code. But in fact, we'll now return 0 (success) when we used to return -ENODEV, so the behavior of the callers will change (probably fixing some bugs). Do you want to mention that in the changelog as well? I'm assuming this is for the 3.2 merge window, since it doesn't look like a regression fix. Bjorn ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI / PM: Remove unnecessary error variable from acpi_dev_run_wake() 2011-09-28 19:27 ` Bjorn Helgaas @ 2011-09-28 19:44 ` Rafael J. Wysocki 2011-10-14 16:07 ` Jesse Barnes 0 siblings, 1 reply; 4+ messages in thread From: Rafael J. Wysocki @ 2011-09-28 19:44 UTC (permalink / raw) To: Bjorn Helgaas Cc: Jesse Barnes, LKML, Linux PM mailing list, ACPI Devel Mailing List, linux-pci On Wednesday, September 28, 2011, Bjorn Helgaas wrote: > On Tue, Sep 27, 2011 at 4:01 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote: > > From: Rafael J. Wysocki <rjw@sisk.pl> > > > > The error variable in acpi_dev_run_wake() is not really used, so > > remove it. > > > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> > > --- > > drivers/pci/pci-acpi.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > Index: linux/drivers/pci/pci-acpi.c > > =================================================================== > > --- linux.orig/drivers/pci/pci-acpi.c > > +++ linux/drivers/pci/pci-acpi.c > > @@ -282,7 +282,6 @@ static int acpi_dev_run_wake(struct devi > > { > > struct acpi_device *dev; > > acpi_handle handle; > > - int error = -ENODEV; > > > > if (!device_run_wake(phys_dev)) > > return -EINVAL; > > @@ -302,7 +301,7 @@ static int acpi_dev_run_wake(struct devi > > acpi_disable_wakeup_device_power(dev); > > } > > > > - return error; > > + return 0; > > } > > > > static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable) > > This looks like the right thing to do, but the current changelog > suggests that we're just removing unused code. > > But in fact, we'll now return 0 (success) when we used to return > -ENODEV, so the behavior of the callers will change (probably fixing > some bugs). Do you want to mention that in the changelog as well? Yes, good idea. > I'm assuming this is for the 3.2 merge window, since it doesn't look > like a regression fix. Yes, it's 3.2 material. Below is an updated patch. Thanks, Rafael --- From: Rafael J. Wysocki <rjw@sisk.pl> Subject: PCI / PM: Return correct result from acpi_dev_run_wake() The result returned by acpi_dev_run_wake() is always either -EINVAL or -ENODEV, while obviously it should return 0 on success. The problem is that the leftover error variable, that's not really used in the function, is initialized with -ENODEV and then returned without modification. To fix this issue remove the error variable from acpi_dev_run_wake() and make the function return 0 on success as appropriate. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> --- drivers/pci/pci-acpi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Index: linux/drivers/pci/pci-acpi.c =================================================================== --- linux.orig/drivers/pci/pci-acpi.c +++ linux/drivers/pci/pci-acpi.c @@ -282,7 +282,6 @@ static int acpi_dev_run_wake(struct devi { struct acpi_device *dev; acpi_handle handle; - int error = -ENODEV; if (!device_run_wake(phys_dev)) return -EINVAL; @@ -302,7 +301,7 @@ static int acpi_dev_run_wake(struct devi acpi_disable_wakeup_device_power(dev); } - return error; + return 0; } static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI / PM: Remove unnecessary error variable from acpi_dev_run_wake() 2011-09-28 19:44 ` Rafael J. Wysocki @ 2011-10-14 16:07 ` Jesse Barnes 0 siblings, 0 replies; 4+ messages in thread From: Jesse Barnes @ 2011-10-14 16:07 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Bjorn Helgaas, LKML, Linux PM mailing list, ACPI Devel Mailing List, linux-pci [-- Attachment #1: Type: text/plain, Size: 782 bytes --] On Wed, 28 Sep 2011 21:44:36 +0200 "Rafael J. Wysocki" <rjw@sisk.pl> wrote: > --- > From: Rafael J. Wysocki <rjw@sisk.pl> > Subject: PCI / PM: Return correct result from acpi_dev_run_wake() > > The result returned by acpi_dev_run_wake() is always either -EINVAL > or -ENODEV, while obviously it should return 0 on success. The > problem is that the leftover error variable, that's not really used > in the function, is initialized with -ENODEV and then returned > without modification. > > To fix this issue remove the error variable from acpi_dev_run_wake() > and make the function return 0 on success as appropriate. > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Applied to linux-next, thanks. -- Jesse Barnes, Intel Open Source Technology Center [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-14 16:07 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-09-27 22:01 [PATCH] PCI / PM: Remove unnecessary error variable from acpi_dev_run_wake() Rafael J. Wysocki 2011-09-28 19:27 ` Bjorn Helgaas 2011-09-28 19:44 ` Rafael J. Wysocki 2011-10-14 16:07 ` Jesse Barnes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox