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]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux