Re: [PATCH 2/5] net: rfkill: add rfkill_find_type function

From: Andy Shevchenko
Date: Thu Aug 06 2015 - 05:27:31 EST


On Thu, 2015-08-06 at 11:30 +0300, Heikki Krogerus wrote:
> > >
> On Wed, Aug 05, 2015 at 05:07:29PM +0300, Andy Shevchenko wrote:
> > On Wed, 2015-08-05 at 16:39 +0300, Heikki Krogerus wrote:


> > > +static inline enum rfkill_type rfkill_find_type(const char
> > > *name)
> > > +{
> > > + return 0;
> >
> > Hmmâ Besides 0 is implicitly casted to enum type the issue with
> > enums
> > that you rather have to supply existing enum entry. I would suggest
> > to
> > add RFKILL_TYPE_UNKNOWN if _ALL is reserved for some use cases.
>
> Why would you add a new type just for this? You do realize it would
> require adding specific handling all over the place? RFKILL_TYPE_ALL
> (0) is already handled as an invalid type.

It was my thought as well (see *if* in my previous comment).

> Confused?

A bit, yes.

>
> I'll change this and return RFKILL_TYPE_ALL instead of 0.

Excellent!

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy
--
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/