Re: [PATCH/RFC] libata-dev: make the returned err_mask more accurate

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

 



Hello, Albert.

On Thu, Apr 06, 2006 at 03:02:36PM +0800, Albert Lee wrote:
[-- snip --]
> --- irq-pio0/include/linux/libata.h	2006-04-06 10:08:48.000000000 +0800
> +++ irq-pio1/include/linux/libata.h	2006-04-06 13:44:25.000000000 +0800
> @@ -942,6 +942,46 @@ static inline int ata_try_flush_cache(co
>  	       ata_id_has_flush_ext(dev->id);
>  }
>  
> +static inline unsigned int ac_err_drq(u8 status)
> +{
> +	/* BSY = 1*/
> +	if (status & ATA_BUSY)
> +		return AC_ERR_HSM;
> +
> +	/* BSY = 0, DRQ = 1 */
> +	if (status & ATA_DRQ)
> +		return 0;
> +
> +	/* BSY = 0, DRQ = 0, device err */
> +	if (status & (ATA_ERR | ATA_DF))
> +		return AC_ERR_DEV;
> +
> +	/* BSY = 0, DRQ = 0, no device err
> +	 * when we are expecting data transfer.
> +	 */
> +	return AC_ERR_HSM;
> +}
> +
> +static inline unsigned int ac_err_idle(u8 status)
> +{
> +	/* BSY = 1 or DRQ = 1 */
> +	if (status & (ATA_BUSY | ATA_DRQ))
> +		return AC_ERR_HSM;
> +
> +	/* BSY = 0, DRQ = 0, device err */
> +	if (status & (ATA_ERR | ATA_DF))
> +		return AC_ERR_DEV;
> +
> +	/* BSY = 0, DRQ = 0, no device err. DRDY = 1 */
> +	if (status & ATA_DRDY)
> +		return 0;
> +
> +	/* thing looks good.
> +	 * don't know why DRDY not set.
> +	 */
> +	return AC_ERR_OTHER
> +}
> +

I don't think putting these two functions into libata.h as inlines is
a good idea.  As currently there are no users, it would be better to
put them where they are used as static functions and export it later
as necessary.

-- 
tejun
-
: 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