diff mbox

[05/13] staging: iio: tsl2x7x: remove unnecessary chip status checks in suspend/resume

Message ID 20180421004153.19073-6-masneyb@onstation.org (mailing list archive)
State New, archived
Headers show

Commit Message

Brian Masney April 21, 2018, 12:41 a.m. UTC
tsl2x7x_suspend() and tsl2x7x_resume() both check to see what the
current chip status is. These checks are not necessary so this patch
removes those checks.

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 drivers/staging/iio/light/tsl2x7x.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

Comments

Jonathan Cameron April 21, 2018, 4:23 p.m. UTC | #1
On Fri, 20 Apr 2018 20:41:45 -0400
Brian Masney <masneyb@onstation.org> wrote:

> tsl2x7x_suspend() and tsl2x7x_resume() both check to see what the
> current chip status is. These checks are not necessary so this patch
> removes those checks.
> 
> Signed-off-by: Brian Masney <masneyb@onstation.org>
This description could have been clearer... The key point is we
can always know what state we are in when we hit these functions anyway
(I think).

Anyhow applied as is to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/staging/iio/light/tsl2x7x.c | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c
> index f37fc74b8fbc..8d8af0cf9768 100644
> --- a/drivers/staging/iio/light/tsl2x7x.c
> +++ b/drivers/staging/iio/light/tsl2x7x.c
> @@ -1682,27 +1682,15 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
>  static int tsl2x7x_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> -	struct tsl2X7X_chip *chip = iio_priv(indio_dev);
> -	int ret = 0;
> -
> -	if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) {
> -		ret = tsl2x7x_chip_off(indio_dev);
> -		chip->tsl2x7x_chip_status = TSL2X7X_CHIP_SUSPENDED;
> -	}
>  
> -	return ret;
> +	return tsl2x7x_chip_off(indio_dev);
>  }
>  
>  static int tsl2x7x_resume(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> -	struct tsl2X7X_chip *chip = iio_priv(indio_dev);
> -	int ret = 0;
>  
> -	if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_SUSPENDED)
> -		ret = tsl2x7x_chip_on(indio_dev);
> -
> -	return ret;
> +	return tsl2x7x_chip_on(indio_dev);
>  }
>  
>  static int tsl2x7x_remove(struct i2c_client *client)

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c
index f37fc74b8fbc..8d8af0cf9768 100644
--- a/drivers/staging/iio/light/tsl2x7x.c
+++ b/drivers/staging/iio/light/tsl2x7x.c
@@ -1682,27 +1682,15 @@  static int tsl2x7x_probe(struct i2c_client *clientp,
 static int tsl2x7x_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
-	struct tsl2X7X_chip *chip = iio_priv(indio_dev);
-	int ret = 0;
-
-	if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) {
-		ret = tsl2x7x_chip_off(indio_dev);
-		chip->tsl2x7x_chip_status = TSL2X7X_CHIP_SUSPENDED;
-	}
 
-	return ret;
+	return tsl2x7x_chip_off(indio_dev);
 }
 
 static int tsl2x7x_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
-	struct tsl2X7X_chip *chip = iio_priv(indio_dev);
-	int ret = 0;
 
-	if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_SUSPENDED)
-		ret = tsl2x7x_chip_on(indio_dev);
-
-	return ret;
+	return tsl2x7x_chip_on(indio_dev);
 }
 
 static int tsl2x7x_remove(struct i2c_client *client)