All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Zang Roy-r61911 <tie-fei.zang@freescale.com>
Cc: Mark Lord <liml@rtr.ca>, linux-ide@vger.kernel.org
Subject: Re: [PATCH 6/7] sata_mv: endian fix
Date: Mon, 22 May 2006 02:36:38 -0400	[thread overview]
Message-ID: <44715BF6.1040506@pobox.com> (raw)
In-Reply-To: <9FCDBA58F226D911B202000BDBAD467306382E46@zch01exm40.ap.freescale.net>

Zang Roy-r61911 wrote:
>> Zang Roy-r61911 wrote:
>>>> This fixes a byte-swap issue on PPC, found by Zang Roy-r61911
>>>> on the powerpc platform.  His original patch also had some other
>>>> platform-specific changes in #ifdef's, but I'm not sure yet how to
>>>> incorporate them.  Look for another patch for those (soon).
>>>>
>>>> Signed-off-by: Mark Lord <liml@rtr.ca>
>>>>
>>>> ---
>>>> --- linux/drivers/scsi/sata_mv.c	2006-05-19 
>>>> 15:44:11.000000000 -0400
>>>> +++ linux/drivers/scsi/sata_mv.c	2006-05-19 
>>>> 15:58:21.000000000 -0400
>>>> @@ -1030,8 +1030,9 @@
>>>>  
>>>>  static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 
>>>> addr, unsigned last)
>>>>  {
>>>> -	*cmdw = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |
>>>> +	u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |
>>>>  		(last ? CRQB_CMD_LAST : 0);
>>>> +	*cmdw = cpu_to_le16(tmp);
>>>>  }
>>>>  
>>>>  /**
>>>>
>>>
>>> Does this patch will affect other platform except powerpc?
>> This patch affects all platforms (as it should).  Most Linux code is 
>> intentionally written in a cross-platform, portable manner 
>> without ifdefs.
>>
>> 	Jeff
>>
>>
>>
> I can see it work on powerpc platform, while does it work for other 
> platform such as i386?

Yes.  Look at the definition of the function in question:  for little 
endian platforms, it is a simple assignment.  For big endian platforms, 
it does the expected byte swap.

This is also the standard for Linux code:  one function Does The Right 
Thing, regardless of platform.

	Jeff




  reply	other threads:[~2006-05-22  6:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-22  6:28 [PATCH 6/7] sata_mv: endian fix Zang Roy-r61911
2006-05-22  6:36 ` Jeff Garzik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-05-22  6:44 Zang Roy-r61911
2006-05-22  3:51 Zang Roy-r61911
2006-05-22  6:25 ` Jeff Garzik
2006-05-19 15:48 [PATCH 13/13] libata-hp: move ata_do_reset() to libata-eh.c Tejun Heo
2006-05-19 16:13 ` Jeff Garzik
2006-05-19 20:13   ` [PATCH 0/7] sata_mv: assorted fixes Mark Lord
2006-05-19 20:40     ` [PATCH 6/7] sata_mv: endian fix Mark Lord

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=44715BF6.1040506@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=liml@rtr.ca \
    --cc=linux-ide@vger.kernel.org \
    --cc=tie-fei.zang@freescale.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.