All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/7] sata_mv: endian fix
  2006-05-19 20:13   ` [PATCH 0/7] sata_mv: assorted fixes Mark Lord
@ 2006-05-19 20:40     ` Mark Lord
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Lord @ 2006-05-19 20:40 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, tie-fei.zang

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);
 }
 
 /**

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 6/7] sata_mv: endian fix
@ 2006-05-22  3:51 Zang Roy-r61911
  2006-05-22  6:25 ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Zang Roy-r61911 @ 2006-05-22  3:51 UTC (permalink / raw)
  To: Mark Lord, Jeff Garzik; +Cc: linux-ide

> 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?

Roy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 6/7] sata_mv: endian fix
  2006-05-22  3:51 Zang Roy-r61911
@ 2006-05-22  6:25 ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2006-05-22  6:25 UTC (permalink / raw)
  To: Zang Roy-r61911; +Cc: Mark Lord, linux-ide

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 6/7] sata_mv: endian fix
@ 2006-05-22  6:28 Zang Roy-r61911
  2006-05-22  6:36 ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Zang Roy-r61911 @ 2006-05-22  6:28 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Mark Lord, linux-ide

> 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?
Roy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 6/7] sata_mv: endian fix
  2006-05-22  6:28 [PATCH 6/7] sata_mv: endian fix Zang Roy-r61911
@ 2006-05-22  6:36 ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2006-05-22  6:36 UTC (permalink / raw)
  To: Zang Roy-r61911; +Cc: Mark Lord, linux-ide

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 6/7] sata_mv: endian fix
@ 2006-05-22  6:44 Zang Roy-r61911
  0 siblings, 0 replies; 6+ messages in thread
From: Zang Roy-r61911 @ 2006-05-22  6:44 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Mark Lord, linux-ide

 
> 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
> 
> 
> 
I see it !
Roy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-05-22  6:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-22  6:28 [PATCH 6/7] sata_mv: endian fix Zang Roy-r61911
2006-05-22  6:36 ` Jeff Garzik
  -- 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

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.