Re: [PATCH v11 5/9] libata: check zero power ready status for ZPODD

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

 



Hello, Aaron.

On Sun, Jan 06, 2013 at 10:48:25AM +0800, Aaron Lu wrote:
> +/* Check zero power ready status */
> +void zpodd_on_suspend(struct ata_device *dev)
> +{
> +	struct zpodd *zpodd = dev->zpodd;
> +	unsigned long expires;
> +
> +	if (!zpready(dev)) {
> +		zpodd->zp_ready = false;
> +		zpodd->last_ready = 0;
> +		return;
> +	}
> +
> +	if (!zpodd->last_ready) {
> +		zpodd->last_ready = jiffies;
> +		return;
> +	}
> +
> +	expires = zpodd->last_ready +
> +		  msecs_to_jiffies(zpodd_poweroff_delay * 1000);
> +	if (time_before(jiffies, expires))
> +		return;
> +
> +	zpodd->zp_ready = true;
> +}

Using 0 jiffies as special value is generally considered a bad form.
It should be mostly ok here but it's not like avoiding that is
difficult, so let's please not use 0 jiffies as special value.  If you
have to, add another variable zp_sample_cnt or whatever.

Thanks.

-- 
tejun
--
To unsubscribe from this list: 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