From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 In-Reply-To: <20170818025835.GE19152@localhost> References: <1501578742-4501-1-git-send-email-s.abhisit@gmail.com> <20170811143847.GA19152@localhost> <20170818025835.GE19152@localhost> From: Abhisit Sangjan Date: Fri, 18 Aug 2017 10:15:29 +0700 Message-ID: Subject: Re: [PATCH 2/5] iio: Add support for LMP92001 ADC To: jmondi Cc: Peter Meerwald-Stadler , jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, fabrice.gasnier@st.com, Lee Jones , robh@kernel.org, Akinobu Mita , marek.vasut+renesas@gmail.com, jacopo+renesas@jmondi.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Content-Type: multipart/alternative; boundary="f403045ec4328cc73c0556fe8ae2" List-ID: --f403045ec4328cc73c0556fe8ae2 Content-Type: text/plain; charset="UTF-8" Hi Jmondi, On Fri, Aug 18, 2017 at 9:58 AM, jmondi wrote: > 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 > Abhisit: Thank you so much. --f403045ec4328cc73c0556fe8ae2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Jmondi,

On Fri, Aug 18, 2017 at 9:58 AM, jmondi <= ;jacopo@jmondi.org> wrote:
H= i 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 n= ew
> patch in soon.

[snip]

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

This can potentially be reduced to

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

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -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

Abhisit: Thank you so much.
=C2=A0

--f403045ec4328cc73c0556fe8ae2--