[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20170818025835.GE19152@localhost>
Date: Fri, 18 Aug 2017 09:58:35 +0700
From: jmondi <jacopo@...ndi.org>
To: Abhisit Sangjan <s.abhisit@...il.com>
Cc: Peter Meerwald-Stadler <pmeerw@...erw.net>, jic23@...nel.org,
knaack.h@....de, lars@...afoo.de, fabrice.gasnier@...com,
Lee Jones <lee.jones@...aro.org>, robh@...nel.org,
Akinobu Mita <akinobu.mita@...il.com>,
marek.vasut+renesas@...il.com, jacopo+renesas@...ndi.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org
Subject: Re: [PATCH 2/5] iio: Add support for LMP92001 ADC
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
Powered by blists - more mailing lists