All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre COFFIGNAL <acoffignal@geral.com>
To: xenomai@xenomai.org
Subject: Re: [Xenomai] imx28 rtcan flexcan system freezes
Date: Wed, 29 Jan 2014 16:50:52 +0100	[thread overview]
Message-ID: <52E9235C.7090204@geral.com> (raw)
In-Reply-To: <e6e602522fbca3bbba4a3188f8c7f996@grandegger.com>


Le 29/01/2014 08:16, Wolfgang Grandegger a écrit :
> On Tue, 28 Jan 2014 23:06:54 +0100, Gilles Chanteperdrix
> <gilles.chanteperdrix@xenomai.org> wrote:
>> On 01/27/2014 08:56 AM, Wolfgang Grandegger wrote:
>>> On Sun, 26 Jan 2014 21:56:10 +0100, Gilles Chanteperdrix
>>>> IMO, it is not just for the flexcan driver, it will avoid unaligned
>>>> accesses for all drivers which access data 4 bytes at a time. And I do
>>>> not think it "breaks" anything. What I do not know is:
>>>
>>>
>>> But it's just the Flexcan driver which is doing unaligned accesses.
>> Ok, can we agree on the following patch then?
>>
>> diff --git a/ksrc/drivers/can/rtcan_flexcan.c
>> b/ksrc/drivers/can/rtcan_flexcan.c
>> index 8f0e8d1..1674b73 100644
>> --- a/ksrc/drivers/can/rtcan_flexcan.c
>> +++ b/ksrc/drivers/can/rtcan_flexcan.c
>> @@ -38,6 +38,7 @@
>>   #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
>>   #include <linux/pinctrl/consumer.h>
>>   #endif
>> +#include <asm/unaligned.h>
>>   
>>   #include <rtdm/rtdm_driver.h>
>>   
>> @@ -497,11 +498,9 @@ static void flexcan_rx_interrupt(struct
> rtcan_device
>> *dev,
>>   		cf->can_id |= CAN_RTR_FLAG;
>>   		skb->rb_frame_size = EMPTY_RB_FRAME_SIZE;
>>   	} else {
>> -		skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc ;
>> -		*(__be32 *)(cf->data + 0) =
>> -			cpu_to_be32(flexcan_read(&mb->data[0]));
>> -		*(__be32 *)(cf->data + 4) =
>> -			cpu_to_be32(flexcan_read(&mb->data[1]));
>> +		skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc;
>> +		put_unaligned_be32(flexcan_read(&mb->data[0]), cf->data + 0);
>> +		put_unaligned_be32(flexcan_read(&mb->data[1]), cf->data + 4);
>>   	}
>>   
>>   	/* Store the interface index */
> D'accord, thanks.
>
> Wolfgang.
>
Thank you all for your replies

Alexandre.




  reply	other threads:[~2014-01-29 15:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 10:24 [Xenomai] imx28 rtcan flexcan system freezes Alexandre COFFIGNAL
2014-01-22 11:23 ` Gilles Chanteperdrix
2014-01-22 11:36   ` Alexandre COFFIGNAL
2014-01-22 12:00     ` Gilles Chanteperdrix
2014-01-22 13:27       ` Alexandre COFFIGNAL
2014-01-22 13:30         ` Gilles Chanteperdrix
2014-01-22 14:04           ` Alexandre COFFIGNAL
2014-01-22 14:12             ` Gilles Chanteperdrix
2014-01-23 10:04               ` Gilles Chanteperdrix
2014-01-23 11:36                 ` Wolfgang Grandegger
2014-01-23 12:05                   ` Gilles Chanteperdrix
2014-01-23 12:21                     ` Wolfgang Grandegger
2014-01-23 12:23                       ` Gilles Chanteperdrix
2014-01-23 13:07                     ` Gilles Chanteperdrix
2014-01-23 12:54                   ` Alexandre COFFIGNAL
2014-01-23 13:10                     ` Alexandre COFFIGNAL
2014-01-26 19:26               ` Wolfgang Grandegger
2014-01-26 19:29                 ` Gilles Chanteperdrix
2014-01-26 20:16                   ` Wolfgang Grandegger
2014-01-26 20:56                     ` Gilles Chanteperdrix
2014-01-27  7:56                       ` Wolfgang Grandegger
2014-01-28 22:06                         ` Gilles Chanteperdrix
2014-01-29  7:16                           ` Wolfgang Grandegger
2014-01-29 15:50                             ` Alexandre COFFIGNAL [this message]
2014-01-29 17:58                               ` Gilles Chanteperdrix
2014-01-31 13:15                                 ` Alexandre COFFIGNAL
2014-01-23 19:48             ` Gilles Chanteperdrix

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=52E9235C.7090204@geral.com \
    --to=acoffignal@geral.com \
    --cc=xenomai@xenomai.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 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.