Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1520592
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 03/26] staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume |
| Date | 2016-11-13 13:00 +0100 |
| Message-ID | <sD1C2-89M-23@gated-at.bofh.it> (permalink) |
| References | <sCLdT-5L4-5@gated-at.bofh.it> <sCLdU-5L4-63@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 12/11/16 18:19, Brian Masney wrote:
> The device probing and the suspend/resume code checks a flag internal to
> the driver that determines whether or not the chip is in a working
> state. These checks are not needed. This patch removes the unnecessary
> checks. It will do no harm to the hardware if the chip is
> reinitialized if it is already powered on.
>
> Signed-off-by: Brian Masney <masneyb@onstation.org>
Applied.
> ---
> drivers/staging/iio/light/tsl2583.c | 16 +++-------------
> 1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index a550023..40aa78e 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -412,13 +412,6 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
> struct tsl2583_chip *chip = iio_priv(indio_dev);
> int ret;
>
> - /* and make sure we're not already on */
> - if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
> - /* if forcing a register update - turn off, then on */
> - dev_info(&chip->client->dev, "device is already enabled\n");
> - return -EINVAL;
> - }
> -
> /* Power on the device; ADC off. */
> ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_ON);
> if (ret < 0)
> @@ -841,10 +834,8 @@ static int __maybe_unused taos_suspend(struct device *dev)
>
> mutex_lock(&chip->als_mutex);
>
> - if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
> - ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
> - chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
> - }
> + ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
> + chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
>
> mutex_unlock(&chip->als_mutex);
> return ret;
> @@ -858,8 +849,7 @@ static int __maybe_unused taos_resume(struct device *dev)
>
> mutex_lock(&chip->als_mutex);
>
> - if (chip->taos_chip_status == TSL258X_CHIP_SUSPENDED)
> - ret = tsl2583_chip_init_and_power_on(indio_dev);
> + ret = tsl2583_chip_init_and_power_on(indio_dev);
>
> mutex_unlock(&chip->als_mutex);
> return ret;
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 00/26] staging: iio: tsl2583: move out of staging Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
[PATCH v4 14/26] staging: iio: tsl2583: updated code comment to match what the code does Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
[PATCH v4 24/26] staging: iio: tsl2583: remove unnecessary variable initialization Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
[PATCH v4 08/26] staging: iio: tsl2583: unify function and variable prefix to tsl2583_ Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
[PATCH v4 22/26] staging: iio: tsl2583: remove comment for tsl2583_probe() Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
Re: [PATCH v4 22/26] staging: iio: tsl2583: remove comment for tsl2583_probe() Jonathan Cameron <jic23@kernel.org> - 2016-11-13 13:30 +0100
[PATCH v4 21/26] staging: iio: tsl2583: clarified comment about clearing interrupts Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
[PATCH v4 10/26] staging: iio: tsl2583: fix comparison between signed and unsigned integers Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
[PATCH v4 01/26] staging: iio: tsl2583: check if chip is in a working state in in_illuminance_calibrate_store Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
Re: [PATCH v4 01/26] staging: iio: tsl2583: check if chip is in a working state in in_illuminance_calibrate_store Jonathan Cameron <jic23@kernel.org> - 2016-11-13 13:00 +0100
[PATCH v4 03/26] staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume Brian Masney <masneyb@onstation.org> - 2016-11-12 19:30 +0100
Re: [PATCH v4 03/26] staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume Jonathan Cameron <jic23@kernel.org> - 2016-11-13 13:00 +0100
Re: [PATCH v4 26/26] staging: iio: tsl2583: move out of staging Brian Masney <masneyb@onstation.org> - 2016-11-13 17:20 +0100
csiph-web