All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: Place drivers on standby on error
@ 2015-03-29 12:19 Cristina Opriceana
  2015-03-29 12:22 ` [PATCH 1/2] iio: magnetometer: mag3110.c: Place driver " Cristina Opriceana
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-29 12:19 UTC (permalink / raw)
  To: outreachy-kernel

This patchset places drivers on standby when an error occurs.

I know these don't belong to the staging area, but I need a
review before sending them.

Cristina Opriceana (2):
  iio: magnetometer: mag3110: Place driver on standby on error
  iio: light: ltr501: Powerdown device on error

 drivers/iio/light/ltr501.c         | 19 ++++++++++---------
 drivers/iio/magnetometer/mag3110.c | 18 ++++++++++--------
 2 files changed, 20 insertions(+), 17 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] iio: magnetometer: mag3110.c: Place driver on standby on error
  2015-03-29 12:19 [PATCH 0/2] iio: Place drivers on standby on error Cristina Opriceana
@ 2015-03-29 12:22 ` Cristina Opriceana
  2015-03-29 12:24 ` [PATCH 2/2] iio: light: ltr501: Powerdown device " Cristina Opriceana
  2015-03-29 13:04 ` [Outreachy kernel] [PATCH 0/2] iio: Place drivers on standby " Daniel Baluta
  2 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-29 12:22 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

Place driver on standby mode on error in order to prevent wasting
power. Move standby function above to be seen by the new call.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/iio/magnetometer/mag3110.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index e3106b4..261d517 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -321,6 +321,12 @@ static const struct iio_info mag3110_info = {
 
 static const unsigned long mag3110_scan_masks[] = {0x7, 0xf, 0};
 
+static int mag3110_standby(struct mag3110_data *data)
+{
+	return i2c_smbus_write_byte_data(data->client, MAG3110_CTRL_REG1,
+		data->ctrl_reg1 & ~MAG3110_CTRL_AC);
+}
+
 static int mag3110_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
@@ -360,12 +366,12 @@ static int mag3110_probe(struct i2c_client *client,
 	ret = i2c_smbus_write_byte_data(client, MAG3110_CTRL_REG2,
 		MAG3110_CTRL_AUTO_MRST_EN);
 	if (ret < 0)
-		return ret;
+		goto standby_on_error;
 
 	ret = iio_triggered_buffer_setup(indio_dev, NULL,
 		mag3110_trigger_handler, NULL);
 	if (ret < 0)
-		return ret;
+		goto standby_on_error;
 
 	ret = iio_device_register(indio_dev);
 	if (ret < 0)
@@ -374,15 +380,11 @@ static int mag3110_probe(struct i2c_client *client,
 
 buffer_cleanup:
 	iio_triggered_buffer_cleanup(indio_dev);
+standby_on_error:
+	mag3110_standby(iio_priv(indio_dev));
 	return ret;
 }
 
-static int mag3110_standby(struct mag3110_data *data)
-{
-	return i2c_smbus_write_byte_data(data->client, MAG3110_CTRL_REG1,
-		data->ctrl_reg1 & ~MAG3110_CTRL_AC);
-}
-
 static int mag3110_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] iio: light: ltr501: Powerdown device on error
  2015-03-29 12:19 [PATCH 0/2] iio: Place drivers on standby on error Cristina Opriceana
  2015-03-29 12:22 ` [PATCH 1/2] iio: magnetometer: mag3110.c: Place driver " Cristina Opriceana
@ 2015-03-29 12:24 ` Cristina Opriceana
  2015-03-29 13:04 ` [Outreachy kernel] [PATCH 0/2] iio: Place drivers on standby " Daniel Baluta
  2 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-29 12:24 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

Power down device when an error occurs  in order to avoid wasting
power. Also move powerdown function up to be seen by the new call.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/iio/light/ltr501.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 62b7072..34f41e3 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -333,6 +333,13 @@ static int ltr501_init(struct ltr501_data *data)
 		data->ps_contr);
 }
 
+static int ltr501_powerdown(struct ltr501_data *data)
+{
+	return ltr501_write_contr(data->client,
+		data->als_contr & ~LTR501_CONTR_ACTIVE,
+		data->ps_contr & ~LTR501_CONTR_ACTIVE);
+}
+
 static int ltr501_probe(struct i2c_client *client,
 			  const struct i2c_device_id *id)
 {
@@ -355,7 +362,6 @@ static int ltr501_probe(struct i2c_client *client,
 		return ret;
 	if ((ret >> 4) != 0x8)
 		return -ENODEV;
-
 	indio_dev->dev.parent = &client->dev;
 	indio_dev->info = &ltr501_info;
 	indio_dev->channels = ltr501_channels;
@@ -370,7 +376,7 @@ static int ltr501_probe(struct i2c_client *client,
 	ret = iio_triggered_buffer_setup(indio_dev, NULL,
 		ltr501_trigger_handler, NULL);
 	if (ret)
-		return ret;
+		goto powerdown_on_error;
 
 	ret = iio_device_register(indio_dev);
 	if (ret)
@@ -380,16 +386,11 @@ static int ltr501_probe(struct i2c_client *client,
 
 error_unreg_buffer:
 	iio_triggered_buffer_cleanup(indio_dev);
+powerdown_on_error:
+	ltr501_powerdown(data);
 	return ret;
 }
 
-static int ltr501_powerdown(struct ltr501_data *data)
-{
-	return ltr501_write_contr(data->client,
-		data->als_contr & ~LTR501_CONTR_ACTIVE,
-		data->ps_contr & ~LTR501_CONTR_ACTIVE);
-}
-
 static int ltr501_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Outreachy kernel] [PATCH 0/2] iio: Place drivers on standby on error
  2015-03-29 12:19 [PATCH 0/2] iio: Place drivers on standby on error Cristina Opriceana
  2015-03-29 12:22 ` [PATCH 1/2] iio: magnetometer: mag3110.c: Place driver " Cristina Opriceana
  2015-03-29 12:24 ` [PATCH 2/2] iio: light: ltr501: Powerdown device " Cristina Opriceana
@ 2015-03-29 13:04 ` Daniel Baluta
  2 siblings, 0 replies; 8+ messages in thread
From: Daniel Baluta @ 2015-03-29 13:04 UTC (permalink / raw)
  To: Cristina Opriceana; +Cc: outreachy-kernel

On Sun, Mar 29, 2015 at 3:19 PM, Cristina Opriceana
<cristina.opriceana@gmail.com> wrote:
> This patchset places drivers on standby when an error occurs.
>
> I know these don't belong to the staging area, but I need a
> review before sending them.
>
> Cristina Opriceana (2):
>   iio: magnetometer: mag3110: Place driver on standby on error
>   iio: light: ltr501: Powerdown device on error
>
>  drivers/iio/light/ltr501.c         | 19 ++++++++++---------
>  drivers/iio/magnetometer/mag3110.c | 18 ++++++++++--------
>  2 files changed, 20 insertions(+), 17 deletions(-)

This are outside staging please send them to linux-iio list.

Daniel.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] iio: light: ltr501: Powerdown device on error
  2015-04-01 11:46   ` Daniel Baluta
  2015-04-01 11:50     ` Cristina Opriceana
