All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pata_sil680 suspend/resume
@ 2006-11-22 17:28 Alan
  2007-02-26 21:17 ` Guennadi Liakhovetski
  0 siblings, 1 reply; 13+ messages in thread
From: Alan @ 2006-11-22 17:28 UTC (permalink / raw)
  To: akpm, linux-kernel, jgarzik

The SI680 can come back from s2ram with the clocks disabled (crash time)
or wrong (ugly as this can cause CRC errors, and in theory corruption).
On a resume we must put the clock back.

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.19-rc5-mm2/drivers/ata/pata_sil680.c linux-2.6.19-rc5-mm2/drivers/ata/pata_sil680.c
--- linux.vanilla-2.6.19-rc5-mm2/drivers/ata/pata_sil680.c	2006-11-15 13:26:00.000000000 +0000
+++ linux-2.6.19-rc5-mm2/drivers/ata/pata_sil680.c	2006-11-22 14:44:57.221814608 +0000
@@ -33,7 +33,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_sil680"
-#define DRV_VERSION "0.3.2"
+#define DRV_VERSION "0.4.1"
 
 /**
  *	sil680_selreg		-	return register base
@@ -262,32 +262,20 @@
 	.host_stop	= ata_host_stop
 };
 
-static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
+/**
+ *	sil680_init_chip		-	chip setup
+ *	@pdev: PCI device
+ *
+ *	Perform all the chip setup which must be done both when the device
+ *	is powered up on boot and when we resume in case we resumed from RAM.
+ *	Returns the final clock settings.
+ */
+ 
+static u8 sil680_init_chip(struct pci_dev *pdev)
 {
-	static struct ata_port_info info = {
-		.sht = &sil680_sht,
-		.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
-		.pio_mask = 0x1f,
-		.mwdma_mask = 0x07,
-		.udma_mask = 0x7f,
-		.port_ops = &sil680_port_ops
-	};
-	static struct ata_port_info info_slow = {
-		.sht = &sil680_sht,
-		.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
-		.pio_mask = 0x1f,
-		.mwdma_mask = 0x07,
-		.udma_mask = 0x3f,
-		.port_ops = &sil680_port_ops
-	};
-	static struct ata_port_info *port_info[2] = {&info, &info};
-	static int printed_version;
 	u32 class_rev	= 0;
 	u8 tmpbyte	= 0;
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
-
         pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
         class_rev &= 0xff;
         /* FIXME: double check */
@@ -322,8 +310,6 @@
 	pci_read_config_byte(pdev,   0x8A, &tmpbyte);
 	printk(KERN_INFO "sil680: BA5_EN = %d clock = %02X\n",
 			tmpbyte & 1, tmpbyte & 0x30);
-	if ((tmpbyte & 0x30) == 0)
-		port_info[0] = port_info[1] = &info_slow;
 
 	pci_write_config_byte(pdev,  0xA1, 0x72);
 	pci_write_config_word(pdev,  0xA2, 0x328A);
@@ -342,11 +328,51 @@
 		case 0x20: printk(KERN_INFO "sil680: Using PCI clock.\n");break;
 		/* This last case is _NOT_ ok */
 		case 0x30: printk(KERN_ERR "sil680: Clock disabled ?\n");
-			return -EIO;
+	}
+	return tmpbyte & 0x30;
+}
+
+static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+	static struct ata_port_info info = {
+		.sht = &sil680_sht,
+		.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+		.pio_mask = 0x1f,
+		.mwdma_mask = 0x07,
+		.udma_mask = 0x7f,
+		.port_ops = &sil680_port_ops
+	};
+	static struct ata_port_info info_slow = {
+		.sht = &sil680_sht,
+		.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+		.pio_mask = 0x1f,
+		.mwdma_mask = 0x07,
+		.udma_mask = 0x3f,
+		.port_ops = &sil680_port_ops
+	};
+	static struct ata_port_info *port_info[2] = {&info, &info};
+	static int printed_version;
+
+	if (!printed_version++)
+		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+
+	switch(sil680_init_chip(pdev))
+	{
+		case 0:
+			port_info[0] = port_info[1] = &info_slow;
+			break;
+		case 0x30:
+			return -ENODEV;
 	}
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+static int sil680_reinit_one(struct pci_dev *pdev)
+{
+	sil680_init_chip(pdev);
+	return ata_pci_device_resume(pdev);
+}
+
 static const struct pci_device_id sil680[] = {
 	{ PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), },
 
@@ -357,7 +383,9 @@
 	.name 		= DRV_NAME,
 	.id_table	= sil680,
 	.probe 		= sil680_init_one,
-	.remove		= ata_pci_remove_one
+	.remove		= ata_pci_remove_one,
+	.suspend	= ata_pci_device_suspend,
+	.resume		= sil680_reinit_one,
 };
 
 static int __init sil680_init(void)


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

* Re: [PATCH] pata_sil680 suspend/resume
  2006-11-22 17:28 [PATCH] pata_sil680 suspend/resume Alan
@ 2007-02-26 21:17 ` Guennadi Liakhovetski
  2007-02-26 21:38   ` Guennadi Liakhovetski
  2007-02-28 21:19     ` Guennadi Liakhovetski
  0 siblings, 2 replies; 13+ messages in thread
From: Guennadi Liakhovetski @ 2007-02-26 21:17 UTC (permalink / raw)
  To: Alan; +Cc: linux-kernel, jgarzik

Alan,

I'm trying to suspend to RAM a KuroboxHG: powerpc MPC8241 based system 
with a sil680

00:0c.0 IDE interface: Silicon Image, Inc. PCI0680 Ultra ATA-133 Host Controller (rev 02)

PATA controller, using pata_sil680. This is not a real str, i.e., power is 
not switched off, just pull the whole system through suspend, and at the 
end put the peripheral controller and the CPU core to sleep.

To suspend I just use a script like:

hdparm -Y /dev/sda
echo -n "mem" > /sys/power/state
hdparm -y /dev/sda

