linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: "zhao, forrest" <forrest.zhao@intel.com>
Cc: jeff@garzik.org, linux-ide@vger.kernel.org
Subject: Re: A question about right-shift in ahci_port_start()
Date: Mon, 17 Apr 2006 16:46:09 +0900	[thread overview]
Message-ID: <444347C1.7050506@gmail.com> (raw)
In-Reply-To: <1145258753.3417.5.camel@forrest26.sh.intel.com>

zhao, forrest wrote:
> Hi, Jeff
> 
> When reading ahci_port_start(), I found the
> following code segments:
> 
> .......
> if (hpriv->cap & HOST_CAP_64)
>         writel((pp->cmd_slot_dma >> 16) >> 16, port_mmio +
> PORT_LST_ADDR_HI);
>         writel(pp->cmd_slot_dma & 0xffffffff, port_mmio +
> PORT_LST_ADDR);
>         readl(port_mmio + PORT_LST_ADDR); /* flush */
> ......
> 
> I can't figure out why you use ">>16>>16" instead of
> ">>32" for right-shift 32 bits.
> 

dma_addr_t is 32bits on some architectures and C hates when you do 32 
bit shift to 32bit variable.

$ cat test.c
#include <sys/types.h>

int main(void)
{
	u_int32_t t = 1234;
	t = t >> 32;
	return 0;
}

$ gcc test.c
test.c: In function 'main':
test.c:6: warning: right shift count >= width of type

-- 
tejun

      reply	other threads:[~2006-04-17  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-17  7:25 A question about right-shift in ahci_port_start() zhao, forrest
2006-04-17  7:46 ` Tejun Heo [this message]

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=444347C1.7050506@gmail.com \
    --to=htejun@gmail.com \
    --cc=forrest.zhao@intel.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).