@ 2015-04-01 11:57     ` Cristina Opriceana
  1 sibling, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-04-01 11:57 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: Jonathan Cameron, outreachy-kernel, linux-iio

On Mi, 2015-04-01 at 14:46 +0300, Daniel Baluta wrote:
> On Wed, Apr 1, 2015 at 2:01 PM, Cristina Opriceana
> <cristina.opriceana@gmail.com> wrote:
> > Power down device when an error occurs  in order to avoid wasting
> > power. Also move powerdown function up to be seen by the new call.
> >
> > Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
> > ---
> >  drivers/iio/light/ltr501.c | 18 ++++++++++--------
> >  1 file changed, 10 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> > index 62b7072..29ca4b8 100644
> > --- a/drivers/iio/light/ltr501.c
> > +++ b/drivers/iio/light/ltr501.c
> > @@ -333,6 +333,13 @@ static int ltr501_init(struct ltr501_data *data)
> >                 data->ps_contr);
> >  }
> >
> > +static int ltr501_powerdown(struct ltr501_data *data)
> > +{
> > +       return ltr501_write_contr(data->client,
> > +               data->als_contr & ~LTR501_CONTR_ACTIVE,
> > +               data->ps_contr & ~LTR501_CONTR_ACTIVE);
> > +}
> > +

> Don't forget
> to mention this in the commit message. When running checkpatch.pl
> please use --strict parameter.

Okay, I'll make a v2. Ignore my previous question.

Thanks,
Cristina

> thanks,
> Daniel.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] iio: light: ltr501: Powerdown device on error
  2015-04-01 11:46   ` Daniel Baluta
@ 2015-04-01 11:50     ` Cristina Opriceana
  2015-04-01 11:57     ` Cristina Opriceana
  1 sibling, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-04-01 11:50 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: Jonathan Cameron, outreachy-kernel, linux-iio

On Mi, 2015-04-01 at 14:46 +0300, Daniel Baluta wrote:
> On Wed, Apr 1, 2015 at 2:01 PM, Cristina Opriceana
> <cristina.opriceana@gmail.com> wrote:
> > Power down device when an error occurs  in order to avoid wasting
> > power. Also move powerdown function up to be seen by the new call.
> >
> > Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
> > ---
> >  drivers/iio/light/ltr501.c | 18 ++++++++++--------
> >  1 file changed, 10 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> > index 62b7072..29ca4b8 100644
> > --- a/drivers/iio/light/ltr501.c
> > +++ b/drivers/iio/light/ltr501.c
> > @@ -333,6 +333,13 @@ static int ltr501_init(struct ltr501_data *data)
> >                 data->ps_contr);
> >  }
> >
> > +static int ltr501_powerdown(struct ltr501_data *data)
> > +{
> > +       return ltr501_write_contr(data->client,
> > +               data->als_contr & ~LTR501_CONTR_ACTIVE,
> > +               data->ps_contr & ~LTR501_CONTR_ACTIVE);
> > +}
> > +
> 
> While at it please also fix the alignment for ltr501_write_contr
> parameters. Don't forget
> to mention this in the commit message. When running checkpatch.pl
> please use --strict parameter.
> 
> thanks,
> Daniel.

