Re: [PATCH 11/15] libata: reimplement controller-wide PM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2006-06-24 at 20:30 +0900, Tejun Heo wrote:
>  
>  /**
> + *	ata_host_set_suspend - suspend host_set
> + *	@host_set: host_set to suspend
> + *	@mesg: PM message
> + *
> + *	Suspend @host_set.  Actual operation is performed by EH.  This
> + *	function requests EH to perform PM operations and waits for EH
> + *	to finish.
> + *
> + *	LOCKING:
> + *	Kernel thread context (may sleep).
> + *
> + *	RETURNS:
> + *	0 on success, -errno on failure.
> + */
> +int ata_host_set_suspend(struct ata_host_set *host_set, pm_message_t mesg)
> +{
> +	unsigned long flags;
> +	int i, j;
> +
> +	for (i = 0; i < host_set->n_ports; i++) {
> +		struct ata_port *ap = host_set->ports[i];
> +
> +		/* set SUSPENDED and make sure EH sees it */
> +		spin_lock_irqsave(&ap->host_set->lock, flags);
> +		ap->flags |= ATA_FLAG_SUSPENDED;
> +		spin_unlock_irqrestore(&ap->host_set->lock, flags);
> +
> +		ata_port_wait_eh(ap);
> +
> +		/* EH is quiescent now.  Fail if we have any ready
> +		 * device.  This happens if hotplug occurs between
> +		 * completion of device suspension and here.
> +		 */
> +		for (j = 0; j < ATA_MAX_DEVICES; j++) {
> +			struct ata_device *dev = &ap->device[j];
> +
> +			if (ata_dev_ready(dev)) {
> +				ata_port_printk(ap, KERN_INFO,
> +						"suspend failed, device %d "
> +						"still active\n", dev->devno);
> +				goto fail;
> +			}
> +		}
> +
> +		/* freeze, won't be thawed until resume */
> +		spin_lock_irqsave(&ap->host_set->lock, flags);
> +		ata_port_freeze(ap);
> +		spin_unlock_irqrestore(&ap->host_set->lock, flags);
> +	}
> +
> +	host_set->dev->power.power_state = mesg;
> +	return 0;
> +
> + fail:
> +	ata_host_set_resume(host_set);
> +	return -EBUSY;
> +}
> +

ata_port_schedule_eh(ap); need to be invoked in order to schedule EH,
right? But ata_port_schedule_eh(ap) is not called in
ata_host_set_suspend().

Thanks,
Forrest
-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux