Re: [PATCH v2 1/1] device property: Add fwnode_graph_get_endpoint_by_id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rafael,

On Wed, Mar 27, 2019 at 10:42:23AM +0100, Rafael J. Wysocki wrote:
...
> > > + */
> > > +enum fwnode_graph_get_endpoint_flags {
> > > +       FWNODE_GRAPH_ENDPOINT_NEXT      = 0x00000001,
> >
> > BIT(1) ?
> >
> > > +       FWNODE_GRAPH_DEVICE_DISABLED    = 0x00000002,
> >
> > BIT(2) ?
> >
> > > +};
> 
> Actually, enum types are not particularly suitable for flags in my
> view, because something like
> 
> FWNODE_GRAPH_ENDPOINT_NEXT | FWNODE_GRAPH_DEVICE_DISABLED
> 
> is not really defined within the enum type, for example.
> 
> It's better to #define the flags IMO and use unsigned int as the type.

Enums can have better kerneldoc documentation; that's been the reasoning to
make flags fields enums in e.g. V4L2 kAPI. In C it's still valid use of
enums even if the value isn't any value listen in an enum as such.

Anyway, I'll switch to #define and make the comment just a regular comment
if you prefer that.

-- 
Sakari Ailus
sakari.ailus@xxxxxxxxxxxxxxx



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux