2006-02-22 22:11:01

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH 10/13] ATA ACPI: do taskfile before mode commands

From: Randy Dunlap <[email protected]>

Do drive/taskfile-specific commands before setting the drive mode.
This allows the taskfile to unlock the drive before trying to
set the drive mode.

Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/scsi/libata-core.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

--- linux-2616-rc4-ata.orig/drivers/scsi/libata-core.c
+++ linux-2616-rc4-ata/drivers/scsi/libata-core.c
@@ -4297,13 +4297,17 @@ static int ata_start_drive(struct ata_po
*/
int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
{
+ printk(KERN_DEBUG "ata%d: resume device\n", ap->id);
+
+ WARN_ON (irqs_disabled());
+
+ if (!ata_dev_present(dev))
+ return 0;
+ ata_acpi_exec_tfs(ap);
if (ap->flags & ATA_FLAG_SUSPENDED) {
ap->flags &= ~ATA_FLAG_SUSPENDED;
ata_set_mode(ap);
}
- if (!ata_dev_present(dev))
- return 0;
- ata_acpi_exec_tfs(ap);
if (dev->class == ATA_DEV_ATA)
ata_start_drive(ap, dev);

@@ -4319,6 +4323,7 @@ int ata_device_resume(struct ata_port *a
*/
int ata_device_suspend(struct ata_port *ap, struct ata_device *dev)
{
+ printk(KERN_DEBUG "ata%d: suspend device\n", ap->id);
if (!ata_dev_present(dev))
return 0;
if (dev->class == ATA_DEV_ATA)
@@ -5099,6 +5104,7 @@ int pci_test_config_bits(struct pci_dev

int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state)
{
+ dev_printk(KERN_DEBUG, &pdev->dev, "suspend PCI device\n");
pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot);
@@ -5107,6 +5113,7 @@ int ata_pci_device_suspend(struct pci_de

int ata_pci_device_resume(struct pci_dev *pdev)
{
+ dev_printk(KERN_DEBUG, &pdev->dev, "resume PCI device\n");
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
pci_enable_device(pdev);


2006-02-28 11:59:39

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 10/13] ATA ACPI: do taskfile before mode commands

On St 22-02-06 14:01:40, Randy Dunlap wrote:
> From: Randy Dunlap <[email protected]>
>
> Do drive/taskfile-specific commands before setting the drive mode.
> This allows the taskfile to unlock the drive before trying to
> set the drive mode.
>
> Signed-off-by: Randy Dunlap <[email protected]>
> ---
> drivers/scsi/libata-core.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> --- linux-2616-rc4-ata.orig/drivers/scsi/libata-core.c
> +++ linux-2616-rc4-ata/drivers/scsi/libata-core.c
> @@ -4297,13 +4297,17 @@ static int ata_start_drive(struct ata_po
> */
> int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
> {
> + printk(KERN_DEBUG "ata%d: resume device\n", ap->id);

Yep, one more helpful printk. Not. Actually this is four more of them
in this patch alone. Please remove your debugging code prior to merge.

Pavel

--
Web maintainer for suspend.sf.net (http://www.sf.net/projects/suspend) wanted...

2006-02-28 12:05:22

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH 10/13] ATA ACPI: do taskfile before mode commands

Pavel Machek wrote:
> On St 22-02-06 14:01:40, Randy Dunlap wrote:
>
>>From: Randy Dunlap <[email protected]>
>>
>>Do drive/taskfile-specific commands before setting the drive mode.
>>This allows the taskfile to unlock the drive before trying to
>>set the drive mode.
>>
>>Signed-off-by: Randy Dunlap <[email protected]>
>>---
>> drivers/scsi/libata-core.c | 13 ++++++++++---
>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>
>>--- linux-2616-rc4-ata.orig/drivers/scsi/libata-core.c
>>+++ linux-2616-rc4-ata/drivers/scsi/libata-core.c
>>@@ -4297,13 +4297,17 @@ static int ata_start_drive(struct ata_po
>> */
>> int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
>> {
>>+ printk(KERN_DEBUG "ata%d: resume device\n", ap->id);
>
>
> Yep, one more helpful printk. Not. Actually this is four more of them
> in this patch alone. Please remove your debugging code prior to merge.

Agreed, with the modification s/remove/limit by ata_msg_xxx/

Jeff



2006-02-28 12:09:05

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 10/13] ATA ACPI: do taskfile before mode commands

On ?t 28-02-06 07:05:17, Jeff Garzik wrote:
> Pavel Machek wrote:
> >On St 22-02-06 14:01:40, Randy Dunlap wrote:
> >
> >>From: Randy Dunlap <[email protected]>
> >>
> >>Do drive/taskfile-specific commands before setting the drive mode.
> >>This allows the taskfile to unlock the drive before trying to
> >>set the drive mode.
> >>
> >>Signed-off-by: Randy Dunlap <[email protected]>
> >>---
> >>drivers/scsi/libata-core.c | 13 ++++++++++---
> >>1 file changed, 10 insertions(+), 3 deletions(-)
> >>
> >>--- linux-2616-rc4-ata.orig/drivers/scsi/libata-core.c
> >>+++ linux-2616-rc4-ata/drivers/scsi/libata-core.c
> >>@@ -4297,13 +4297,17 @@ static int ata_start_drive(struct ata_po
> >> */
> >>int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
> >>{
> >>+ printk(KERN_DEBUG "ata%d: resume device\n", ap->id);
> >
> >
> >Yep, one more helpful printk. Not. Actually this is four more of them
> >in this patch alone. Please remove your debugging code prior to merge.
>
> Agreed, with the modification s/remove/limit by ata_msg_xxx/

Please, just remove them. Driver model core already has debugging that
can be enabled and prints what is called.

I do not think we want printk() at begining of every *_resume
function.
Pavel
--
Web maintainer for suspend.sf.net (http://www.sf.net/projects/suspend) wanted...

2006-02-28 12:14:14

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH 10/13] ATA ACPI: do taskfile before mode commands

Pavel Machek wrote:
> Please, just remove them. Driver model core already has debugging that
> can be enabled and prints what is called.
>
> I do not think we want printk() at begining of every *_resume
> function.

They will not be removed, but instead limited by a bit test as I stated.

Jeff