* [PATCH 0/2] iio: Place drivers on standby on error @ 2015-04-01 11:00 Cristina Opriceana 2015-04-01 11:01 ` [PATCH 1/2] iio: magnetometer: mag3110: Place driver " Cristina Opriceana 2015-04-01 11:01 ` [PATCH 2/2] iio: light: ltr501: Powerdown device " Cristina Opriceana 0 siblings, 2 replies; 6+ messages in thread From: Cristina Opriceana @ 2015-04-01 11:00 UTC (permalink / raw) To: outreachy-kernel; +Cc: linux-iio, outreachy-kernel, daniel.baluta This patchset places drivers on standby when an error occurs to avoid wasting power. Cristina Opriceana (2): iio: magnetometer: mag3110: Place driver on standby on error iio: light: ltr501: Powerdown device on error drivers/iio/light/ltr501.c | 18 ++++++++++-------- drivers/iio/magnetometer/mag3110.c | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] iio: magnetometer: mag3110: Place driver on standby on error 2015-04-01 11:00 [PATCH 0/2] iio: Place drivers on standby on error Cristina Opriceana @ 2015-04-01 11:01 ` Cristina Opriceana 2015-04-01 11:01 ` [PATCH 2/2] iio: light: ltr501: Powerdown device " Cristina Opriceana 1 sibling, 0 replies; 6+ messages in thread From: Cristina Opriceana @ 2015-04-01 11:01 UTC (permalink / raw) To: outreachy-kernel; +Cc: linux-iio, outreachy-kernel, daniel.baluta 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] 6+ messages in thread
* [PATCH 2/2] iio: light: ltr501: Powerdown device on error 2015-04-01 11:00 [PATCH 0/2] iio: Place drivers on standby on error Cristina Opriceana 2015-04-01 11:01 ` [PATCH 1/2] iio: magnetometer: mag3110: Place driver " Cristina Opriceana @ 2015-04-01 11:01 ` Cristina Opriceana 2015-04-01 11:46 ` Daniel Baluta 1 sibling, 1 reply; 6+ 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] 6+ 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; 6+ messages in thread From: Daniel Baluta @ 2015-04-01 11:46 UTC (permalink / raw) To: Cristina Opriceana, Jonathan Cameron Cc: outreachy-kernel, linux-iio@vger.kernel.org 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] 6+ 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; 6+ messages in thread From: Cristina Opriceana @ 2015-04-01 11:50 UTC (permalink / raw) To: Daniel Baluta Cc: Jonathan Cameron, outreachy-kernel, linux-iio@vger.kernel.org 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] 6+ 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; 6+ messages in thread From: Cristina Opriceana @ 2015-04-01 11:57 UTC (permalink / raw) To: Daniel Baluta Cc: Jonathan Cameron, outreachy-kernel, linux-iio@vger.kernel.org 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] 6+ messages in thread
end of thread, other threads:[~2015-04-01 11:57 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-01 11:00 [PATCH 0/2] iio: Place drivers on standby on error Cristina Opriceana 2015-04-01 11:01 ` [PATCH 1/2] iio: magnetometer: mag3110: Place driver " 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 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).