ipw2x00: use generic power management
Subsystems (3)
cover ipw2x00: use generic power management
Linux Kernel Mentee: Remove Legacy Power Management.
The purpose of this patch series is to remove legacy power management callbacks from amd ethernet drivers.
The callbacks performing suspend() and resume() operations are still calling pci_save_state(), pci_set_power_state(), etc. and handling the power management themselves, which is not recommended.
The conversion requires the removal of the those function calls and change the callback definition accordingly and make use of dev_pm_ops structure.
All patches are compile-tested only.
Vaibhav Gupta (2):
ipw2100: use generic power management
ipw2200: use generic power management
drivers/net/wireless/intel/ipw2x00/ipw2100.c | 31 +++++--------------- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 30 +++++-------------- 2 files changed, 14 insertions(+), 47 deletions(-)
Signature · 1 line
2.27.0
PATCH 1/2 ipw2100: use generic power management
With legacy PM, drivers themselves were responsible for managing the device's power states and takes care of register states.
After upgrading to the generic structure, PCI core will take care of required tasks and drivers should do only device-specific operations.
The driver was invoking PCI helper functions like pci_save/restore_state(), pci_enable/disable_device() and pci_set_power_state(), which is not recommended.
Compile-tested only.
--- drivers/net/wireless/intel/ipw2x00/ipw2100.c | 31 +++++--------------- 1 file changed, 7 insertions(+), 24 deletions(-)
drivers/net/wireless/intel/ipw2x00/ipw2100.c +7 -24
@@ -6397,10 +6397,9 @@ static void ipw2100_pci_remove_one(struct pci_dev *pci_dev)IPW_DEBUG_INFO ("exit\n" ); } -#ifdef CONFIG_PM -static int ipw2100_suspend (struct pci_dev *pci_dev,pm_message_t state) +static int __maybe_unused ipw2100_suspend (struct device *dev_d) { -struct ipw2100_priv *priv =pci_get_drvdata (pci_dev); +struct ipw2100_priv *priv =dev_get_drvdata (dev_d);struct net_device *dev = priv->net_dev;IPW_DEBUG_INFO ("%s: Going into suspend...\n" , dev->name);
@@ -6414,10 +6413,6 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)/* Remove the PRESENT state of the device */ netif_device_detach (dev); -pci_save_state (pci_dev); -pci_disable_device (pci_dev); -pci_set_power_state (pci_dev, PCI_D3hot); - priv->suspend_at =ktime_get_boottime_seconds ();mutex_unlock (&priv->action_mutex);
@@ -6425,11 +6420,11 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)return 0 ; } -static int ipw2100_resume (struct pci_dev *pci_dev) +static int __maybe_unused ipw2100_resume (struct device *dev_d) { +struct pci_dev *pci_dev =to_pci_dev (dev_d);struct ipw2100_priv *priv =pci_get_drvdata (pci_dev);struct net_device *dev = priv->net_dev; -int err;u32 val;if (IPW2100_PM_DISABLED )
@@ -6439,16 +6434,6 @@ static int ipw2100_resume(struct pci_dev *pci_dev)IPW_DEBUG_INFO ("%s: Coming out of suspend...\n" , dev->name); -pci_set_power_state (pci_dev,PCI_D0 ); - err =pci_enable_device (pci_dev); -if (err) { -printk (KERN_ERR "%s: pci_enable_device failed on resume\n" , - dev->name); -mutex_unlock (&priv->action_mutex); -return err; - } -pci_restore_state (pci_dev); -/* * Suspend/Resume resets the PCI configuration space, so we have to * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
@@ -6473,7 +6458,6 @@ static int ipw2100_resume(struct pci_dev *pci_dev)return 0 ; } -#endif static void ipw2100_shutdown (struct pci_dev *pci_dev) {
@@ -6539,15 +6523,14 @@ static const struct pci_device_id ipw2100_pci_id_table[] = {MODULE_DEVICE_TABLE (pci, ipw2100_pci_id_table); +static SIMPLE_DEV_PM_OPS(ipw2100_pm_ops, ipw2100_suspend, ipw2100_resume); +static struct pci_driver ipw2100_pci_driver = { .name =DRV_NAME , .id_table = ipw2100_pci_id_table, .probe = ipw2100_pci_init_one, .remove = ipw2100_pci_remove_one, -#ifdef CONFIG_PM - .suspend = ipw2100_suspend, - .resume = ipw2100_resume, -#endif + .driver.pm = &ipw2100_pm_ops, .shutdown = ipw2100_shutdown, };
Signature · 6 lines
2.27.0 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
PATCH 2/2 ipw2200: use generic power management
In reply to Vaibhav GuptaWith legacy PM, drivers themselves were responsible for managing the device's power states and takes care of register states.
After upgrading to the generic structure, PCI core will take care of required tasks and drivers should do only device-specific operations.
The driver was invoking PCI helper functions like pci_save/restore_state(), pci_enable/disable_device() and pci_set_power_state(), which is not recommended.
Compile-tested only.
--- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 30 +++++--------------- 1 file changed, 7 insertions(+), 23 deletions(-)
drivers/net/wireless/intel/ipw2x00/ipw2200.c +7 -23
@@ -11838,10 +11838,9 @@ static void ipw_pci_remove(struct pci_dev *pdev)free_firmware (); } -#ifdef CONFIG_PM -static int ipw_pci_suspend (struct pci_dev *pdev,pm_message_t state) +static int __maybe_unused ipw_pci_suspend (struct device *dev_d) { -struct ipw_priv *priv =pci_get_drvdata (pdev); +struct ipw_priv *priv =dev_get_drvdata (dev_d);struct net_device *dev = priv->net_dev;printk (KERN_INFO "%s: Going into suspend...\n" , dev->name);
@@ -11852,33 +11851,20 @@ static int ipw_pci_suspend(struct pci_dev *pdev, pm_message_t state)/* Remove the PRESENT state of the device */ netif_device_detach (dev); -pci_save_state (pdev); -pci_disable_device (pdev); -pci_set_power_state (pdev,pci_choose_state (pdev, state)); - priv->suspend_at =ktime_get_boottime_seconds ();return 0 ; } -static int ipw_pci_resume (struct pci_dev *pdev) +static int __maybe_unused ipw_pci_resume (struct device *dev_d) { +struct pci_dev *pdev =to_pci_dev (dev_d);struct ipw_priv *priv =pci_get_drvdata (pdev);struct net_device *dev = priv->net_dev; -int err;u32 val;printk (KERN_INFO "%s: Coming out of suspend...\n" , dev->name); -pci_set_power_state (pdev,PCI_D0 ); - err =pci_enable_device (pdev); -if (err) { -printk (KERN_ERR "%s: pci_enable_device failed on resume\n" , - dev->name); -return err; - } -pci_restore_state (pdev); -/* * Suspend/Resume resets the PCI configuration space, so we have to * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
@@ -11900,7 +11886,6 @@ static int ipw_pci_resume(struct pci_dev *pdev)return 0 ; } -#endif static void ipw_pci_shutdown (struct pci_dev *pdev) {
@@ -11912,16 +11897,15 @@ static void ipw_pci_shutdown(struct pci_dev *pdev)pci_disable_device (pdev); } +static SIMPLE_DEV_PM_OPS(ipw_pci_pm_ops, ipw_pci_suspend, ipw_pci_resume); +/* driver initialization stuff */ static struct pci_driver ipw_driver = { .name =DRV_NAME , .id_table = card_ids, .probe = ipw_pci_probe, .remove = ipw_pci_remove, -#ifdef CONFIG_PM - .suspend = ipw_pci_suspend, - .resume = ipw_pci_resume, -#endif + .driver.pm = &ipw_pci_pm_ops, .shutdown = ipw_pci_shutdown, };
Signature · 1 line
2.27.0
Quoted 14 lines · Vaibhav Gupta
Linux Kernel Mentee: Remove Legacy Power Management.
The purpose of this patch series is to remove legacy power management callbacks from amd ethernet drivers.
The callbacks performing
suspend()andresume()operations are still callingpci_save_state(),pci_set_power_state(), etc. and handling the power management themselves, which is not recommended.The conversion requires the removal of the those function calls and change the callback definition accordingly and make use of
dev_pm_opsstructure.All patches are compile-tested only.
Quoted 7 lines
Vaibhav Gupta (2):
ipw2100: use generic power management
ipw2200: use generic power managementdrivers/net/wireless/intel/ipw2x00/ipw2100.c | 31 +++++--------------- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 30 +++++-------------- 2 files changed, 14 insertions(+), 47 deletions(-)
For wireless patches you should CC linux-wireless, otherwise they will not be in radar. See more from link below.
Signature · 5 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 21 lines · Kalle Valo
Quoted 18 lines · Vaibhav Gupta
Linux Kernel Mentee: Remove Legacy Power Management.
The purpose of this patch series is to remove legacy power management callbacks from amd ethernet drivers.
The callbacks performing
suspend()andresume()operations are still callingpci_save_state(),pci_set_power_state(), etc. and handling the power management themselves, which is not recommended.The conversion requires the removal of the those function calls and change the callback definition accordingly and make use of
dev_pm_opsstructure.All patches are compile-tested only.
Vaibhav Gupta (2):
ipw2100: use generic power management
ipw2200: use generic power management
Quoted 6 lines
Quoted 3 lines
drivers/net/wireless/intel/ipw2x00/ipw2100.c | 31 +++++--------------- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 30 +++++-------------- 2 files changed, 14 insertions(+), 47 deletions(-)For wireless patches you should CC linux-wireless, otherwise they will not be in radar.
Oh yes, sorry! My mistake, I missed CCing them. Sending it again!
Quoted 4 lines
See more from link below.
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees