Skip to contentSkip to conversation

farsync: use generic power management

PATCH Applied Vaibhav Gupta 3 participants 7 messages Jul 28, 2020 – Jul 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 farsync: use generic power management

The .suspend() and .resume() callbacks are not defined for this driver. Still, their power management structure follows the legacy framework. To bring it under the generic framework, simply remove the binding of callbacks from "struct pci_driver".

Change code indentation from space to tab in "struct pci_driver".

---
 drivers/net/wan/farsync.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/wan/farsync.c +4 -6
index 7916efce7188..15dacfde6b83 100644
@@ -2636,12 +2636,10 @@ fst_remove_one(struct pci_dev *pdev)
 }
 
 static struct pci_driver fst_driver = {
-        .name		= FST_NAME,
-        .id_table	= fst_pci_dev_id,
-        .probe		= fst_add_one,
-        .remove	= fst_remove_one,
-        .suspend	= NULL,
-        .resume	= NULL,
+	.name		= FST_NAME,
+	.id_table	= fst_pci_dev_id,
+	.probe		= fst_add_one,
+	.remove		= fst_remove_one,
 };
 
 static int __init
Signature · 1 line
2.27.0
#1 lore raw

This patch is compile-tested only.

Thanks
Vaibhav Gupta

maintainer Applied
#2 lore raw
In reply to Vaibhav Gupta

From: Vaibhav Gupta <[email protected]>
Date: Tue, 28 Jul 2020 09:58:10 +0530

Quoted 8 lines

The .suspend() and .resume() callbacks are not defined for this driver. Still, their power management structure follows the legacy framework. To bring it under the generic framework, simply remove the binding of callbacks from "struct pci_driver".

Change code indentation from space to tab in "struct pci_driver".

Applied.

#3 lore raw
In reply to Vaibhav Gupta
Quoted 4 lines · Vaibhav Gupta

The .suspend() and .resume() callbacks are not defined for this driver. Still, their power management structure follows the legacy framework. To bring it under the generic framework, simply remove the binding of callbacks from "struct pci_driver".

FWIW, this commit log is slightly misleading because .suspend and .resume are NULL by default, so this patch actually is a complete no-op as far as code generation is concerned.

This change is worthwhile because it simplifies the code a little, but it doesn't convert the driver from legacy to generic power management. This driver doesn't supply a .pm structure, so it doesn't seem to do *any* power management.

Quoted 31 lines

Change code indentation from space to tab in "struct pci_driver".

---
 drivers/net/wan/farsync.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/wan/farsync.c +4 -6
index 7916efce7188..15dacfde6b83 100644
@@ -2636,12 +2636,10 @@ fst_remove_one(struct pci_dev *pdev)
 }
 
 static struct pci_driver fst_driver = {
-        .name		= FST_NAME,
-        .id_table	= fst_pci_dev_id,
-        .probe		= fst_add_one,
-        .remove	= fst_remove_one,
-        .suspend	= NULL,
-        .resume	= NULL,
+	.name		= FST_NAME,
+	.id_table	= fst_pci_dev_id,
+	.probe		= fst_add_one,
+	.remove		= fst_remove_one,
 };
 
 static int __init
Signature · 1 line
2.27.0
#4 lore raw
Quoted 6 lines · Bjorn Helgaas
Quoted 4 lines · Vaibhav Gupta

The .suspend() and .resume() callbacks are not defined for this driver. Still, their power management structure follows the legacy framework. To bring it under the generic framework, simply remove the binding of callbacks from "struct pci_driver".

Quoted 9 lines

FWIW, this commit log is slightly misleading because .suspend and .resume are NULL by default, so this patch actually is a complete no-op as far as code generation is concerned.

This change is worthwhile because it simplifies the code a little, but it doesn't convert the driver from legacy to generic power management. This driver doesn't supply a .pm structure, so it doesn't seem to do *any* power management.

Agreed. Actually, as their presence only causes PCI core to call pci_legacy_suspend/resume() for them, I thought that after removing the binding from "struct pci_driver", this driver qualifies to be grouped under genric framework, so used "use generic power management" for the heading.

I should have written "remove legacy bindning".

But David has applied the patch, should I send a v2 or fix to update message?

Thanks
Vaibhav Gupta

Quoted 2 lines
Quoted 2 lines

Change code indentation from space to tab in "struct pci_driver".

#5 lore raw
Quoted 16 lines · Vaibhav Gupta
Quoted 6 lines · Bjorn Helgaas
Quoted 4 lines · Vaibhav Gupta

The .suspend() and .resume() callbacks are not defined for this driver. Still, their power management structure follows the legacy framework. To bring it under the generic framework, simply remove the binding of callbacks from "struct pci_driver".

Quoted 8 lines

FWIW, this commit log is slightly misleading because .suspend and .resume are NULL by default, so this patch actually is a complete no-op as far as code generation is concerned.

This change is worthwhile because it simplifies the code a little, but it doesn't convert the driver from legacy to generic power management. This driver doesn't supply a .pm structure, so it doesn't seem to do *any* power management.

Quoted 7 lines

Agreed. Actually, as their presence only causes PCI core to call pci_legacy_suspend/resume() for them, I thought that after removing the binding from "struct pci_driver", this driver qualifies to be grouped under genric framework, so used "use generic power management" for the heading.

I should have written "remove legacy bindning".

This removed the *mention* of fst_driver.suspend and fst_driver.resume, which is important because we want to eventually remove those members completely from struct pci_driver.

But fst_driver.suspend and fst_driver.resume *exist* before and after this patch, and they're initialized to zero before and after this patch.

Since they were zero before, and they're still zero after this patch, the PCI core doesn't call pci_legacy_suspend/resume(). This patch doesn't change that at all.

Quoted 2 lines

But David has applied the patch, should I send a v2 or fix to update message?

No, I don't think David updates patches after he's applied them. But if the situation comes up again, you'll know how to describe it :)

Bjorn
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#6 lore raw
Quoted 14 lines · Bjorn Helgaas
Quoted 8 lines · Vaibhav Gupta

Agreed. Actually, as their presence only causes PCI core to call pci_legacy_suspend/resume() for them, I thought that after removing the binding from "struct pci_driver", this driver qualifies to be grouped under genric framework, so used "use generic power management" for the heading.

I should have written "remove legacy bindning".

This removed the *mention* of fst_driver.suspend and fst_driver.resume, which is important because we want to eventually remove those members completely from struct pci_driver.

Quoted 8 lines

But fst_driver.suspend and fst_driver.resume *exist* before and after this patch, and they're initialized to zero before and after this patch.

Since they were zero before, and they're still zero after this patch, the PCI core doesn't call pci_legacy_suspend/resume(). This patch doesn't change that at all.

Got it. Thanks :)

Quoted 6 lines
Quoted 2 lines

But David has applied the patch, should I send a v2 or fix to update message?

No, I don't think David updates patches after he's applied them. But if the situation comes up again, you'll know how to describe it :)

Thanks a lot. :D

Vaibhav Gupta

Quoted 1 line

Bjorn

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees