lkml.org 
[lkml]   [2017]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2017-08-18 04:59    [W:0.084 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site