linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jmondi <jacopo@jmondi.org>
To: Abhisit Sangjan <s.abhisit@gmail.com>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
	fabrice.gasnier@st.com, Lee Jones <lee.jones@linaro.org>,
	robh@kernel.org, Akinobu Mita <akinobu.mita@gmail.com>,
	marek.vasut+renesas@gmail.com, jacopo+renesas@jmondi.org,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/5] iio: Add support for LMP92001 ADC
Date: Fri, 18 Aug 2017 09:58:35 +0700	[thread overview]
Message-ID: <20170818025835.GE19152@localhost> (raw)
In-Reply-To: <CAMV_pUa0XvzNYcR0ryHSt=qsdLKCtOLfQNz3LsWxaj9VGmFxLw@mail.gmail.com>

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


  reply	other threads:[~2017-08-18  2:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  9:12 [PATCH 2/5] iio: Add support for LMP92001 ADC s.abhisit
2017-08-01 10:10 ` Jonathan Cameron
     [not found]   ` <CAMV_pUaV54qUc1wOhL5cAP8mEX1k0VsL3aEGG+wziqPPnZGHWg@mail.gmail.com>
2017-08-02  7:06     ` Abhisit Sangjan
2017-08-09 14:22       ` Jonathan Cameron
2017-08-03 10:40 ` Peter Meerwald-Stadler
2017-08-05  4:49   ` Abhisit Sangjan
2017-08-11 14:38   ` jmondi
2017-08-18  2:34     ` Abhisit Sangjan
2017-08-18  2:58       ` jmondi [this message]
2017-08-18  3:15         ` Abhisit Sangjan
2017-08-18  7:42           ` Abhisit Sangjan
2017-08-20 10:31             ` Jonathan Cameron
2017-08-21 17:29               ` jmondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170818025835.GE19152@localhost \
    --to=jacopo@jmondi.org \
    --cc=akinobu.mita@gmail.com \
    --cc=fabrice.gasnier@st.com \
    --cc=jacopo+renesas@jmondi.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.org \
    --cc=s.abhisit@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).