public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: PCI - Unnecessary high-level?
  2006-06-02 21:25 PCI - Unnecessary high-level? Rafa? Bilski
@ 2006-05-31  1:01 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2006-05-31  1:01 UTC (permalink / raw)
  To: Rafa? Bilski; +Cc: linux-kernel

On Fri 02-06-06 23:25:20, Rafa? Bilski wrote:
> 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

> 
> 
> --- 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Thanks for all the (sleeping) penguins.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* PCI - Unnecessary high-level?
@ 2006-06-02 21:25 Rafa? Bilski
  2006-05-31  1:01 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Rafa? Bilski @ 2006-06-02 21:25 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-03 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-02 21:25 PCI - Unnecessary high-level? Rafa? Bilski
2006-05-31  1:01 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox