PCI - Unnecessary high-level?

From: Rafa? Bilski
Date: Fri Jun 02 2006 - 17:24:35 EST


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?


--- linux-2.6.17-rc5/include/linux/pci.h.orig 2006-05-31 09:00:42.000000000 +0200
+++ linux-2.6.17-rc5/include/linux/pci.h 2006-06-02 22:41:11.000000000 +0200
@@ -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);


--- linux-2.6.17-rc5/drivers/pci/pci-driver.c.orig 2006-05-31 09:00:31.000000000 +0200
+++ linux-2.6.17-rc5/drivers/pci/pci-driver.c 2006-06-02 22:44:18.000000000 +0200
@@ -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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/