Another patch would be fine or should I send a v2?

Cristina




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] iio: light: ltr501: Powerdown device on error
  2015-04-01 11:01 ` [PATCH 2/2] iio: light: ltr501: Powerdown device " Cristina Opriceana
@ 2015-04-01 11:46   ` Daniel Baluta
  2015-04-01 11:50     ` Cristina Opriceana
  2015-04-01 11:57     ` Cristina Opriceana
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Baluta @ 2015-04-01 11:46 UTC (permalink / raw)
  To: Cristina Opriceana, Jonathan Cameron; +Cc: outreachy-kernel, linux-iio

On Wed, Apr 1, 2015 at 2:01 PM, Cristina Opriceana
<cristina.opriceana@gmail.com> wrote:
> Power down device when an error occurs  in order to avoid wasting
> power. Also move powerdown function up to be seen by the new call.
>
> Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
> ---
>  drivers/iio/light/ltr501.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index 62b7072..29ca4b8 100644
> --- a/drivers/iio/light/ltr501.c
> +++ b/drivers/iio/light/ltr501.c
> @@ -333,6 +333,13 @@ static int ltr501_init(struct ltr501_data *data)
>                 data->ps_contr);
>  }
>
> +static int ltr501_powerdown(struct ltr501_data *data)
> +{
> +       return ltr501_write_contr(data->client,
> +               data->als_contr & ~LTR501_CONTR_ACTIVE,
> +               data->ps_contr & ~LTR501_CONTR_ACTIVE);
> +}
> +

While at it please also fix the alignment for ltr501_write_contr
parameters. Don't forget
to mention this in the commit message. When running checkpatch.pl
please use --strict parameter.

thanks,
Daniel.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] iio: light: ltr501: Powerdown device on error
  2015-04-01 11:00 Cristina Opriceana
@ 2015-04-01 11:01 ` Cristina Opriceana
  2015-04-01 11:46   ` Daniel Baluta
  0 siblings, 1 reply; 8+ messages in thread
From: Cristina Opriceana @ 2015-04-01 11:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: linux-iio, outreachy-kernel, daniel.baluta

Power down device when an error occurs  in order to avoid wasting
power. Also move powerdown function up to be seen by the new call.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/iio/light/ltr501.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 62b7072..29ca4b8 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -333,6 +333,13 @@ static int ltr501_init(struct ltr501_data *data)
 		data->ps_contr);
 }
 
+static int ltr501_powerdown(struct ltr501_data *data)
+{
+	return ltr501_write_contr(data->client,
+		data->als_contr & ~LTR501_CONTR_ACTIVE,
+		data->ps_contr & ~LTR501_CONTR_ACTIVE);
+}
+
 static int ltr501_probe(struct i2c_client *client,
 			  const struct i2c_device_id *id)
 {
@@ -370,7 +377,7 @@ static int ltr501_probe(struct i2c_client *client,
 	ret = iio_triggered_buffer_setup(indio_dev, NULL,
 		ltr501_trigger_handler, NULL);
 	if (ret)
-		return ret;
+		goto powerdown_on_error;
 
 	ret = iio_device_register(indio_dev);
 	if (ret)
@@ -380,16 +387,11 @@ static int ltr501_probe(struct i2c_client *client,
 
 error_unreg_buffer:
 	iio_triggered_buffer_cleanup(indio_dev);
+powerdown_on_error:
+	ltr501_powerdown(data);
 	return ret;
 }
 
-static int ltr501_powerdown(struct ltr501_data *data)
-{
-	return ltr501_write_contr(data->client,
-		data->als_contr & ~LTR501_CONTR_ACTIVE,
-		data->ps_contr & ~LTR501_CONTR_ACTIVE);
-}
-
 static int ltr501_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-01 11:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-29 12:19 [PATCH 0/2] iio: Place drivers on standby on error Cristina Opriceana
2015-03-29 12:22 ` [PATCH 1/2] iio: magnetometer: mag3110.c: Place driver " Cristina Opriceana
2015-03-29 12:24 ` [PATCH 2/2] iio: light: ltr501: Powerdown device " Cristina Opriceana
2015-03-29 13:04 ` [Outreachy kernel] [PATCH 0/2] iio: Place drivers on standby " Daniel Baluta
2015-04-01 11:00 Cristina Opriceana
2015-04-01 11:01 ` [PATCH 2/2] iio: light: ltr501: Powerdown device " Cristina Opriceana
2015-04-01 11:46   ` Daniel Baluta
2015-04-01 11:50     ` Cristina Opriceana
2015-04-01 11:57     ` Cristina Opriceana

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.