Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1714527

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

From jmondi <jacopo@jmondi.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/5] iio: Add support for LMP92001 ADC
Date 2017-08-18 05:00 +0200
Message-ID <ufFFU-5xy-3@gated-at.bofh.it> (permalink)
References <u9Bvk-1zO-27@gated-at.bofh.it> <ualRw-7bw-3@gated-at.bofh.it> <udjgt-4Hm-7@gated-at.bofh.it> <ufFFU-5xy-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/5] iio: Add support for LMP92001 ADC jmondi <jacopo@jmondi.org> - 2017-08-18 05:00 +0200
  Re: [PATCH 2/5] iio: Add support for LMP92001 ADC Jonathan Cameron <jic23@kernel.org> - 2017-08-20 12:40 +0200
    Re: [PATCH 2/5] iio: Add support for LMP92001 ADC jmondi <jacopo@jmondi.org> - 2017-08-21 19:40 +0200

csiph-web