Re: [PATCH v3 1/1] Introduce Intel RAPL cooling device driver

From: Jacob Pan
Date: Tue Apr 09 2013 - 13:04:13 EST


On Tue, 09 Apr 2013 09:26:55 -0700
Joe Perches <joe@xxxxxxxxxxx> wrote:

> On Tue, 2013-04-09 at 09:15 -0700, Jacob Pan wrote:
> > On Tue, 9 Apr 2013 08:26:38 -0700
> > Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > > > + if (NULL == rp->name || rp->flag &
> > > > RAPL_PRIMITIVE_DUMMY)
> > >
> > > In Linux we do (rp->name == NULL), or even better yet (!rp->name),
> > > please fix that up here and elsewhere in the driver.
> > >
> > I can fix that. I did that because checkpatch does not complain
> > about it. also it avoids common mistake as:
> > rp->name = NULL
> >
> > > > +
> > > > +#define PRIMITIVE_INFO_INIT(p, m, s, i, u, f) {#p, m, s, i, u,
> > > > p, f}
> > >
> > > C has named initializers, use them please.
> > >
> > this macro can save lots of repeated text.
>
> Use the macro. Use named initializers in the macro.
>
> #define PRIMITIVE_INFO_INIT(p, m, s, i, u, f) \
> { \
> .name = #p, \
> .mask = m, \
> .shift = s, \
> .id = i, \
> .unit = u, \
> /* \
> (hmm looks like a bug ?) \
> enum rapl_primitives pm_id; \
> */ \
not a bug but you are right i can remove pm_id.

--
Thanks,

Jacob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/