linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: albertl@mail.com
Cc: Jeff Garzik <jeff@garzik.org>,
	IDE Linux <linux-ide@vger.kernel.org>,
	Doug Maxey <dwm@maxeymade.com>
Subject: Re: [PATCH/RFC] libata-dev: make the returned err_mask more accurate
Date: Thu, 6 Apr 2006 16:14:42 +0900	[thread overview]
Message-ID: <20060406071442.GF31998@htj.dyndns.org> (raw)
In-Reply-To: <4434BD0C.9080302@tw.ibm.com>

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

  reply	other threads:[~2006-04-06  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06  7:02 [PATCH/RFC] libata-dev: make the returned err_mask more accurate Albert Lee
2006-04-06  7:14 ` Tejun Heo [this message]
2006-04-06  7:34   ` Albert Lee
2006-04-06  7:43   ` [PATCH/RFC] libata-dev: make the returned err_mask more accurate (revised) Albert Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060406071442.GF31998@htj.dyndns.org \
    --to=htejun@gmail.com \
    --cc=albertl@mail.com \
    --cc=dwm@maxeymade.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).