linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Brian Masney <masneyb@onstation.org>, linux-iio@vger.kernel.org
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	lars@metafoo.de, pmeerw@pmeerw.net, knaack.h@gmx.de,
	linux-kernel@vger.kernel.org, Jon.Brenner@ams.com
Subject: Re: [PATCH v4 04/26] staging: iio: tsl2583: change current chip state from a tristate to a bool
Date: Sun, 13 Nov 2016 11:58:22 +0000	[thread overview]
Message-ID: <3b27fd4a-91c3-d85f-e1df-419849dfb289@kernel.org> (raw)
In-Reply-To: <1478974781-1457-5-git-send-email-masneyb@onstation.org>

On 12/11/16 18:19, Brian Masney wrote:
> The current chip state is represented as a tristate (working, suspended,
> and unknown). The unknown state was not used. This patch changes the
> chip state so that it is now represented as a single boolean value
> (suspended).
> 
> Signed-off-by: Brian Masney <masneyb@onstation.org>
Applied.

> ---
>  drivers/staging/iio/light/tsl2583.c | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index 40aa78e..5a32102 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -67,12 +67,6 @@
>  #define TSL2583_CHIP_ID			0x90
>  #define TSL2583_CHIP_ID_MASK		0xf0
>  
> -enum {
> -	TSL258X_CHIP_UNKNOWN = 0,
> -	TSL258X_CHIP_WORKING = 1,
> -	TSL258X_CHIP_SUSPENDED = 2
> -};
> -
>  /* Per-device data */
>  struct taos_als_info {
>  	u16 als_ch0;
> @@ -94,7 +88,7 @@ struct tsl2583_chip {
>  	struct taos_settings taos_settings;
>  	int als_time_scale;
>  	int als_saturation;
> -	int taos_chip_status;
> +	bool suspended;
>  };
>  
>  struct taos_lux {
> @@ -441,7 +435,7 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
>  	if (ret < 0)
>  		return ret;
>  
> -	chip->taos_chip_status = TSL258X_CHIP_WORKING;
> +	chip->suspended = false;
>  
>  	return ret;
>  }
> @@ -494,7 +488,7 @@ static ssize_t in_illuminance_calibrate_store(struct device *dev,
>  
>  	mutex_lock(&chip->als_mutex);
>  
> -	if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
> +	if (chip->suspended) {
>  		ret = -EBUSY;
>  		goto done;
>  	}
> @@ -627,7 +621,7 @@ static int tsl2583_read_raw(struct iio_dev *indio_dev,
>  
>  	mutex_lock(&chip->als_mutex);
>  
> -	if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
> +	if (chip->suspended) {
>  		ret = -EBUSY;
>  		goto read_done;
>  	}
> @@ -704,7 +698,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
>  
>  	mutex_lock(&chip->als_mutex);
>  
> -	if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
> +	if (chip->suspended) {
>  		ret = -EBUSY;
>  		goto write_done;
>  	}
> @@ -778,7 +772,7 @@ static int taos_probe(struct i2c_client *clientp,
>  	i2c_set_clientdata(clientp, indio_dev);
>  
>  	mutex_init(&chip->als_mutex);
> -	chip->taos_chip_status = TSL258X_CHIP_UNKNOWN;
> +	chip->suspended = true;
>  
>  	ret = i2c_smbus_read_byte_data(clientp,
>  				       TSL258X_CMD_REG | TSL258X_CHIPID);
> @@ -835,7 +829,7 @@ static int __maybe_unused taos_suspend(struct device *dev)
>  	mutex_lock(&chip->als_mutex);
>  
>  	ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
> -	chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
> +	chip->suspended = true;
>  
>  	mutex_unlock(&chip->als_mutex);
>  	return ret;
> 

  reply	other threads:[~2016-11-13 11:58 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12 18:19 [PATCH v4 00/26] staging: iio: tsl2583: move out of staging Brian Masney
2016-11-12 18:19 ` [PATCH v4 01/26] staging: iio: tsl2583: check if chip is in a working state in in_illuminance_calibrate_store Brian Masney
2016-11-13 11:54   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 02/26] staging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux Brian Masney
2016-11-13 11:55   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 03/26] staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume Brian Masney
2016-11-13 11:56   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 04/26] staging: iio: tsl2583: change current chip state from a tristate to a bool Brian Masney
2016-11-13 11:58   ` Jonathan Cameron [this message]
2016-11-12 18:19 ` [PATCH v4 05/26] staging: iio: tsl2583: remove redundant write to the control register in taos_probe() Brian Masney
2016-11-13 12:06   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 06/26] staging: iio: tsl2583: remove the FSF's mailing address Brian Masney
2016-11-13 12:07   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 07/26] staging: iio: tsl2583: cleaned up logging Brian Masney
2016-11-13 12:07   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 08/26] staging: iio: tsl2583: unify function and variable prefix to tsl2583_ Brian Masney
2016-11-13 12:09   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 09/26] staging: iio: tsl2583: fix alignment of #define values Brian Masney
2016-11-13 12:13   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 10/26] staging: iio: tsl2583: fix comparison between signed and unsigned integers Brian Masney
2016-11-13 12:14   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 11/26] staging: iio: tsl2583: change newlines to improve readability Brian Masney
2016-11-13 12:15   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 12/26] staging: iio: tsl2583: combine sysfs documentation Brian Masney
2016-11-13 12:16   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 13/26] staging: iio: tsl2583: fix multiline comment syntax Brian Masney
2016-11-13 12:17   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 14/26] staging: iio: tsl2583: updated code comment to match what the code does Brian Masney
2016-11-13 12:18   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 15/26] staging: iio: tsl2583: moved code block inside else statement Brian Masney
2016-11-13 12:20   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 16/26] staging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on success Brian Masney
2016-11-13 12:21   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 17/26] staging: iio: tsl2583: remove unnecessary parentheses Brian Masney
2016-11-13 12:22   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 18/26] staging: iio: tsl2583: don't assume an unsigned int is 32 bits Brian Masney
2016-11-13 12:23   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 19/26] staging: iio: tsl2583: move from a global to a per device lux table Brian Masney
2016-11-13 12:25   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 20/26] staging: iio: tsl2583: add tsl2583 to list of supported devices in the header Brian Masney
2016-11-13 12:28   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 21/26] staging: iio: tsl2583: clarified comment about clearing interrupts Brian Masney
2016-11-13 12:28   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 22/26] staging: iio: tsl2583: remove comment for tsl2583_probe() Brian Masney
2016-11-13 12:29   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 23/26] staging: iio: tsl2583: remove unnecessary memset call Brian Masney
2016-11-13 12:29   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 24/26] staging: iio: tsl2583: remove unnecessary variable initialization Brian Masney
2016-11-13 12:30   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 25/26] staging: iio: tsl2583: add copyright and MODULE_AUTHOR Brian Masney
2016-11-13 12:35   ` Jonathan Cameron
2016-11-12 18:19 ` [PATCH v4 26/26] staging: iio: tsl2583: move out of staging Brian Masney
2016-11-13 12:57   ` Jonathan Cameron
2016-11-13 16:18     ` Brian Masney

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=3b27fd4a-91c3-d85f-e1df-419849dfb289@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jon.Brenner@ams.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masneyb@onstation.org \
    --cc=pmeerw@pmeerw.net \
    /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 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).