lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B20D881.3090003@grandegger.com>
Date:	Thu, 10 Dec 2009 12:16:17 +0100
From:	Wolfgang Grandegger <wg@...ndegger.com>
To:	Mike Frysinger <vapier.adi@...il.com>
CC:	Barry Song <21cnbao@...il.com>, socketcan-core@...ts.berlios.de,
	uclinux-dist-devel@...ckfin.uclinux.org, davem@...emloft.net,
	"H.J. Oertel" <oe@...t.de>, netdev@...r.kernel.org
Subject: Re: [Uclinux-dist-devel] [PATCH v3] add the driver for Analog Devices
 	Blackfin on-chip CAN controllers

Mike Frysinger wrote:
> On Thu, Dec 10, 2009 at 05:55, Wolfgang Grandegger wrote:
>> Mike Frysinger wrote:
>>> On Thu, Dec 10, 2009 at 05:20, 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.
>>> you need to follow the include paths
>> I thought I did. Could you point me to the relevant location?
> 
> make kernel/printk.i
> sed -n -e '/^#/p' -e '/ u64;/{p;q}' kernel/printk.i
> linux/types.h -> asm/types.h -> asm-generic/types.h -> asm-generic/int-ll64.h

Thanks.

>>>>>> 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
>>> too bad the document is largely irrelevant (all but one paragraph)
>>> because this is how volatiles were designed in the first place --
>>> hardware I/O registers.  the CAN implementation here is Blackfin
>>> specific and not going to be use elsewhere, so other architectures are
>>> irrelevant.  the resulting C code would certainly look a hell of a lot
>>> more natural without the useless I/O accessor functions, and be much
>>> tighter.
>> Well, so far *no* volatiles have been used in the BFIN CAN driver. But
>> if you tell me that they are really required for blackfin... I can't
>> really judge.
> 
> i'm not saying they're needed all the time, i'm saying volatile
> produces more natural coding style than I/O accessors.  but after
> reviewing the bfin_read/bfin_write functions, we still need to use
> those to workaround a simple anomaly on older parts.

I believe that it's good practice to hide such details by using proper
accessor functions.

Wolfgang.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