Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[Resend][PATCH] Wireless / ath5k: Simplify suspend and resume callbacks

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


rjw at sisk

Nov 21, 2009, 2:44 PM

Post #1 of 4 (112 views)
Permalink
[Resend][PATCH] Wireless / ath5k: Simplify suspend and resume callbacks

From: Rafael J. Wysocki <rjw [at] sisk>
Subject: Wireless / ath5k: Simplify suspend and resume callbacks

Simplify the suspend and resume callbacks of ath5k by converting the
driver to struct dev_pm_ops and allowing the PCI PM core to do the
PCI-specific suspend/resume handling.

Tested with Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
D-Link CardBus.adapter.

Signed-off-by: Rafael J. Wysocki <rjw [at] sisk>
---
drivers/net/wireless/ath/ath5k/base.c | 35 ++++++++++------------------------
1 file changed, 11 insertions(+), 24 deletions(-)

Index: linux-2.6/drivers/net/wireless/ath/ath5k/base.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/ath/ath5k/base.c
+++ linux-2.6/drivers/net/wireless/ath/ath5k/base.c
@@ -195,12 +195,13 @@ static int __devinit ath5k_pci_probe(str
const struct pci_device_id *id);
static void __devexit ath5k_pci_remove(struct pci_dev *pdev);
#ifdef CONFIG_PM
-static int ath5k_pci_suspend(struct pci_dev *pdev,
- pm_message_t state);
-static int ath5k_pci_resume(struct pci_dev *pdev);
+static int ath5k_pci_suspend(struct device *dev);
+static int ath5k_pci_resume(struct device *dev);
+
+SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
+#define ATH5K_PM_OPS (&ath5k_pm_ops)
#else
-#define ath5k_pci_suspend NULL
-#define ath5k_pci_resume NULL
+#define ATH5K_PM_OPS NULL
#endif /* CONFIG_PM */

static struct pci_driver ath5k_pci_driver = {
@@ -208,8 +209,7 @@ static struct pci_driver ath5k_pci_drive
.id_table = ath5k_pci_id_table,
.probe = ath5k_pci_probe,
.remove = __devexit_p(ath5k_pci_remove),
- .suspend = ath5k_pci_suspend,
- .resume = ath5k_pci_resume,
+ .driver.pm = ATH5K_PM_OPS,
};


@@ -669,33 +669,20 @@ ath5k_pci_remove(struct pci_dev *pdev)
}

#ifdef CONFIG_PM
-static int
-ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+static int ath5k_pci_suspend(struct device *dev)
{
- struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+ struct ieee80211_hw *hw = pci_get_drvdata(to_pci_dev(dev));
struct ath5k_softc *sc = hw->priv;

ath5k_led_off(sc);
-
- pci_save_state(pdev);
- pci_disable_device(pdev);
- pci_set_power_state(pdev, PCI_D3hot);
-
return 0;
}

-static int
-ath5k_pci_resume(struct pci_dev *pdev)
+static int ath5k_pci_resume(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath5k_softc *sc = hw->priv;
- int err;
-
- pci_restore_state(pdev);
-
- err = pci_enable_device(pdev);
- if (err)
- return err;

/*
* Suspend/Resume resets the PCI configuration space, so we have to
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


me at bobcopeland

Nov 21, 2009, 7:18 PM

Post #2 of 4 (102 views)
Permalink
Re: [Resend][PATCH] Wireless / ath5k: Simplify suspend and resume callbacks [In reply to]

On Sat, Nov 21, 2009 at 11:44:24PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw [at] sisk>
> Subject: Wireless / ath5k: Simplify suspend and resume callbacks
>
> Simplify the suspend and resume callbacks of ath5k by converting the
> driver to struct dev_pm_ops and allowing the PCI PM core to do the
> PCI-specific suspend/resume handling.
>
> Tested with Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
> D-Link CardBus.adapter.
>
> Signed-off-by: Rafael J. Wysocki <rjw [at] sisk>

Acked-by: Bob Copeland <me [at] bobcopeland>

Thanks for the resend, sorry it got lost in the shuffle.

--
Bob Copeland %% www.bobcopeland.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


linville at tuxdriver

Nov 23, 2009, 1:33 PM

Post #3 of 4 (89 views)
Permalink
Re: [Resend][PATCH] Wireless / ath5k: Simplify suspend and resume callbacks [In reply to]

On Sat, Nov 21, 2009 at 11:44:24PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw [at] sisk>
> Subject: Wireless / ath5k: Simplify suspend and resume callbacks
>
> Simplify the suspend and resume callbacks of ath5k by converting the
> driver to struct dev_pm_ops and allowing the PCI PM core to do the
> PCI-specific suspend/resume handling.
>
> Tested with Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
> D-Link CardBus.adapter.
>
> Signed-off-by: Rafael J. Wysocki <rjw [at] sisk>

This is already queued for -next.

John
--
John W. Linville Someday the world will need a hero, and you
linville [at] tuxdriver might be all we have. Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


rjw at sisk

Nov 23, 2009, 2:12 PM

Post #4 of 4 (90 views)
Permalink
Re: [Resend][PATCH] Wireless / ath5k: Simplify suspend and resume callbacks [In reply to]

On Monday 23 November 2009, John W. Linville wrote:
> On Sat, Nov 21, 2009 at 11:44:24PM +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rjw [at] sisk>
> > Subject: Wireless / ath5k: Simplify suspend and resume callbacks
> >
> > Simplify the suspend and resume callbacks of ath5k by converting the
> > driver to struct dev_pm_ops and allowing the PCI PM core to do the
> > PCI-specific suspend/resume handling.
> >
> > Tested with Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
> > D-Link CardBus.adapter.
> >
> > Signed-off-by: Rafael J. Wysocki <rjw [at] sisk>
>
> This is already queued for -next.

Thanks!

Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.