All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cristina Opriceana <cristina.opriceana@gmail.com>
To: Daniel Baluta <daniel.baluta@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH 1/3] Staging: iio: Place driver in sleep mode on error
Date: Fri, 20 Mar 2015 11:31:07 +0200	[thread overview]
Message-ID: <1426843867.28252.4.camel@Inspiron> (raw)
In-Reply-To: <CAEnQRZCifnqNiVN3GYg3o28WbLE_DETq20GdMpFfhup-tmYv-A@mail.gmail.com>

On Vi, 2015-03-20 at 11:13 +0200, Daniel Baluta wrote:
> On Thu, Mar 19, 2015 at 9:19 PM, Cristina Opriceana
> <cristina.opriceana@gmail.com> wrote:
> > Added sleep_mode label, on which the device enters sleep mode if
> > encounters an error after initialization. This helps saving energy
> > consumption.
> 
> Commit message shouldn't tell "how" it does something, this should
> be obvious from the code. We should insist more on "why" we need
> this change.
> 
> So, the fact that you added "sleep_mode" label shouldn't be present
> in commit message.
> 
> Better say:
> 
> Put device in sleep mode if we encounter an error after initialization
> to avoid wasting power.
> 
> >
> > Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
> > ---
> >  drivers/staging/iio/magnetometer/hmc5843_core.c | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c
> > index 90cc18b..59afede 100644
> > --- a/drivers/staging/iio/magnetometer/hmc5843_core.c
> > +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
> > @@ -606,16 +606,17 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
> >         ret = iio_triggered_buffer_setup(indio_dev, NULL,
> >                 hmc5843_trigger_handler, NULL);
> >         if (ret < 0)
> > -               return ret;
> > +               goto sleep_mode;
> >
> >         ret = iio_device_register(indio_dev);
> > -       if (ret < 0)
> > -               goto buffer_cleanup;
> > -
> > +       if (ret < 0) {
> > +               iio_triggered_buffer_cleanup(indio_dev);
> > +               goto sleep_mode;
> > +       }
> 
> Why this change here? The initial goto buffer_cleanup will work just fine.

I wanted to avoid duplicating code, but yes, apart from that, the
initial goto would work just fine.

> 
> >         return 0;
> >
> > -buffer_cleanup:
> > -       iio_triggered_buffer_cleanup(indio_dev);
> > +sleep_mode:
> > +       hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP);
> >         return ret;
> >  }
> >  EXPORT_SYMBOL(hmc5843_common_probe);
> > --
> 
> Nice patch. A good idea would be to also add module authors/reviewers for this.
> 
> Thanks,
> Daniel.




  reply	other threads:[~2015-03-20  9:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 19:17 [PATCH 0/3] Add small improvements to iio/magnetometer hmc5843 driver Cristina Opriceana
2015-03-19 19:19 ` [PATCH 1/3] Staging: iio: Place driver in sleep mode on error Cristina Opriceana
2015-03-20  9:13   ` [Outreachy kernel] " Daniel Baluta
2015-03-20  9:31     ` Cristina Opriceana [this message]
2015-03-20 12:39   ` Greg KH
2015-03-20 15:34     ` Cristina Opriceana
2015-03-19 19:20 ` [PATCH 2/3] Staging: iio: Replace hardcoded value with number of channels Cristina Opriceana
2015-03-19 19:22 ` [PATCH 3/3] Staging: iio: Fix file header to match standards Cristina Opriceana
2015-03-20  8:58 ` [Outreachy kernel] [PATCH 0/3] Add small improvements to iio/magnetometer hmc5843 driver Daniel Baluta

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=1426843867.28252.4.camel@Inspiron \
    --to=cristina.opriceana@gmail.com \
    --cc=daniel.baluta@gmail.com \
    --cc=outreachy-kernel@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.