[U-Boot] [PATCH 1/3] net: Adds Fast Ethernet Controller driver for Armada100

jason.hobbs at calxeda.com jason.hobbs at calxeda.com
Mon Aug 22 20:19:04 CEST 2011


On Monday, August 22, 2011 12:11pm, "Mike Frysinger" <vapier at gentoo.org> said:

> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> On Monday, August 22, 2011 12:45:06 Marek Vasut wrote:
>> On Monday, August 22, 2011 06:42:33 PM Mike Frysinger wrote:
>> > On Monday, August 22, 2011 12:07:26 Marek Vasut wrote:
>> > > On Monday, August 22, 2011 06:02:26 PM Mike Frysinger wrote:
>> > > > On Monday, August 22, 2011 01:11:57 Ajay Bhargav wrote:
>> > > > > +	darmdfec = malloc(sizeof(struct armdfec_device));
>> > > >
>> > > > sizeof(*darmdfec)
>> > >
>> > > Why are you against sizeof(struct ...) ?
>> >
>> > imo, it holds up against bit rot easier and the code is clearer
>>
>> OTOH, you don't have to look up what type of ptr it is if you use struct
>> ...
> 
> i dont see how that's generally relevant.  if you want to know what the type
> of a variable is, you look for its definition.  i dont go looking for alloc
> related funcs on the off chance that someone explicitly wrote out the type.

There was a big thread on this on lkml long ago.

http://kerneltrap.org/node/5688

I prefer the inference of sizeof(*p) and think sizeof(struct blah) is a
violation of DRY, but it's not a huge issue to me and I can go either way.

I've been called out by Wolfgang for using sizeof(*p) in some code but not in
other code. It would be nice if there were some consistent recommendation for
new code here, documented in the U-boot coding style wiki.

Jason



More information about the U-Boot mailing list