Skip to contentSkip to conversation

PCI - Unnecessary high-level?

PATCH Rafa? Bilski 2 participants 2 messages Jun 2, 2006 – Jun 3, 2006 PCI

lore
Share & tools
lore
#0 lore raw

Why pci_device->suspend() is called with pm_message_t? IMO this is low-level PCI driver specific function. All drivers are calling pci_choose_state(). If this function would be called with pci_power_t maybe would be more PCI aware code compatible. Maybe code below would be better?

include/linux/pci.h renamed from include/linux/pci.h.orig +1 -1
@@ -342,7 +342,7 @@ struct pci_driver {
 	const struct pci_device_id *id_table;	/* must be non-NULL for probe to be called */
 	int  (*probe)  (struct pci_dev *dev, const struct pci_device_id *id);	/* New device inserted */
 	void (*remove) (struct pci_dev *dev);	/* Device removed (NULL if not a hot-plug capable driver) */
-	int  (*suspend) (struct pci_dev *dev, pm_message_t state);	/* Device suspended */
+	int  (*suspend) (struct pci_dev *dev, pci_power_t state);	/* Device suspended */
 	int  (*resume) (struct pci_dev *dev);	                /* Device woken up */
 	int  (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);   /* Enable wake event */
 	void (*shutdown) (struct pci_dev *dev);
drivers/pci/pci-driver.c renamed from drivers/pci/pci-driver.c.orig +1 -1
@@ -272,7 +272,7 @@ static int pci_device_suspend(struct dev
 	int i = 0;
 
 	if (drv && drv->suspend) {
-		i = drv->suspend(pci_dev, state);
+		i = drv->suspend( pci_dev, pci_choose_state(state) );
 		suspend_report_result(drv->suspend, i);
 	} else {
 		pci_save_state(pci_dev);

----------------------------------------------------------------------
Poznaj Stefana! Zmien komunikator! >>> http://link.interia.pl/f1924

#1 lore raw
Quoted 5 lines · Rafa? Bilski

Why pci_device->suspend() is called with pm_message_t? IMO this is low-level PCI driver specific function. All drivers are calling pci_choose_state(). If this function would be called with pci_power_t maybe would be more PCI aware code compatible. Maybe code below would be better?

No. Low-level drivers want to know difference between SUSPEND and FREEZE, for example.
Pavel

Quoted 36 lines
include/linux/pci.h renamed from include/linux/pci.h.orig +1 -1
@@ -342,7 +342,7 @@ struct pci_driver {
 	const struct pci_device_id *id_table;	/* must be non-NULL for probe to be called */
 	int  (*probe)  (struct pci_dev *dev, const struct pci_device_id *id);	/* New device inserted */
 	void (*remove) (struct pci_dev *dev);	/* Device removed (NULL if not a hot-plug capable driver) */
-	int  (*suspend) (struct pci_dev *dev, pm_message_t state);	/* Device suspended */
+	int  (*suspend) (struct pci_dev *dev, pci_power_t state);	/* Device suspended */
 	int  (*resume) (struct pci_dev *dev);	                /* Device woken up */
 	int  (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);   /* Enable wake event */
 	void (*shutdown) (struct pci_dev *dev);
drivers/pci/pci-driver.c renamed from drivers/pci/pci-driver.c.orig +1 -2
@@ -272,7 +272,7 @@ static int pci_device_suspend(struct dev
 	int i = 0;
 
 	if (drv && drv->suspend) {
-		i = drv->suspend(pci_dev, state);
+		i = drv->suspend( pci_dev, pci_choose_state(state) );
 		suspend_report_result(drv->suspend, i);
 	} else {
 		pci_save_state(pci_dev);
 
 
----------------------------------------------------------------------

Poznaj Stefana! Zmien komunikator! >>> http://link.interia.pl/f1924

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

Signature · 1 line
Thanks for all the (sleeping) penguins.