lkml.org 
[lkml]   [2009]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Add to_delayed_work macro
On Tue, 03 Mar 2009 16:32:48 +0100, Stefan Richter wrote:
> Jean Delvare wrote:
> > On Tue, 3 Mar 2009 00:29:52 -0800, Andrew Morton wrote:
> >> On Tue, 3 Mar 2009 08:34:40 +0100 Jean Delvare <khali@linux-fr.org> wrote:
> >>
> >> > +#define to_delayed_work(_work) container_of(_work, struct delayed_work, work)
> >>
> >> As this is specifically designed to operate on a `struct work*', as
> >> opposed to "any struct which has a field called `work'", we can get
> >> additional type-safety by putting a C interface around it.
> >
> > This is what I wanted to do in the first place, but then I noticed that
> > _all_ such wrappers around container_of are implemented as macros
> > rather than inline functions.
>
> /Almost/ all.
>
> http://lxr.linux.no/linux+v2.6.28/drivers/firewire/fw-device.h#L73

Ah, I missed that one because it's not named to_<something>, sorry.

> > So I decided to follow the crowd. Any idea why it is so?
>
> Merely old habits.


--
Jean Delvare


\
 
 \ /
  Last update: 2009-03-03 16:49    [W:1.045 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site