where the last hdparm is meant to wake up the drive (ok, it doesn't:-)), 
tried without it too. 

With an approximately 2.6.20 kernel I could suspend, but on resume I got

ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
ata1.00: tag 0 cmd 0xe0 Emask 0x4 stat 0x40 err 0x0 (timeout)
ata1: port is slow to respond, please be patient (Status 0xd0)
ata1: port failed to respond (30 secs, Status 0xd0)
ata1: soft resetting port
ata1.00: configured for UDMA/100
ata1: EH complete
SCSI device sda: 40020624 512-byte hdwr sectors (20491 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: drive cache: write back

but then it worked - congratulations to all authors on a robust error 
handling! If I remove the "hdparm -y" I get a similar error on the first 
access.

With a post 2.6.20 kernel from powerpc.git I cannot suspend at all:

pata_sil680 0000:00:0c.0: suspend
ata1: suspend failed, device 0 still active
pci_device_suspend(): ata_pci_device_suspend+0x0/0x74() returns -16
suspend_device(): pci_device_suspend+0x0/0xac() returns -16
Could not suspend device 0000:00:0c.0: error -16

Same without "hdparm -Y". Should I use sdparm instead? but
"sdparm --command stop /dev/sda" doesn't spin the disk down.

Looking at drivers/ata/libata-eh.c it looks like ata_eh_suspend() should 
spin the disk down by itself and set the ATA_DFLAG_SUSPENDED flag, but it 
doesn't seem to happen. Or is it only for SATA?

Thanks
Guennadi
---
Guennadi Liakhovetski

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

* Re: [PATCH] pata_sil680 suspend/resume
  2007-02-26 21:17 ` Guennadi Liakhovetski
@ 2007-02-26 21:38   ` Guennadi Liakhovetski
  2007-02-28 21:19     ` Guennadi Liakhovetski
  1 sibling, 0 replies; 13+ messages in thread
From: Guennadi Liakhovetski @ 2007-02-26 21:38 UTC (permalink / raw)
  To: Alan; +Cc: linux-kernel, jgarzik

On Mon, 26 Feb 2007, Guennadi Liakhovetski wrote:

> With an approximately 2.6.20 kernel I could suspend, but on resume I got

Sorry, a "small" correction - it turned out to be a 2.6.19-rc4-ish kernel, 
so, it is still without your suspend / resume patch, hence we can just 
forget it. Remains to clarify why the new one doesn't allow to suspend.

Thanks
Guennadi
---
Guennadi Liakhovetski

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

* Re: [PATCH] pata_sil680 suspend/resume
  2007-02-26 21:17 ` Guennadi Liakhovetski
@ 2007-02-28 21:19     ` Guennadi Liakhovetski
  2007-02-28 21:19     ` Guennadi Liakhovetski
  1 sibling, 0 replies; 13+ messages in thread
From: Guennadi Liakhovetski @ 2007-02-28 21:19 UTC (permalink / raw)
  To: Alan; +Cc: linux-kernel, jgarzik, linux-pm

On Mon, 26 Feb 2007, Guennadi Liakhovetski wrote:

> With a post 2.6.20 kernel from powerpc.git I cannot suspend at all:
> 
> pata_sil680 0000:00:0c.0: suspend
> ata1: suspend failed, device 0 still active
> pci_device_suspend(): ata_pci_device_suspend+0x0/0x74() returns -16
> suspend_device(): pci_device_suspend+0x0/0xac() returns -16
> Could not suspend device 0000:00:0c.0: error -16

AFAICS, "still active" is printed from ata_host_suspend() if a device 
(disk) on the host to be suspended doesn't have ATA_DFLAG_SUSPENDED flag 
set. This flag is only set in ata_eh_suspend(), which is only called from 
ata_eh_recover(), like this:

generic_error_handler()
ata_bmdma_drive_eh()
ata_do_eh()
ata_eh_recover()
ata_eh_suspend()
dev->flags |= ATA_DFLAG_SUSPENDED;

but I don't understand why the error handler should be envoked? Should the 
"disk" be suspended before the host and is it when the eh should set the 
flag? If my guess is right - why doesn't the disk get suspended on my 
machine? Shall I suspend it explicitely from userspace? I do "hdparm -Y", 
and it does stop spinning", but I still get the error.

Thanks
Guennadi
---
Guennadi Liakhovetski

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

* Re: [PATCH] pata_sil680 suspend/resume
@ 2007-02-28 21:19     ` Guennadi Liakhovetski
  0 siblings, 0 replies; 13+ messages in thread
From: Guennadi Liakhovetski @ 2007-02-28 21:19 UTC (permalink / raw)
  To: Alan; +Cc: linux-pm, jgarzik, linux-kernel

On Mon, 26 Feb 2007, Guennadi Liakhovetski wrote:

> With a post 2.6.20 kernel from powerpc.git I cannot suspend at all:
> 
> pata_sil680 0000:00:0c.0: suspend
> ata1: suspend failed, device 0 still active
> pci_device_suspend(): ata_pci_device_suspend+0x0/0x74() returns -16
> suspend_device(): pci_device_suspend+0x0/0xac() returns -16
> Could not suspend device 0000:00:0c.0: error -16

AFAICS, "still active" is printed from ata_host_suspend() if a device 
(disk) on the host to be suspended doesn't have ATA_DFLAG_SUSPENDED flag 
set. This flag is only set in ata_eh_suspend(), which is only called from 
ata_eh_recover(), like this:

generic_error_handler()
ata_bmdma_drive_eh()
ata_do_eh()
ata_eh_recover()
ata_eh_suspend()
dev->flags |= ATA_DFLAG_SUSPENDED;

but I don't understand why the error handler should be envoked? Should the 
"disk" be suspended before the host and is it when the eh should set the 
flag? If my guess is right - why doesn't the disk get suspended on my 
machine? Shall I suspend it explicitely from userspace? I do "hdparm -Y", 
and it does stop spinning", but I still get the error.

Thanks
Guennadi
---
Guennadi Liakhovetski

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

* Re: [PATCH] pata_sil680 suspend/resume
  2007-02-28 21:19     ` Guennadi Liakhovetski
  (?)
@ 2007-03-01 22:11     ` Guennadi Liakhovetski
  2007-03-02  8:45       ` [PATCH 1/2 -stable] libata: add missing PM callbacks Tejun Heo
  -1 siblings, 1 reply; 13+ messages in thread
From: Guennadi Liakhovetski @ 2007-03-01 22:11 UTC (permalink / raw)
  To: Alan; +Cc: linux-kernel, jgarzik, linux-pm, Tejun Heo, linux-ide

Tejun,

I tracked this change down to your patch: 
http://marc.theaimsgroup.com/?t=115012763500002&r=1&w=2 (approximately). 
(Interestingly, Jeff submitted the respective cumulative libata patch last 
year on my birthday:-( ) Also, there's a Ubuntu bug report: 
https://launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/76431 
identical to what I see, although I cannot check if it worked before 
2.6.20. Could you, please, comment how is this supposed to work? In 
particular, what shoud trigger the EH action, leading to setting the 
ATA_DFLAG_SUSPENDED flag? Below again my earlier post for reference.

Thanks
Guennadi

On Wed, 28 Feb 2007, Guennadi Liakhovetski wrote:

> On Mon, 26 Feb 2007, Guennadi Liakhovetski wrote:
> 
> > With a post 2.6.20 kernel from powerpc.git I cannot suspend at all:
> > 
> > pata_sil680 0000:00:0c.0: suspend
> > ata1: suspend failed, device 0 still active
> > pci_device_suspend(): ata_pci_device_suspend+0x0/0x74() returns -16
> > suspend_device(): pci_device_suspend+0x0/0xac() returns -16
> > Could not suspend device 0000:00:0c.0: error -16
> 
> AFAICS, "still active" is printed from ata_host_suspend() if a device 
> (disk) on the host to be suspended doesn't have ATA_DFLAG_SUSPENDED flag 
> set. This flag is only set in ata_eh_suspend(), which is only called from 
> ata_eh_recover(), like this:
> 
> generic_error_handler()
> ata_bmdma_drive_eh()
> ata_do_eh()
> ata_eh_recover()
> ata_eh_suspend()
> dev->flags |= ATA_DFLAG_SUSPENDED;
> 
> but I don't understand why the error handler should be envoked? Should the 
> "disk" be suspended before the host and is it when the eh should set the 
> flag? If my guess is right - why doesn't the disk get suspended on my 
> machine? Shall I suspend it explicitely from userspace? I do "hdparm -Y", 
> and it does stop spinning", but I still get the error.
> 
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski
> 

---
Guennadi Liakhovetski

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

* [PATCH 1/2 -stable] libata: add missing PM callbacks
  2007-03-01 22:11     ` Guennadi Liakhovetski
@ 2007-03-02  8:45       ` Tejun Heo
  2007-03-02  8:46         ` [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs Tejun Heo
  2007-03-02 22:42         ` [PATCH 1/2 -stable] libata: add missing PM callbacks Guennadi Liakhovetski
  0 siblings, 2 replies; 13+ messages in thread
From: Tejun Heo @ 2007-03-02  8:45 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Alan, linux-kernel, jgarzik, linux-pm, linux-ide, stable

Some LLDs were missing scsi device PM callbacks while having host/port
suspend support.  Add missing ones.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
This should fix the problem you're seeing on sil680.  These patches
are against 2.6.20.1.  Patches for libata-dev#upstream is separately
posted to linux-ide in the following thread.

  http://thread.gmane.org/gmane.linux.ide/16475

 drivers/ata/pata_jmicron.c |    4 ++++
 drivers/ata/pata_sil680.c  |    4 ++++
 2 files changed, 8 insertions(+)

Index: work1/drivers/ata/pata_sil680.c
===================================================================
--- work1.orig/drivers/ata/pata_sil680.c
+++ work1/drivers/ata/pata_sil680.c
@@ -226,6 +226,10 @@ static struct scsi_host_template sil680_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
+	.suspend		= ata_scsi_device_suspend,
+	.resume			= ata_scsi_device_resume,
+#endif
 };
 
 static struct ata_port_operations sil680_port_ops = {
Index: work1/drivers/ata/pata_jmicron.c
===================================================================
--- work1.orig/drivers/ata/pata_jmicron.c
+++ work1/drivers/ata/pata_jmicron.c
@@ -137,6 +137,10 @@ static struct scsi_host_template jmicron
 	.slave_destroy		= ata_scsi_slave_destroy,
 	/* Use standard CHS mapping rules */
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
+	.suspend		= ata_scsi_device_suspend,
+	.resume			= ata_scsi_device_resume,
+#endif
 };
 
 static const struct ata_port_operations jmicron_ops = {

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

* [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs
  2007-03-02  8:45       ` [PATCH 1/2 -stable] libata: add missing PM callbacks Tejun Heo
@ 2007-03-02  8:46         ` Tejun Heo
  2007-03-03  0:18             ` [linux-pm] " Nigel Cunningham
  2007-03-02 22:42         ` [PATCH 1/2 -stable] libata: add missing PM callbacks Guennadi Liakhovetski
  1 sibling, 1 reply; 13+ messages in thread
From: Tejun Heo @ 2007-03-02  8:46 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Alan, linux-kernel, jgarzik, linux-pm, linux-ide, stable

Add missing #ifdef CONFIG_PM conditionals around all PM related parts
in libata LLDs.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
 drivers/ata/ahci.c              |   14 ++++++++++++++
 drivers/ata/ata_generic.c       |    4 ++++
 drivers/ata/ata_piix.c          |    4 ++++
 drivers/ata/pata_ali.c          |    6 ++++++
 drivers/ata/pata_amd.c          |    6 ++++++
 drivers/ata/pata_atiixp.c       |    4 ++++
 drivers/ata/pata_cmd64x.c       |    6 ++++++
 drivers/ata/pata_cs5520.c       |    7 +++++++
 drivers/ata/pata_cs5530.c       |    6 ++++++
 drivers/ata/pata_cs5535.c       |    4 ++++
 drivers/ata/pata_cypress.c      |    4 ++++
 drivers/ata/pata_efar.c         |    4 ++++
 drivers/ata/pata_hpt366.c       |    7 ++++++-
 drivers/ata/pata_hpt3x3.c       |    6 ++++++
 drivers/ata/pata_it821x.c       |    6 ++++++
 drivers/ata/pata_jmicron.c      |    4 ++++
 drivers/ata/pata_marvell.c      |    4 ++++
 drivers/ata/pata_mpiix.c        |    4 ++++
 drivers/ata/pata_netcell.c      |    4 ++++
 drivers/ata/pata_ns87410.c      |    4 ++++
 drivers/ata/pata_oldpiix.c      |    4 ++++
 drivers/ata/pata_opti.c         |    4 ++++
 drivers/ata/pata_optidma.c      |    4 ++++
 drivers/ata/pata_pdc202xx_old.c |    4 ++++
 drivers/ata/pata_radisys.c      |    4 ++++
 drivers/ata/pata_rz1000.c       |    6 ++++++
 drivers/ata/pata_sc1200.c       |    4 ++++
 drivers/ata/pata_serverworks.c  |    6 ++++++
 drivers/ata/pata_sil680.c       |    4 ++++
 drivers/ata/pata_sis.c          |    4 ++++
 drivers/ata/pata_triflex.c      |    4 ++++
 drivers/ata/pata_via.c          |    6 ++++++
 drivers/ata/sata_sil.c          |    2 ++
 drivers/ata/sata_sil24.c        |    2 ++
 34 files changed, 165 insertions(+), 1 deletion(-)

Index: work1/drivers/ata/ahci.c
===================================================================
--- work1.orig/drivers/ata/ahci.c
+++ work1/drivers/ata/ahci.c
@@ -225,10 +225,12 @@ static void ahci_thaw(struct ata_port *a
 static void ahci_error_handler(struct ata_port *ap);
 static void ahci_vt8251_error_handler(struct ata_port *ap);
 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
+#ifdef CONFIG_PM
 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
 static int ahci_port_resume(struct ata_port *ap);
 static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
 static int ahci_pci_device_resume(struct pci_dev *pdev);
+#endif
 static void ahci_remove_one (struct pci_dev *pdev);
 
 static struct scsi_host_template ahci_sht = {
@@ -248,8 +250,10 @@ static struct scsi_host_template ahci_sh
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.suspend		= ata_scsi_device_suspend,
 	.resume			= ata_scsi_device_resume,
+#endif
 };
 
 static const struct ata_port_operations ahci_ops = {
@@ -276,8 +280,10 @@ static const struct ata_port_operations 
 	.error_handler		= ahci_error_handler,
 	.post_internal_cmd	= ahci_post_internal_cmd,
 
+#ifdef CONFIG_PM
 	.port_suspend		= ahci_port_suspend,
 	.port_resume		= ahci_port_resume,
+#endif
 
 	.port_start		= ahci_port_start,
 	.port_stop		= ahci_port_stop,
@@ -307,8 +313,10 @@ static const struct ata_port_operations 
 	.error_handler		= ahci_vt8251_error_handler,
 	.post_internal_cmd	= ahci_post_internal_cmd,
 
+#ifdef CONFIG_PM
 	.port_suspend		= ahci_port_suspend,
 	.port_resume		= ahci_port_resume,
+#endif
 
 	.port_start		= ahci_port_start,
 	.port_stop		= ahci_port_stop,
@@ -441,8 +449,10 @@ static struct pci_driver ahci_pci_driver
 	.name			= DRV_NAME,
 	.id_table		= ahci_pci_tbl,
 	.probe			= ahci_init_one,
+#ifdef CONFIG_PM
 	.suspend		= ahci_pci_device_suspend,
 	.resume			= ahci_pci_device_resume,
+#endif
 	.remove			= ahci_remove_one,
 };
 
@@ -587,6 +597,7 @@ static void ahci_power_up(void __iomem *
 	writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD);
 }
 
+#ifdef CONFIG_PM
 static void ahci_power_down(void __iomem *port_mmio, u32 cap)
 {
 	u32 cmd, scontrol;
@@ -604,6 +615,7 @@ static void ahci_power_down(void __iomem
 	cmd &= ~PORT_CMD_SPIN_UP;
 	writel(cmd, port_mmio + PORT_CMD);
 }
+#endif
 
 static void ahci_init_port(void __iomem *port_mmio, u32 cap,
 			   dma_addr_t cmd_slot_dma, dma_addr_t rx_fis_dma)
@@ -1336,6 +1348,7 @@ static void ahci_post_internal_cmd(struc
 	}
 }
 
+#ifdef CONFIG_PM
 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
 {
 	struct ahci_host_priv *hpriv = ap->host->private_data;
@@ -1412,6 +1425,7 @@ static int ahci_pci_device_resume(struct
 
 	return 0;
 }
+#endif
 
 static int ahci_port_start(struct ata_port *ap)
 {
Index: work1/drivers/ata/ata_generic.c
===================================================================
--- work1.orig/drivers/ata/ata_generic.c
+++ work1/drivers/ata/ata_generic.c
@@ -119,8 +119,10 @@ static struct scsi_host_template generic
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations generic_port_ops = {
@@ -230,8 +232,10 @@ static struct pci_driver ata_generic_pci
 	.id_table	= ata_generic,
 	.probe 		= ata_generic_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init ata_generic_init(void)
Index: work1/drivers/ata/ata_piix.c
===================================================================
--- work1.orig/drivers/ata/ata_piix.c
+++ work1/drivers/ata/ata_piix.c
@@ -255,8 +255,10 @@ static struct pci_driver piix_pci_driver
 	.id_table		= piix_pci_tbl,
 	.probe			= piix_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= ata_pci_device_resume,
+#endif
 };
 
 static struct scsi_host_template piix_sht = {
@@ -275,8 +277,10 @@ static struct scsi_host_template piix_sh
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static const struct ata_port_operations piix_pata_ops = {
Index: work1/drivers/ata/pata_ali.c
===================================================================
--- work1.orig/drivers/ata/pata_ali.c
+++ work1/drivers/ata/pata_ali.c
@@ -345,8 +345,10 @@ static struct scsi_host_template ali_sht
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 /*
@@ -667,11 +669,13 @@ static int ali_init_one(struct pci_dev *
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int ali_reinit_one(struct pci_dev *pdev)
 {
 	ali_init_chipset(pdev);
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id ali[] = {
 	{ PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), },
@@ -685,8 +689,10 @@ static struct pci_driver ali_pci_driver 
 	.id_table	= ali,
 	.probe 		= ali_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ali_reinit_one,
+#endif
 };
 
 static int __init ali_init(void)
Index: work1/drivers/ata/pata_amd.c
===================================================================
--- work1.orig/drivers/ata/pata_amd.c
+++ work1/drivers/ata/pata_amd.c
@@ -334,8 +334,10 @@ static struct scsi_host_template amd_sht
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations amd33_port_ops = {
@@ -663,6 +665,7 @@ static int amd_init_one(struct pci_dev *
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int amd_reinit_one(struct pci_dev *pdev)
 {
 	if (pdev->vendor == PCI_VENDOR_ID_AMD) {
@@ -679,6 +682,7 @@ static int amd_reinit_one(struct pci_dev
 	}
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id amd[] = {
 	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_COBRA_7401),		0 },
@@ -708,8 +712,10 @@ static struct pci_driver amd_pci_driver 
 	.id_table	= amd,
 	.probe 		= amd_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= amd_reinit_one,
+#endif
 };
 
 static int __init amd_init(void)
Index: work1/drivers/ata/pata_atiixp.c
===================================================================
--- work1.orig/drivers/ata/pata_atiixp.c
+++ work1/drivers/ata/pata_atiixp.c
@@ -224,8 +224,10 @@ static struct scsi_host_template atiixp_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations atiixp_port_ops = {
@@ -290,8 +292,10 @@ static struct pci_driver atiixp_pci_driv
 	.id_table	= atiixp,
 	.probe 		= atiixp_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.resume		= ata_pci_device_resume,
 	.suspend	= ata_pci_device_suspend,
+#endif
 };
 
 static int __init atiixp_init(void)
Index: work1/drivers/ata/pata_cmd64x.c
===================================================================
--- work1.orig/drivers/ata/pata_cmd64x.c
+++ work1/drivers/ata/pata_cmd64x.c
@@ -285,8 +285,10 @@ static struct scsi_host_template cmd64x_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations cmd64x_port_ops = {
@@ -479,6 +481,7 @@ static int cmd64x_init_one(struct pci_de
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int cmd64x_reinit_one(struct pci_dev *pdev)
 {
 	u8 mrdmode;
@@ -492,6 +495,7 @@ static int cmd64x_reinit_one(struct pci_
 #endif
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id cmd64x[] = {
 	{ PCI_VDEVICE(CMD, PCI_DEVICE_ID_CMD_643), 0 },
@@ -507,8 +511,10 @@ static struct pci_driver cmd64x_pci_driv
 	.id_table	= cmd64x,
 	.probe 		= cmd64x_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= cmd64x_reinit_one,
+#endif
 };
 
 static int __init cmd64x_init(void)
Index: work1/drivers/ata/pata_cs5520.c
===================================================================
--- work1.orig/drivers/ata/pata_cs5520.c
+++ work1/drivers/ata/pata_cs5520.c
@@ -167,8 +167,10 @@ static struct scsi_host_template cs5520_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations cs5520_port_ops = {
@@ -298,6 +300,7 @@ static void __devexit cs5520_remove_one(
 	dev_set_drvdata(dev, NULL);
 }
 
+#ifdef CONFIG_PM
 /**
  *	cs5520_reinit_one	-	device resume
  *	@pdev: PCI device
@@ -314,6 +317,8 @@ static int cs5520_reinit_one(struct pci_
 		pci_write_config_byte(pdev, 0x60, pcicfg | 0x40);
 	return ata_pci_device_resume(pdev);
 }
+#endif
+
 /* For now keep DMA off. We can set it for all but A rev CS5510 once the
    core ATA code can handle it */
 
@@ -329,8 +334,10 @@ static struct pci_driver cs5520_pci_driv
 	.id_table	= pata_cs5520,
 	.probe 		= cs5520_init_one,
 	.remove		= cs5520_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= cs5520_reinit_one,
+#endif
 };
 
 static int __init cs5520_init(void)
Index: work1/drivers/ata/pata_cs5530.c
===================================================================
--- work1.orig/drivers/ata/pata_cs5530.c
+++ work1/drivers/ata/pata_cs5530.c
@@ -181,8 +181,10 @@ static struct scsi_host_template cs5530_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations cs5530_port_ops = {
@@ -369,6 +371,7 @@ static int cs5530_init_one(struct pci_de
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int cs5530_reinit_one(struct pci_dev *pdev)
 {
 	/* If we fail on resume we are doomed */
@@ -376,6 +379,7 @@ static int cs5530_reinit_one(struct pci_
 		BUG();
 	return ata_pci_device_resume(pdev);
 }
+#endif
 	
 static const struct pci_device_id cs5530[] = {
 	{ PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE), },
@@ -388,8 +392,10 @@ static struct pci_driver cs5530_pci_driv
 	.id_table	= cs5530,
 	.probe 		= cs5530_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= cs5530_reinit_one,
+#endif
 };
 
 static int __init cs5530_init(void)
Index: work1/drivers/ata/pata_cs5535.c
===================================================================
--- work1.orig/drivers/ata/pata_cs5535.c
+++ work1/drivers/ata/pata_cs5535.c
@@ -185,8 +185,10 @@ static struct scsi_host_template cs5535_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations cs5535_port_ops = {
@@ -270,8 +272,10 @@ static struct pci_driver cs5535_pci_driv
 	.id_table	= cs5535,
 	.probe 		= cs5535_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init cs5535_init(void)
Index: work1/drivers/ata/pata_cypress.c
===================================================================
--- work1.orig/drivers/ata/pata_cypress.c
+++ work1/drivers/ata/pata_cypress.c
@@ -136,8 +136,10 @@ static struct scsi_host_template cy82c69
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations cy82c693_port_ops = {
@@ -206,8 +208,10 @@ static struct pci_driver cy82c693_pci_dr
 	.id_table	= cy82c693,
 	.probe 		= cy82c693_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init cy82c693_init(void)
Index: work1/drivers/ata/pata_efar.c
===================================================================
--- work1.orig/drivers/ata/pata_efar.c
+++ work1/drivers/ata/pata_efar.c
@@ -234,8 +234,10 @@ static struct scsi_host_template efar_sh
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static const struct ata_port_operations efar_ops = {
@@ -317,8 +319,10 @@ static struct pci_driver efar_pci_driver
 	.id_table		= efar_pci_tbl,
 	.probe			= efar_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= ata_pci_device_resume,
+#endif
 };
 
 static int __init efar_init(void)
Index: work1/drivers/ata/pata_hpt366.c
===================================================================
--- work1.orig/drivers/ata/pata_hpt366.c
+++ work1/drivers/ata/pata_hpt366.c
@@ -338,8 +338,10 @@ static struct scsi_host_template hpt36x_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 /*
@@ -467,12 +469,13 @@ static int hpt36x_init_one(struct pci_de
 	return ata_pci_init_one(dev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int hpt36x_reinit_one(struct pci_dev *dev)
 {
 	hpt36x_init_chipset(dev);
 	return ata_pci_device_resume(dev);
 }
-
+#endif
 
 static const struct pci_device_id hpt36x[] = {
 	{ PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), },
@@ -484,8 +487,10 @@ static struct pci_driver hpt36x_pci_driv
 	.id_table	= hpt36x,
 	.probe 		= hpt36x_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= hpt36x_reinit_one,
+#endif
 };
 
 static int __init hpt36x_init(void)
Index: work1/drivers/ata/pata_hpt3x3.c
===================================================================
--- work1.orig/drivers/ata/pata_hpt3x3.c
+++ work1/drivers/ata/pata_hpt3x3.c
@@ -119,8 +119,10 @@ static struct scsi_host_template hpt3x3_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations hpt3x3_port_ops = {
@@ -206,11 +208,13 @@ static int hpt3x3_init_one(struct pci_de
 	return ata_pci_init_one(dev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int hpt3x3_reinit_one(struct pci_dev *dev)
 {
 	hpt3x3_init_chipset(dev);
 	return ata_pci_device_resume(dev);
 }
+#endif
 
 static const struct pci_device_id hpt3x3[] = {
 	{ PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT343), },
@@ -223,8 +227,10 @@ static struct pci_driver hpt3x3_pci_driv
 	.id_table	= hpt3x3,
 	.probe 		= hpt3x3_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= hpt3x3_reinit_one,
+#endif
 };
 
 static int __init hpt3x3_init(void)
Index: work1/drivers/ata/pata_it821x.c
===================================================================
--- work1.orig/drivers/ata/pata_it821x.c
+++ work1/drivers/ata/pata_it821x.c
@@ -676,8 +676,10 @@ static struct scsi_host_template it821x_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations it821x_smart_port_ops = {
@@ -810,6 +812,7 @@ static int it821x_init_one(struct pci_de
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int it821x_reinit_one(struct pci_dev *pdev)
 {
 	/* Resume - turn raid back off if need be */
@@ -817,6 +820,7 @@ static int it821x_reinit_one(struct pci_
 		it821x_disable_raid(pdev);
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id it821x[] = {
 	{ PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), },
@@ -830,8 +834,10 @@ static struct pci_driver it821x_pci_driv
 	.id_table	= it821x,
 	.probe 		= it821x_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= it821x_reinit_one,
+#endif
 };
 
 static int __init it821x_init(void)
Index: work1/drivers/ata/pata_jmicron.c
===================================================================
--- work1.orig/drivers/ata/pata_jmicron.c
+++ work1/drivers/ata/pata_jmicron.c
@@ -222,6 +222,7 @@ static int jmicron_init_one (struct pci_
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int jmicron_reinit_one(struct pci_dev *pdev)
 {
 	u32 reg;
@@ -242,6 +243,7 @@ static int jmicron_reinit_one(struct pci
 	}
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id jmicron_pci_tbl[] = {
 	{ PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB361), 361},
@@ -258,8 +260,10 @@ static struct pci_driver jmicron_pci_dri
 	.id_table		= jmicron_pci_tbl,
 	.probe			= jmicron_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= jmicron_reinit_one,
+#endif
 };
 
 static int __init jmicron_init(void)
Index: work1/drivers/ata/pata_marvell.c
===================================================================
--- work1.orig/drivers/ata/pata_marvell.c
+++ work1/drivers/ata/pata_marvell.c
@@ -103,8 +103,10 @@ static struct scsi_host_template marvell
 	.slave_destroy		= ata_scsi_slave_destroy,
 	/* Use standard CHS mapping rules */
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static const struct ata_port_operations marvell_ops = {
@@ -199,8 +201,10 @@ static struct pci_driver marvell_pci_dri
 	.id_table		= marvell_pci_tbl,
 	.probe			= marvell_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= ata_pci_device_resume,
+#endif
 };
 
 static int __init marvell_init(void)
Index: work1/drivers/ata/pata_mpiix.c
===================================================================
--- work1.orig/drivers/ata/pata_mpiix.c
+++ work1/drivers/ata/pata_mpiix.c
@@ -167,8 +167,10 @@ static struct scsi_host_template mpiix_s
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations mpiix_port_ops = {
@@ -287,8 +289,10 @@ static struct pci_driver mpiix_pci_drive
 	.id_table	= mpiix,
 	.probe 		= mpiix_init_one,
 	.remove		= mpiix_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init mpiix_init(void)
Index: work1/drivers/ata/pata_netcell.c
===================================================================
--- work1.orig/drivers/ata/pata_netcell.c
+++ work1/drivers/ata/pata_netcell.c
@@ -63,8 +63,10 @@ static struct scsi_host_template netcell
 	.slave_destroy		= ata_scsi_slave_destroy,
 	/* Use standard CHS mapping rules */
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static const struct ata_port_operations netcell_ops = {
@@ -153,8 +155,10 @@ static struct pci_driver netcell_pci_dri
 	.id_table		= netcell_pci_tbl,
 	.probe			= netcell_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= ata_pci_device_resume,
+#endif
 };
 
 static int __init netcell_init(void)
Index: work1/drivers/ata/pata_ns87410.c
===================================================================
--- work1.orig/drivers/ata/pata_ns87410.c
+++ work1/drivers/ata/pata_ns87410.c
@@ -157,8 +157,10 @@ static struct scsi_host_template ns87410
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations ns87410_port_ops = {
@@ -212,8 +214,10 @@ static struct pci_driver ns87410_pci_dri
 	.id_table	= ns87410,
 	.probe 		= ns87410_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init ns87410_init(void)
Index: work1/drivers/ata/pata_oldpiix.c
===================================================================
--- work1.orig/drivers/ata/pata_oldpiix.c
+++ work1/drivers/ata/pata_oldpiix.c
@@ -232,8 +232,10 @@ static struct scsi_host_template oldpiix
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static const struct ata_port_operations oldpiix_pata_ops = {
@@ -315,8 +317,10 @@ static struct pci_driver oldpiix_pci_dri
 	.id_table		= oldpiix_pci_tbl,
 	.probe			= oldpiix_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= ata_pci_device_resume,
+#endif
 };
 
 static int __init oldpiix_init(void)
Index: work1/drivers/ata/pata_opti.c
===================================================================
--- work1.orig/drivers/ata/pata_opti.c
+++ work1/drivers/ata/pata_opti.c
@@ -179,8 +179,10 @@ static struct scsi_host_template opti_sh
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations opti_port_ops = {
@@ -244,8 +246,10 @@ static struct pci_driver opti_pci_driver
 	.id_table	= opti,
 	.probe 		= opti_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init opti_init(void)
Index: work1/drivers/ata/pata_optidma.c
===================================================================
--- work1.orig/drivers/ata/pata_optidma.c
+++ work1/drivers/ata/pata_optidma.c
@@ -360,8 +360,10 @@ static struct scsi_host_template optidma
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations optidma_port_ops = {
@@ -524,8 +526,10 @@ static struct pci_driver optidma_pci_dri
 	.id_table	= optidma,
 	.probe 		= optidma_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init optidma_init(void)
Index: work1/drivers/ata/pata_pdc202xx_old.c
===================================================================
--- work1.orig/drivers/ata/pata_pdc202xx_old.c
+++ work1/drivers/ata/pata_pdc202xx_old.c
@@ -270,8 +270,10 @@ static struct scsi_host_template pdc202x
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations pdc2024x_port_ops = {
@@ -402,8 +404,10 @@ static struct pci_driver pdc202xx_pci_dr
 	.id_table	= pdc202xx,
 	.probe 		= pdc202xx_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init pdc202xx_init(void)
Index: work1/drivers/ata/pata_radisys.c
===================================================================
--- work1.orig/drivers/ata/pata_radisys.c
+++ work1/drivers/ata/pata_radisys.c
@@ -228,8 +228,10 @@ static struct scsi_host_template radisys
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static const struct ata_port_operations radisys_pata_ops = {
@@ -312,8 +314,10 @@ static struct pci_driver radisys_pci_dri
 	.id_table		= radisys_pci_tbl,
 	.probe			= radisys_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= ata_pci_device_resume,
+#endif
 };
 
 static int __init radisys_init(void)
Index: work1/drivers/ata/pata_rz1000.c
===================================================================
--- work1.orig/drivers/ata/pata_rz1000.c
+++ work1/drivers/ata/pata_rz1000.c
@@ -93,8 +93,10 @@ static struct scsi_host_template rz1000_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations rz1000_port_ops = {
@@ -177,6 +179,7 @@ static int rz1000_init_one (struct pci_d
 	return -ENODEV;
 }
 
+#ifdef CONFIG_PM
 static int rz1000_reinit_one(struct pci_dev *pdev)
 {
 	/* If this fails on resume (which is a "cant happen" case), we
@@ -185,6 +188,7 @@ static int rz1000_reinit_one(struct pci_
 		panic("rz1000 fifo");
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id pata_rz1000[] = {
 	{ PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), },
@@ -198,8 +202,10 @@ static struct pci_driver rz1000_pci_driv
 	.id_table	= pata_rz1000,
 	.probe 		= rz1000_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= rz1000_reinit_one,
+#endif
 };
 
 static int __init rz1000_init(void)
Index: work1/drivers/ata/pata_sc1200.c
===================================================================
--- work1.orig/drivers/ata/pata_sc1200.c
+++ work1/drivers/ata/pata_sc1200.c
@@ -194,8 +194,10 @@ static struct scsi_host_template sc1200_
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations sc1200_port_ops = {
@@ -266,8 +268,10 @@ static struct pci_driver sc1200_pci_driv
 	.id_table	= sc1200,
 	.probe 		= sc1200_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init sc1200_init(void)
Index: work1/drivers/ata/pata_serverworks.c
===================================================================
--- work1.orig/drivers/ata/pata_serverworks.c
+++ work1/drivers/ata/pata_serverworks.c
@@ -326,8 +326,10 @@ static struct scsi_host_template serverw
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations serverworks_osb4_port_ops = {
@@ -555,6 +557,7 @@ static int serverworks_init_one(struct p
 	return ata_pci_init_one(pdev, port_info, ports);
 }
 
+#ifdef CONFIG_PM
 static int serverworks_reinit_one(struct pci_dev *pdev)
 {
 	/* Force master latency timer to 64 PCI clocks */
@@ -578,6 +581,7 @@ static int serverworks_reinit_one(struct
 	}
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id serverworks[] = {
 	{ PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0},
@@ -594,8 +598,10 @@ static struct pci_driver serverworks_pci
 	.id_table	= serverworks,
 	.probe 		= serverworks_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= serverworks_reinit_one,
+#endif
 };
 
 static int __init serverworks_init(void)
Index: work1/drivers/ata/pata_sil680.c
===================================================================
--- work1.orig/drivers/ata/pata_sil680.c
+++ work1/drivers/ata/pata_sil680.c
@@ -371,11 +371,13 @@ static int sil680_init_one(struct pci_de
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 static int sil680_reinit_one(struct pci_dev *pdev)
 {
 	sil680_init_chip(pdev);
 	return ata_pci_device_resume(pdev);
 }
+#endif
 
 static const struct pci_device_id sil680[] = {
 	{ PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), },
@@ -388,8 +390,10 @@ static struct pci_driver sil680_pci_driv
 	.id_table	= sil680,
 	.probe 		= sil680_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= sil680_reinit_one,
+#endif
 };
 
 static int __init sil680_init(void)
Index: work1/drivers/ata/pata_sis.c
===================================================================
--- work1.orig/drivers/ata/pata_sis.c
+++ work1/drivers/ata/pata_sis.c
@@ -546,8 +546,10 @@ static struct scsi_host_template sis_sht
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static const struct ata_port_operations sis_133_ops = {
@@ -1001,8 +1003,10 @@ static struct pci_driver sis_pci_driver 
 	.id_table		= sis_pci_tbl,
 	.probe			= sis_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend		= ata_pci_device_suspend,
 	.resume			= ata_pci_device_resume,
+#endif
 };
 
 static int __init sis_init(void)
Index: work1/drivers/ata/pata_triflex.c
===================================================================
--- work1.orig/drivers/ata/pata_triflex.c
+++ work1/drivers/ata/pata_triflex.c
@@ -193,8 +193,10 @@ static struct scsi_host_template triflex
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations triflex_port_ops = {
@@ -260,8 +262,10 @@ static struct pci_driver triflex_pci_dri
 	.id_table	= triflex,
 	.probe 		= triflex_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= ata_pci_device_resume,
+#endif
 };
 
 static int __init triflex_init(void)
Index: work1/drivers/ata/pata_via.c
===================================================================
--- work1.orig/drivers/ata/pata_via.c
+++ work1/drivers/ata/pata_via.c
@@ -305,8 +305,10 @@ static struct scsi_host_template via_sht
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.resume			= ata_scsi_device_resume,
 	.suspend		= ata_scsi_device_suspend,
+#endif
 };
 
 static struct ata_port_operations via_port_ops = {
@@ -560,6 +562,7 @@ static int via_init_one(struct pci_dev *
 	return ata_pci_init_one(pdev, port_info, 2);
 }
 
+#ifdef CONFIG_PM
 /**
  *	via_reinit_one		-	reinit after resume
  *	@pdev; PCI device
@@ -592,6 +595,7 @@ static int via_reinit_one(struct pci_dev
 	}
 	return ata_pci_device_resume(pdev);	
 }
+#endif
 
 static const struct pci_device_id via[] = {
 	{ PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), },
@@ -607,8 +611,10 @@ static struct pci_driver via_pci_driver 
 	.id_table	= via,
 	.probe 		= via_init_one,
 	.remove		= ata_pci_remove_one,
+#ifdef CONFIG_PM
 	.suspend	= ata_pci_device_suspend,
 	.resume		= via_reinit_one,
+#endif
 };
 
 static int __init via_init(void)
Index: work1/drivers/ata/sata_sil.c
===================================================================
--- work1.orig/drivers/ata/sata_sil.c
+++ work1/drivers/ata/sata_sil.c
@@ -181,8 +181,10 @@ static struct scsi_host_template sil_sht
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.suspend		= ata_scsi_device_suspend,
 	.resume			= ata_scsi_device_resume,
+#endif
 };
 
 static const struct ata_port_operations sil_ops = {
Index: work1/drivers/ata/sata_sil24.c
===================================================================
--- work1.orig/drivers/ata/sata_sil24.c
+++ work1/drivers/ata/sata_sil24.c
@@ -386,8 +386,10 @@ static struct scsi_host_template sil24_s
 	.slave_configure	= ata_scsi_slave_config,
 	.slave_destroy		= ata_scsi_slave_destroy,
 	.bios_param		= ata_std_bios_param,
+#ifdef CONFIG_PM
 	.suspend		= ata_scsi_device_suspend,
 	.resume			= ata_scsi_device_resume,
+#endif
 };
 
 static const struct ata_port_operations sil24_ops = {

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

* Re: [PATCH 1/2 -stable] libata: add missing PM callbacks
  2007-03-02  8:45       ` [PATCH 1/2 -stable] libata: add missing PM callbacks Tejun Heo
  2007-03-02  8:46         ` [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs Tejun Heo
@ 2007-03-02 22:42         ` Guennadi Liakhovetski
  1 sibling, 0 replies; 13+ messages in thread
From: Guennadi Liakhovetski @ 2007-03-02 22:42 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Alan, linux-kernel, jgarzik, linux-pm, linux-ide, stable

On Fri, 2 Mar 2007, Tejun Heo wrote:

> Some LLDs were missing scsi device PM callbacks while having host/port
> suspend support.  Add missing ones.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> This should fix the problem you're seeing on sil680.  These patches
> are against 2.6.20.1.  Patches for libata-dev#upstream is separately
> posted to linux-ide in the following thread.

Yep, this looks good now, I think, thanks! I still have to fix some 
badness, but it looks unrelated. The disk switches off and on now 
automatically as expected. I'll do further tests, but, it looks quite good 
as it stands.

Thanks
Guennadi
---
Guennadi Liakhovetski

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

* Re: [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs
  2007-03-02  8:46         ` [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs Tejun Heo
@ 2007-03-03  0:18             ` Nigel Cunningham
  0 siblings, 0 replies; 13+ messages in thread
From: Nigel Cunningham @ 2007-03-03  0:18 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-ide, linux-kernel, linux-pm, jgarzik, stable, Alan,
	Guennadi Liakhovetski

Hi.

On Fri, 2007-03-02 at 17:46 +0900, Tejun Heo wrote:
> Add missing #ifdef CONFIG_PM conditionals around all PM related parts
> in libata LLDs.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
>  drivers/ata/ahci.c              |   14 ++++++++++++++
>  drivers/ata/ata_generic.c       |    4 ++++
>  drivers/ata/ata_piix.c          |    4 ++++
>  drivers/ata/pata_ali.c          |    6 ++++++
>  drivers/ata/pata_amd.c          |    6 ++++++
>  drivers/ata/pata_atiixp.c       |    4 ++++
>  drivers/ata/pata_cmd64x.c       |    6 ++++++
>  drivers/ata/pata_cs5520.c       |    7 +++++++
>  drivers/ata/pata_cs5530.c       |    6 ++++++
>  drivers/ata/pata_cs5535.c       |    4 ++++
>  drivers/ata/pata_cypress.c      |    4 ++++
>  drivers/ata/pata_efar.c         |    4 ++++
>  drivers/ata/pata_hpt366.c       |    7 ++++++-
>  drivers/ata/pata_hpt3x3.c       |    6 ++++++
>  drivers/ata/pata_it821x.c       |    6 ++++++
>  drivers/ata/pata_jmicron.c      |    4 ++++
>  drivers/ata/pata_marvell.c      |    4 ++++
>  drivers/ata/pata_mpiix.c        |    4 ++++
>  drivers/ata/pata_netcell.c      |    4 ++++
>  drivers/ata/pata_ns87410.c      |    4 ++++
>  drivers/ata/pata_oldpiix.c      |    4 ++++
>  drivers/ata/pata_opti.c         |    4 ++++
>  drivers/ata/pata_optidma.c      |    4 ++++
>  drivers/ata/pata_pdc202xx_old.c |    4 ++++
>  drivers/ata/pata_radisys.c      |    4 ++++
>  drivers/ata/pata_rz1000.c       |    6 ++++++
>  drivers/ata/pata_sc1200.c       |    4 ++++
>  drivers/ata/pata_serverworks.c  |    6 ++++++
>  drivers/ata/pata_sil680.c       |    4 ++++
>  drivers/ata/pata_sis.c          |    4 ++++
>  drivers/ata/pata_triflex.c      |    4 ++++
>  drivers/ata/pata_via.c          |    6 ++++++
>  drivers/ata/sata_sil.c          |    2 ++
>  drivers/ata/sata_sil24.c        |    2 ++
>  34 files changed, 165 insertions(+), 1 deletion(-)
> 
> Index: work1/drivers/ata/ahci.c
> ===================================================================
> --- work1.orig/drivers/ata/ahci.c
> +++ work1/drivers/ata/ahci.c
> @@ -225,10 +225,12 @@ static void ahci_thaw(struct ata_port *a
>  static void ahci_error_handler(struct ata_port *ap);
>  static void ahci_vt8251_error_handler(struct ata_port *ap);
>  static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
> +#ifdef CONFIG_PM
>  static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
>  static int ahci_port_resume(struct ata_port *ap);
>  static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
>  static int ahci_pci_device_resume(struct pci_dev *pdev);

Wouldn't it be simpler to add

#else
#define ahci_port_suspend(port, message) (NULL)

etc (or something similar)?

Regards,

Nigel

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

* Re: [linux-pm] [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs
@ 2007-03-03  0:18             ` Nigel Cunningham
  0 siblings, 0 replies; 13+ messages in thread
From: Nigel Cunningham @ 2007-03-03  0:18 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Guennadi Liakhovetski, linux-ide, jgarzik, linux-pm, stable,
	Alan, linux-kernel

Hi.

On Fri, 2007-03-02 at 17:46 +0900, Tejun Heo wrote:
> Add missing #ifdef CONFIG_PM conditionals around all PM related parts
> in libata LLDs.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
>  drivers/ata/ahci.c              |   14 ++++++++++++++
>  drivers/ata/ata_generic.c       |    4 ++++
>  drivers/ata/ata_piix.c          |    4 ++++
>  drivers/ata/pata_ali.c          |    6 ++++++
>  drivers/ata/pata_amd.c          |    6 ++++++
>  drivers/ata/pata_atiixp.c       |    4 ++++
>  drivers/ata/pata_cmd64x.c       |    6 ++++++
>  drivers/ata/pata_cs5520.c       |    7 +++++++
>  drivers/ata/pata_cs5530.c       |    6 ++++++
>  drivers/ata/pata_cs5535.c       |    4 ++++
>  drivers/ata/pata_cypress.c      |    4 ++++
>  drivers/ata/pata_efar.c         |    4 ++++
>  drivers/ata/pata_hpt366.c       |    7 ++++++-
>  drivers/ata/pata_hpt3x3.c       |    6 ++++++
>  drivers/ata/pata_it821x.c       |    6 ++++++
>  drivers/ata/pata_jmicron.c      |    4 ++++
>  drivers/ata/pata_marvell.c      |    4 ++++
>  drivers/ata/pata_mpiix.c        |    4 ++++
>  drivers/ata/pata_netcell.c      |    4 ++++
>  drivers/ata/pata_ns87410.c      |    4 ++++
>  drivers/ata/pata_oldpiix.c      |    4 ++++
>  drivers/ata/pata_opti.c         |    4 ++++
>  drivers/ata/pata_optidma.c      |    4 ++++
>  drivers/ata/pata_pdc202xx_old.c |    4 ++++
>  drivers/ata/pata_radisys.c      |    4 ++++
>  drivers/ata/pata_rz1000.c       |    6 ++++++
>  drivers/ata/pata_sc1200.c       |    4 ++++
>  drivers/ata/pata_serverworks.c  |    6 ++++++
>  drivers/ata/pata_sil680.c       |    4 ++++
>  drivers/ata/pata_sis.c          |    4 ++++
>  drivers/ata/pata_triflex.c      |    4 ++++
>  drivers/ata/pata_via.c          |    6 ++++++
>  drivers/ata/sata_sil.c          |    2 ++
>  drivers/ata/sata_sil24.c        |    2 ++
>  34 files changed, 165 insertions(+), 1 deletion(-)
> 
> Index: work1/drivers/ata/ahci.c
> ===================================================================
> --- work1.orig/drivers/ata/ahci.c
> +++ work1/drivers/ata/ahci.c
> @@ -225,10 +225,12 @@ static void ahci_thaw(struct ata_port *a
>  static void ahci_error_handler(struct ata_port *ap);
>  static void ahci_vt8251_error_handler(struct ata_port *ap);
>  static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
> +#ifdef CONFIG_PM
>  static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
>  static int ahci_port_resume(struct ata_port *ap);
>  static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
>  static int ahci_pci_device_resume(struct pci_dev *pdev);

Wouldn't it be simpler to add

#else
#define ahci_port_suspend(port, message) (NULL)

etc (or something similar)?

Regards,

Nigel




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

* Re: [linux-pm] [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs
  2007-03-03  0:18             ` [linux-pm] " Nigel Cunningham
  (?)
@ 2007-03-03  3:20             ` Tejun Heo
  2007-03-03  5:34               ` Nigel Cunningham
  -1 siblings, 1 reply; 13+ messages in thread
From: Tejun Heo @ 2007-03-03  3:20 UTC (permalink / raw)
  To: nigel
  Cc: Guennadi Liakhovetski, linux-ide, jgarzik, linux-pm, stable,
	Alan, linux-kernel

Hello, Nigel.

Nigel Cunningham wrote:
>> Index: work1/drivers/ata/ahci.c
>> ===================================================================
>> --- work1.orig/drivers/ata/ahci.c
>> +++ work1/drivers/ata/ahci.c
>> @@ -225,10 +225,12 @@ static void ahci_thaw(struct ata_port *a
>>  static void ahci_error_handler(struct ata_port *ap);
>>  static void ahci_vt8251_error_handler(struct ata_port *ap);
>>  static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
>> +#ifdef CONFIG_PM
>>  static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
>>  static int ahci_port_resume(struct ata_port *ap);
>>  static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
>>  static int ahci_pci_device_resume(struct pci_dev *pdev);
> 
> Wouldn't it be simpler to add
> 
> #else
> #define ahci_port_suspend(port, message) (NULL)
> 
> etc (or something similar)?

ahci_port_suspend() is used to fill ata_port_ops vector, so it needs to
be a function.  If you're talking about defining NULL function, yeah,
that will remove half of CONFIG_PMs but would require dummy definitions
for all functions.  I think both are ugly.  :-)

I'm working on a linker trick.  Please take a look at the following thread.

  http://thread.gmane.org/gmane.linux.ide/16475

-- 
tejun

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

* Re: [linux-pm] [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs
  2007-03-03  3:20             ` Tejun Heo
@ 2007-03-03  5:34               ` Nigel Cunningham
  0 siblings, 0 replies; 13+ messages in thread
From: Nigel Cunningham @ 2007-03-03  5:34 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Guennadi Liakhovetski, linux-ide, jgarzik, linux-pm, stable,
	Alan, linux-kernel

Hi.

On Sat, 2007-03-03 at 12:20 +0900, Tejun Heo wrote:
> Hello, Nigel.
> 
> Nigel Cunningham wrote:
> >> Index: work1/drivers/ata/ahci.c
> >> ===================================================================
> >> --- work1.orig/drivers/ata/ahci.c
> >> +++ work1/drivers/ata/ahci.c
> >> @@ -225,10 +225,12 @@ static void ahci_thaw(struct ata_port *a
> >>  static void ahci_error_handler(struct ata_port *ap);
> >>  static void ahci_vt8251_error_handler(struct ata_port *ap);
> >>  static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
> >> +#ifdef CONFIG_PM
> >>  static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
> >>  static int ahci_port_resume(struct ata_port *ap);
> >>  static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
> >>  static int ahci_pci_device_resume(struct pci_dev *pdev);
> > 
> > Wouldn't it be simpler to add
> > 
> > #else
> > #define ahci_port_suspend(port, message) (NULL)
> > 
> > etc (or something similar)?
> 
> ahci_port_suspend() is used to fill ata_port_ops vector, so it needs to
> be a function.  If you're talking about defining NULL function, yeah,
> that will remove half of CONFIG_PMs but would require dummy definitions
> for all functions.  I think both are ugly.  :-)

Yeah, I didn't look really carefully; an empty static function would
have been what I'd have written if I'd paid more attention.

> I'm working on a linker trick.  Please take a look at the following thread.
> 
>   http://thread.gmane.org/gmane.linux.ide/16475

Not familiar with fancy things like that, so I'll just pipe down and
leave you to it :).

Regards,

Nigel


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

end of thread, other threads:[~2007-03-03  5:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-22 17:28 [PATCH] pata_sil680 suspend/resume Alan
2007-02-26 21:17 ` Guennadi Liakhovetski
2007-02-26 21:38   ` Guennadi Liakhovetski
2007-02-28 21:19   ` Guennadi Liakhovetski
2007-02-28 21:19     ` Guennadi Liakhovetski
2007-03-01 22:11     ` Guennadi Liakhovetski
2007-03-02  8:45       ` [PATCH 1/2 -stable] libata: add missing PM callbacks Tejun Heo
2007-03-02  8:46         ` [PATCH 2/2 -stable] libata: add missing CONFIG_PM in LLDs Tejun Heo
2007-03-03  0:18           ` Nigel Cunningham
2007-03-03  0:18             ` [linux-pm] " Nigel Cunningham
2007-03-03  3:20             ` Tejun Heo
2007-03-03  5:34               ` Nigel Cunningham
2007-03-02 22:42         ` [PATCH 1/2 -stable] libata: add missing PM callbacks Guennadi Liakhovetski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.