From: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
To: "Hennerich,
Michael"
<Michael.Hennerich-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
Cc: Mike Frysinger
<vapier.adi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"H.J. Oertel" <oe-pJ9TYRvN+WE@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org,
davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Subject: Re: [Uclinux-dist-devel] [PATCH v3] add the driver for Analog Devices Blackfin on-chip CAN controllers
Date: Thu, 10 Dec 2009 12:19:48 +0100 [thread overview]
Message-ID: <4B20D954.8040002@grandegger.com> (raw)
In-Reply-To: <8A42379416420646B9BFAC9682273B6D0EDD9A3C-pcKY8lWzTjquVPpjEGsWsTcYPEmu4y7e@public.gmane.org>
Hennerich, Michael wrote:
>
>> Wolfgang Grandegger wrote:
>>> Mike Frysinger wrote:
>>>> On Thu, Dec 10, 2009 at 04:11, Wolfgang Grandegger wrote:
>>>>> Barry Song wrote:
>>>>>> +#include <linux/module.h>
>>>>>> +#include <linux/init.h>
>>>>>> +#include <linux/kernel.h>
>>>>>> +#include <linux/types.h>
>>>>> I think you don't need "types.h" as the code no longer uses
>> "uint*_t".
>>>> linux/types.h declares all types, like u* which this driver still
>> uses
>>> I just remember that "linux/types.h" needs to be added for the
> uint*_t
>>> types. At a first glance I do not see __u8/u8 being defined in that
>>> header file but I might have missed something.
>>>
>>>>> Well, I'm still not a friend of the following inline functions,
>>>>> especially the *one-liners* which are called just *once*. With the
>> usage
>>>>> of structs they seem even more useless.
>>>> seems like it would make more sense to not even use the read/write
>>>> functions either. just declare the regs as volatile and assign/read
>>>> the struct directly.
>>> Two times no. Don't use volatile and proper accessor functions. See:
>>>
>>> http://lxr.linux.no/#linux+v2.6.32/Documentation/volatile-considered-
>> harmful.txt
>>
>> I was just wondering if bfin_read/write16 would not be the proper
>> accessor functions. readw/writew seems to be implemented differently:
>>
>> http://lxr.linux.no/#linux+v2.6.32/arch/blackfin/include/asm/io.h#L44
>>
>> Puh, they do an cli,nop,nop,sync..sti for the access. This also nicely
>> shows why accessor functions should be used to access device registers.
>>
>> Well, just curious. I don't really know the blackfin arch.
>
> Well - on Blackfin its absolutely ok to access System Memory Mapped
> Registers using structs.
> At any rate volatile is then required to prevent the compiler to
> optimize accesses away.
> IMHO this is a pretty legal use of volatile, and used in hundreds of
> places all over the kernel.
>
> When accessing external controllers accessor functions from io.h must be
> used.
> There are two things to consider here:
> 1) weak ordering of reads and writes
> 2) killed and reissued reads (especially harmful when reading from
> FIFOs)
OK, anyway, I believe that it's good practice to hide all such details
by using proper accessor functions.
Wolfgang.
next prev parent reply other threads:[~2009-12-10 11:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 7:27 [PATCH v3] add the driver for Analog Devices Blackfin on-chip CAN controllers Barry Song
[not found] ` <1260430072-21106-1-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-12-10 9:11 ` Wolfgang Grandegger
2009-12-10 10:04 ` [Uclinux-dist-devel] " Mike Frysinger
2009-12-10 10:05 ` Barry Song
2009-12-10 10:12 ` Mike Frysinger
[not found] ` <8bd0f97a0912100204gd2b09f6r2799d9f951d6b9e1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-10 10:20 ` Wolfgang Grandegger
2009-12-10 10:45 ` Mike Frysinger
[not found] ` <8bd0f97a0912100245k9930c90ke4b184da68a9f958-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-10 10:55 ` Wolfgang Grandegger
2009-12-10 11:04 ` Mike Frysinger
2009-12-10 11:16 ` Wolfgang Grandegger
2009-12-10 21:38 ` David Miller
2009-12-10 10:48 ` Wolfgang Grandegger
2009-12-10 10:58 ` Mike Frysinger
2009-12-10 21:37 ` David Miller
2009-12-11 2:05 ` Barry Song
2009-12-11 2:17 ` Mike Frysinger
[not found] ` <8bd0f97a0912101817x79a17d5dje21e2a2b4ad1fc58-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-11 4:00 ` Barry Song
[not found] ` <3c17e3570912102000vd30d452s2d6b6ae7d24f340f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-11 8:51 ` Wolfgang Grandegger
[not found] ` <20091210.133729.42872813.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2009-12-17 1:20 ` Mike Frysinger
2009-12-10 11:06 ` [Uclinux-dist-devel] " Hennerich, Michael
[not found] ` <8A42379416420646B9BFAC9682273B6D0EDD9A3C-pcKY8lWzTjquVPpjEGsWsTcYPEmu4y7e@public.gmane.org>
2009-12-10 11:19 ` Wolfgang Grandegger [this message]
[not found] ` <4B20BB36.50509-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-12-10 10:14 ` Barry Song
[not found] ` <3c17e3570912100214k4b3eb038u1108c82bfa346389-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-10 10:21 ` Wolfram Sang
[not found] ` <20091210102145.GA3097-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-12-10 10:25 ` Barry Song
2009-12-10 10:35 ` Wolfgang Grandegger
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=4B20D954.8040002@grandegger.com \
--to=wg-5yr1bzd7o62+xt7jha+gda@public.gmane.org \
--cc=Michael.Hennerich-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=oe-pJ9TYRvN+WE@public.gmane.org \
--cc=socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
--cc=uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org \
--cc=vapier.adi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).