All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: tmp006: Check channel info on write
@ 2015-06-21 21:50 Peter Meerwald
  2015-06-21 21:50 ` [PATCH 2/2] iio: tmp006: Use GENMASK Peter Meerwald
  2015-07-05 13:24 ` [PATCH 1/2] iio: tmp006: Check channel info on write Jonathan Cameron
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Meerwald @ 2015-06-21 21:50 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, Peter Meerwald

only SAMP_FREQ is writable

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
 drivers/iio/temperature/tmp006.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index 84a0789..7a80509 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev,
 	struct tmp006_data *data = iio_priv(indio_dev);
 	int i;
 
+	if (mask != IIO_CHAN_INFO_SAMP_FREQ)
+		return -EINVAL;
+
 	for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++)
 		if ((val == tmp006_freqs[i][0]) &&
 		    (val2 == tmp006_freqs[i][1])) {
-- 
1.9.1

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

* [PATCH 2/2] iio: tmp006: Use GENMASK
  2015-06-21 21:50 [PATCH 1/2] iio: tmp006: Check channel info on write Peter Meerwald
@ 2015-06-21 21:50 ` Peter Meerwald
  2015-07-05 13:26   ` Jonathan Cameron
  2015-07-05 13:24 ` [PATCH 1/2] iio: tmp006: Check channel info on write Jonathan Cameron
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Meerwald @ 2015-06-21 21:50 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
 drivers/iio/temperature/tmp006.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index 7a80509..a107087 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -36,9 +36,9 @@
 #define TMP006_CONFIG_DRDY_EN BIT(8)
 #define TMP006_CONFIG_DRDY BIT(7)
 
-#define TMP006_CONFIG_MOD_MASK 0x7000
+#define TMP006_CONFIG_MOD_MASK GENMASK(14, 12)
 
-#define TMP006_CONFIG_CR_MASK 0x0e00
+#define TMP006_CONFIG_CR_MASK GENMASK(11, 9)
 #define TMP006_CONFIG_CR_SHIFT 9
 
 #define MANUFACTURER_MAGIC 0x5449
-- 
1.9.1

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

* Re: [PATCH 1/2] iio: tmp006: Check channel info on write
  2015-06-21 21:50 [PATCH 1/2] iio: tmp006: Check channel info on write Peter Meerwald
  2015-06-21 21:50 ` [PATCH 2/2] iio: tmp006: Use GENMASK Peter Meerwald
@ 2015-07-05 13:24 ` Jonathan Cameron
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2015-07-05 13:24 UTC (permalink / raw)
  To: Peter Meerwald, linux-iio

On 21/06/15 22:50, Peter Meerwald wrote:
> only SAMP_FREQ is writable
> 
> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Applied to the fixes-for-4.2 branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/temperature/tmp006.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
> index 84a0789..7a80509 100644
> --- a/drivers/iio/temperature/tmp006.c
> +++ b/drivers/iio/temperature/tmp006.c
> @@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev,
>  	struct tmp006_data *data = iio_priv(indio_dev);
>  	int i;
>  
> +	if (mask != IIO_CHAN_INFO_SAMP_FREQ)
> +		return -EINVAL;
> +
>  	for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++)
>  		if ((val == tmp006_freqs[i][0]) &&
>  		    (val2 == tmp006_freqs[i][1])) {
> 


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

* Re: [PATCH 2/2] iio: tmp006: Use GENMASK
  2015-06-21 21:50 ` [PATCH 2/2] iio: tmp006: Use GENMASK Peter Meerwald
@ 2015-07-05 13:26   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2015-07-05 13:26 UTC (permalink / raw)
  To: Peter Meerwald, linux-iio

On 21/06/15 22:50, Peter Meerwald wrote:
> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Applied to the togreg branch of iio.git.
Will cause some trivial fuzz when the fix before turns up.

J
> ---
>  drivers/iio/temperature/tmp006.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
> index 7a80509..a107087 100644
> --- a/drivers/iio/temperature/tmp006.c
> +++ b/drivers/iio/temperature/tmp006.c
> @@ -36,9 +36,9 @@
>  #define TMP006_CONFIG_DRDY_EN BIT(8)
>  #define TMP006_CONFIG_DRDY BIT(7)
>  
> -#define TMP006_CONFIG_MOD_MASK 0x7000
> +#define TMP006_CONFIG_MOD_MASK GENMASK(14, 12)
>  
> -#define TMP006_CONFIG_CR_MASK 0x0e00
> +#define TMP006_CONFIG_CR_MASK GENMASK(11, 9)
>  #define TMP006_CONFIG_CR_SHIFT 9
>  
>  #define MANUFACTURER_MAGIC 0x5449
> 


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

end of thread, other threads:[~2015-07-05 13:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-21 21:50 [PATCH 1/2] iio: tmp006: Check channel info on write Peter Meerwald
2015-06-21 21:50 ` [PATCH 2/2] iio: tmp006: Use GENMASK Peter Meerwald
2015-07-05 13:26   ` Jonathan Cameron
2015-07-05 13:24 ` [PATCH 1/2] iio: tmp006: Check channel info on write Jonathan Cameron

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.