Re: [PATCH 2/5] iio: Add support for LMP92001 ADC

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

 



Hi Abhisit,

On Fri, Aug 18, 2017 at 09:34:16AM +0700, Abhisit Sangjan wrote:
> Hi Jmondi,
>
> Thank you for your recommend, I am testing the code will be send the new
> patch in soon.

[snip]

> > > > +
> > > > +        switch (mask)
> > > > +        {
> > > > +        case IIO_CHAN_INFO_RAW:
> > > > +                switch (channel->type) {
> > > > +                case IIO_VOLTAGE:
> > > > +                case IIO_TEMP:
> > > > +                        *val = code;
> > > > +                        return IIO_VAL_INT;
> > > > +                default:
> > > > +                        break;
> > > > +                }
> > > > +                break;
> > > > +        default:
> > > > +                break;
> >
> > You can remove these default cases or return -EINVAL here.
> >
>
> Abhisit: Okay, I will remove it.
>              Could you tell me in detail. Sorry, I do not understand the
> Technical.

This can potentially be reduced to

        switch (mask) {
        case IIO_CHAN_INFO_RAW:
                switch (channel->type) {
                case IIO_VOLTAGE:
                case IIO_TEMP:
                        *val = code;
                        return IIO_VAL_INT;
                }
         }

         return -EINVAL;


But that's definitely not a big deal, there are no optimization in
this code change, just less typing and less default: and break; here
and there

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux