linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace
@ 2013-07-16 15:08 Lars-Peter Clausen
  2013-07-16 15:08 ` [PATCH 2/4] staging:iio:adt7316: " Lars-Peter Clausen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Lars-Peter Clausen @ 2013-07-16 15:08 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

There is no reason why userspace should want to trigger a manual reset of the
device, so remove this functionality.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/resolver/ad2s1210.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 0d3356d..dcdadbb 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -192,21 +192,6 @@ static inline int ad2s1210_soft_reset(struct ad2s1210_state *st)
 	return ad2s1210_config_write(st, 0x0);
 }
 
-static ssize_t ad2s1210_store_softreset(struct device *dev,
-					struct device_attribute *attr,
-					const char *buf,
-					size_t len)
-{
-	struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
-	int ret;
-
-	mutex_lock(&st->lock);
-	ret = ad2s1210_soft_reset(st);
-	mutex_unlock(&st->lock);
-
-	return ret < 0 ? ret : len;
-}
-
 static ssize_t ad2s1210_show_fclkin(struct device *dev,
 				    struct device_attribute *attr,
 				    char *buf)
@@ -536,8 +521,6 @@ error_ret:
 	return ret;
 }
 
-static IIO_DEVICE_ATTR(reset, S_IWUSR,
-		       NULL, ad2s1210_store_softreset, 0);
 static IIO_DEVICE_ATTR(fclkin, S_IRUGO | S_IWUSR,
 		       ad2s1210_show_fclkin, ad2s1210_store_fclkin, 0);
 static IIO_DEVICE_ATTR(fexcit, S_IRUGO | S_IWUSR,
@@ -587,7 +570,6 @@ static const struct iio_chan_spec ad2s1210_channels[] = {
 };
 
 static struct attribute *ad2s1210_attributes[] = {
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_dev_attr_fclkin.dev_attr.attr,
 	&iio_dev_attr_fexcit.dev_attr.attr,
 	&iio_dev_attr_control.dev_attr.attr,
-- 
1.8.0


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

* [PATCH 2/4] staging:iio:adt7316: Don't expose the chip reset to userspace
  2013-07-16 15:08 [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Lars-Peter Clausen
@ 2013-07-16 15:08 ` Lars-Peter Clausen
  2013-07-16 16:57   ` Jonathan Cameron
  2013-07-16 15:08 ` [PATCH 3/4] staging:iio:ade7xxx: " Lars-Peter Clausen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Lars-Peter Clausen @ 2013-07-16 15:08 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

There is no reason why userspace should want to trigger a manual reset of the
device, so remove this functionality.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/addac/adt7316.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 506b5a7..1e13568 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -551,31 +551,6 @@ static IIO_DEVICE_ATTR(enable_smbus_timeout, S_IRUGO | S_IWUSR,
 		adt7316_store_enable_smbus_timeout,
 		0);
 
-
-static ssize_t adt7316_store_reset(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf,
-		size_t len)
-{
-	struct iio_dev *dev_info = dev_to_iio_dev(dev);
-	struct adt7316_chip_info *chip = iio_priv(dev_info);
-	u8 config2;
-	int ret;
-
-	config2 = chip->config2 | ADT7316_RESET;
-
-	ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG2, config2);
-	if (ret)
-		return -EIO;
-
-	return len;
-}
-
-static IIO_DEVICE_ATTR(reset, S_IWUSR,
-		NULL,
-		adt7316_store_reset,
-		0);
-
 static ssize_t adt7316_show_powerdown(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
@@ -1675,7 +1650,6 @@ static IIO_DEVICE_ATTR(bus_type, S_IRUGO, adt7316_show_bus_type, NULL, 0);
 static struct attribute *adt7316_attributes[] = {
 	&iio_dev_attr_all_modes.dev_attr.attr,
 	&iio_dev_attr_mode.dev_attr.attr,
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_dev_attr_enabled.dev_attr.attr,
 	&iio_dev_attr_ad_channel.dev_attr.attr,
 	&iio_dev_attr_all_ad_channels.dev_attr.attr,
@@ -1719,7 +1693,6 @@ static struct attribute *adt7516_attributes[] = {
 	&iio_dev_attr_all_modes.dev_attr.attr,
 	&iio_dev_attr_mode.dev_attr.attr,
 	&iio_dev_attr_select_ex_temp.dev_attr.attr,
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_dev_attr_enabled.dev_attr.attr,
 	&iio_dev_attr_ad_channel.dev_attr.attr,
 	&iio_dev_attr_all_ad_channels.dev_attr.attr,
-- 
1.8.0


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

* [PATCH 3/4] staging:iio:ade7xxx: Don't expose the chip reset to userspace
  2013-07-16 15:08 [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Lars-Peter Clausen
  2013-07-16 15:08 ` [PATCH 2/4] staging:iio:adt7316: " Lars-Peter Clausen
@ 2013-07-16 15:08 ` Lars-Peter Clausen
  2013-07-16 16:57   ` Jonathan Cameron
  2013-07-16 15:08 ` [PATCH 4/4] iio: Remove IIO_DEV_ATTR_RESET macro Lars-Peter Clausen
  2013-07-16 16:56 ` [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Jonathan Cameron
  3 siblings, 1 reply; 8+ messages in thread
From: Lars-Peter Clausen @ 2013-07-16 15:08 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

There is no reason why userspace should want to trigger a manual reset of the
device, so remove this functionality.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/meter/ade7753.c      | 18 ------------------
 drivers/staging/iio/meter/ade7754.c      | 19 -------------------
 drivers/staging/iio/meter/ade7758_core.c | 18 ------------------
 drivers/staging/iio/meter/ade7759.c      | 18 ------------------
 drivers/staging/iio/meter/ade7854.c      | 19 -------------------
 5 files changed, 92 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
index e5943e2..74025fb 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -225,21 +225,6 @@ static int ade7753_reset(struct device *dev)
 	return ade7753_spi_write_reg_16(dev, ADE7753_MODE, val);
 }
 
-static ssize_t ade7753_write_reset(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t len)
-{
-	if (len < 1)
-		return -1;
-	switch (buf[0]) {
-	case '1':
-	case 'y':
-	case 'Y':
-		return ade7753_reset(dev);
-	}
-	return -1;
-}
-
 static IIO_DEV_ATTR_AENERGY(ade7753_read_24bit, ADE7753_AENERGY);
 static IIO_DEV_ATTR_LAENERGY(ade7753_read_24bit, ADE7753_LAENERGY);
 static IIO_DEV_ATTR_VAENERGY(ade7753_read_24bit, ADE7753_VAENERGY);
@@ -458,8 +443,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
 		ade7753_read_frequency,
 		ade7753_write_frequency);
 
-static IIO_DEV_ATTR_RESET(ade7753_write_reset);
-
 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("27900 14000 7000 3500");
 
 static struct attribute *ade7753_attributes[] = {
@@ -468,7 +451,6 @@ static struct attribute *ade7753_attributes[] = {
 	&iio_const_attr_in_temp_scale.dev_attr.attr,
 	&iio_dev_attr_sampling_frequency.dev_attr.attr,
 	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_dev_attr_phcal.dev_attr.attr,
 	&iio_dev_attr_cfden.dev_attr.attr,
 	&iio_dev_attr_aenergy.dev_attr.attr,
diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
index 7b6503b..f649ebe 100644
--- a/drivers/staging/iio/meter/ade7754.c
+++ b/drivers/staging/iio/meter/ade7754.c
@@ -224,22 +224,6 @@ static int ade7754_reset(struct device *dev)
 	return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
 }
 
-
-static ssize_t ade7754_write_reset(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t len)
-{
-	if (len < 1)
-		return -1;
-	switch (buf[0]) {
-	case '1':
-	case 'y':
-	case 'Y':
-		return ade7754_reset(dev);
-	}
-	return -1;
-}
-
 static IIO_DEV_ATTR_AENERGY(ade7754_read_24bit, ADE7754_AENERGY);
 static IIO_DEV_ATTR_LAENERGY(ade7754_read_24bit, ADE7754_LAENERGY);
 static IIO_DEV_ATTR_VAENERGY(ade7754_read_24bit, ADE7754_VAENERGY);
@@ -478,8 +462,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
 		ade7754_read_frequency,
 		ade7754_write_frequency);
 
-static IIO_DEV_ATTR_RESET(ade7754_write_reset);
-
 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26000 13000 65000 33000");
 
 static struct attribute *ade7754_attributes[] = {
@@ -488,7 +470,6 @@ static struct attribute *ade7754_attributes[] = {
 	&iio_const_attr_in_temp_scale.dev_attr.attr,
 	&iio_dev_attr_sampling_frequency.dev_attr.attr,
 	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_dev_attr_aenergy.dev_attr.attr,
 	&iio_dev_attr_laenergy.dev_attr.attr,
 	&iio_dev_attr_vaenergy.dev_attr.attr,
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 8f5bcfa..6005d4a 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -313,21 +313,6 @@ static int ade7758_reset(struct device *dev)
 	return ret;
 }
 
-static ssize_t ade7758_write_reset(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t len)
-{
-	if (len < 1)
-		return -1;
-	switch (buf[0]) {
-	case '1':
-	case 'y':
-	case 'Y':
-		return ade7758_reset(dev);
-	}
-	return len;
-}
-
 static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO,
 		ade7758_read_8bit,
 		ade7758_write_8bit,
@@ -591,8 +576,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
 		ade7758_read_frequency,
 		ade7758_write_frequency);
 
-static IIO_DEV_ATTR_RESET(ade7758_write_reset);
-
 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26040 13020 6510 3255");
 
 static struct attribute *ade7758_attributes[] = {
@@ -601,7 +584,6 @@ static struct attribute *ade7758_attributes[] = {
 	&iio_const_attr_in_temp_scale.dev_attr.attr,
 	&iio_dev_attr_sampling_frequency.dev_attr.attr,
 	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_dev_attr_awatthr.dev_attr.attr,
 	&iio_dev_attr_bwatthr.dev_attr.attr,
 	&iio_dev_attr_cwatthr.dev_attr.attr,
diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
index 17dc373..d214ac4 100644
--- a/drivers/staging/iio/meter/ade7759.c
+++ b/drivers/staging/iio/meter/ade7759.c
@@ -229,21 +229,6 @@ static int ade7759_reset(struct device *dev)
 	return ret;
 }
 
-static ssize_t ade7759_write_reset(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t len)
-{
-	if (len < 1)
-		return -1;
-	switch (buf[0]) {
-	case '1':
-	case 'y':
-	case 'Y':
-		return ade7759_reset(dev);
-	}
-	return -1;
-}
-
 static IIO_DEV_ATTR_AENERGY(ade7759_read_40bit, ADE7759_AENERGY);
 static IIO_DEV_ATTR_CFDEN(S_IWUSR | S_IRUGO,
 		ade7759_read_16bit,
@@ -418,8 +403,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
 		ade7759_read_frequency,
 		ade7759_write_frequency);
 
-static IIO_DEV_ATTR_RESET(ade7759_write_reset);
-
 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("27900 14000 7000 3500");
 
 static struct attribute *ade7759_attributes[] = {
@@ -428,7 +411,6 @@ static struct attribute *ade7759_attributes[] = {
 	&iio_const_attr_in_temp_scale.dev_attr.attr,
 	&iio_dev_attr_sampling_frequency.dev_attr.attr,
 	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_dev_attr_phcal.dev_attr.attr,
 	&iio_dev_attr_cfden.dev_attr.attr,
 	&iio_dev_attr_aenergy.dev_attr.attr,
diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c
index c642da8..e8379c0 100644
--- a/drivers/staging/iio/meter/ade7854.c
+++ b/drivers/staging/iio/meter/ade7854.c
@@ -186,22 +186,6 @@ static int ade7854_reset(struct device *dev)
 	return st->write_reg_16(dev, ADE7854_CONFIG, val);
 }
 
-
-static ssize_t ade7854_write_reset(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t len)
-{
-	if (len < 1)
-		return -1;
-	switch (buf[0]) {
-	case '1':
-	case 'y':
-	case 'Y':
-		return ade7854_reset(dev);
-	}
-	return -1;
-}
-
 static IIO_DEV_ATTR_AIGAIN(S_IWUSR | S_IRUGO,
 		ade7854_read_24bit,
 		ade7854_write_24bit,
@@ -468,8 +452,6 @@ err_ret:
 	return ret;
 }
 
-static IIO_DEV_ATTR_RESET(ade7854_write_reset);
-
 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("8000");
 
 static IIO_CONST_ATTR(name, "ade7854");
@@ -515,7 +497,6 @@ static struct attribute *ade7854_attributes[] = {
 	&iio_dev_attr_bvahr.dev_attr.attr,
 	&iio_dev_attr_cvahr.dev_attr.attr,
 	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
-	&iio_dev_attr_reset.dev_attr.attr,
 	&iio_const_attr_name.dev_attr.attr,
 	&iio_dev_attr_vpeak.dev_attr.attr,
 	&iio_dev_attr_ipeak.dev_attr.attr,
-- 
1.8.0


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

* [PATCH 4/4] iio: Remove IIO_DEV_ATTR_RESET macro
  2013-07-16 15:08 [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Lars-Peter Clausen
  2013-07-16 15:08 ` [PATCH 2/4] staging:iio:adt7316: " Lars-Peter Clausen
  2013-07-16 15:08 ` [PATCH 3/4] staging:iio:ade7xxx: " Lars-Peter Clausen
@ 2013-07-16 15:08 ` Lars-Peter Clausen
  2013-07-16 16:57   ` Jonathan Cameron
  2013-07-16 16:56 ` [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Jonathan Cameron
  3 siblings, 1 reply; 8+ messages in thread
From: Lars-Peter Clausen @ 2013-07-16 15:08 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

There are no users of this macro left and we have come to the conclusion that it
is not a good idea to expose the raw chip reset to userspace so the macro is
very unlikely to be used in new drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 include/linux/iio/sysfs.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index b7a934b..2958c96 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -73,11 +73,6 @@ struct iio_const_attr {
 	    .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
 
 /* Generic attributes of onetype or another */
-/**
- * IIO_DEV_ATTR_RESET: resets the device
- **/
-#define IIO_DEV_ATTR_RESET(_store)			\
-	IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
 
 /**
  * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
-- 
1.8.0


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

* Re: [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace
  2013-07-16 15:08 [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Lars-Peter Clausen
                   ` (2 preceding siblings ...)
  2013-07-16 15:08 ` [PATCH 4/4] iio: Remove IIO_DEV_ATTR_RESET macro Lars-Peter Clausen
@ 2013-07-16 16:56 ` Jonathan Cameron
  3 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2013-07-16 16:56 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

On 07/16/2013 04:08 PM, Lars-Peter Clausen wrote:
> There is no reason why userspace should want to trigger a manual reset of the
> device, so remove this functionality.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
applied to the togreg branch of iio.git

Thanks
> ---
>  drivers/staging/iio/resolver/ad2s1210.c | 18 ------------------
>  1 file changed, 18 deletions(-)
> 
> diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> index 0d3356d..dcdadbb 100644
> --- a/drivers/staging/iio/resolver/ad2s1210.c
> +++ b/drivers/staging/iio/resolver/ad2s1210.c
> @@ -192,21 +192,6 @@ static inline int ad2s1210_soft_reset(struct ad2s1210_state *st)
>  	return ad2s1210_config_write(st, 0x0);
>  }
>  
> -static ssize_t ad2s1210_store_softreset(struct device *dev,
> -					struct device_attribute *attr,
> -					const char *buf,
> -					size_t len)
> -{
> -	struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
> -	int ret;
> -
> -	mutex_lock(&st->lock);
> -	ret = ad2s1210_soft_reset(st);
> -	mutex_unlock(&st->lock);
> -
> -	return ret < 0 ? ret : len;
> -}
> -
>  static ssize_t ad2s1210_show_fclkin(struct device *dev,
>  				    struct device_attribute *attr,
>  				    char *buf)
> @@ -536,8 +521,6 @@ error_ret:
>  	return ret;
>  }
>  
> -static IIO_DEVICE_ATTR(reset, S_IWUSR,
> -		       NULL, ad2s1210_store_softreset, 0);
>  static IIO_DEVICE_ATTR(fclkin, S_IRUGO | S_IWUSR,
>  		       ad2s1210_show_fclkin, ad2s1210_store_fclkin, 0);
>  static IIO_DEVICE_ATTR(fexcit, S_IRUGO | S_IWUSR,
> @@ -587,7 +570,6 @@ static const struct iio_chan_spec ad2s1210_channels[] = {
>  };
>  
>  static struct attribute *ad2s1210_attributes[] = {
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_dev_attr_fclkin.dev_attr.attr,
>  	&iio_dev_attr_fexcit.dev_attr.attr,
>  	&iio_dev_attr_control.dev_attr.attr,
> 

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

* Re: [PATCH 2/4] staging:iio:adt7316: Don't expose the chip reset to userspace
  2013-07-16 15:08 ` [PATCH 2/4] staging:iio:adt7316: " Lars-Peter Clausen
@ 2013-07-16 16:57   ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2013-07-16 16:57 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

On 07/16/2013 04:08 PM, Lars-Peter Clausen wrote:
> There is no reason why userspace should want to trigger a manual reset of the
> device, so remove this functionality.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git

Thanks
> ---
>  drivers/staging/iio/addac/adt7316.c | 27 ---------------------------
>  1 file changed, 27 deletions(-)
> 
> diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
> index 506b5a7..1e13568 100644
> --- a/drivers/staging/iio/addac/adt7316.c
> +++ b/drivers/staging/iio/addac/adt7316.c
> @@ -551,31 +551,6 @@ static IIO_DEVICE_ATTR(enable_smbus_timeout, S_IRUGO | S_IWUSR,
>  		adt7316_store_enable_smbus_timeout,
>  		0);
>  
> -
> -static ssize_t adt7316_store_reset(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf,
> -		size_t len)
> -{
> -	struct iio_dev *dev_info = dev_to_iio_dev(dev);
> -	struct adt7316_chip_info *chip = iio_priv(dev_info);
> -	u8 config2;
> -	int ret;
> -
> -	config2 = chip->config2 | ADT7316_RESET;
> -
> -	ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG2, config2);
> -	if (ret)
> -		return -EIO;
> -
> -	return len;
> -}
> -
> -static IIO_DEVICE_ATTR(reset, S_IWUSR,
> -		NULL,
> -		adt7316_store_reset,
> -		0);
> -
>  static ssize_t adt7316_show_powerdown(struct device *dev,
>  		struct device_attribute *attr,
>  		char *buf)
> @@ -1675,7 +1650,6 @@ static IIO_DEVICE_ATTR(bus_type, S_IRUGO, adt7316_show_bus_type, NULL, 0);
>  static struct attribute *adt7316_attributes[] = {
>  	&iio_dev_attr_all_modes.dev_attr.attr,
>  	&iio_dev_attr_mode.dev_attr.attr,
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_dev_attr_enabled.dev_attr.attr,
>  	&iio_dev_attr_ad_channel.dev_attr.attr,
>  	&iio_dev_attr_all_ad_channels.dev_attr.attr,
> @@ -1719,7 +1693,6 @@ static struct attribute *adt7516_attributes[] = {
>  	&iio_dev_attr_all_modes.dev_attr.attr,
>  	&iio_dev_attr_mode.dev_attr.attr,
>  	&iio_dev_attr_select_ex_temp.dev_attr.attr,
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_dev_attr_enabled.dev_attr.attr,
>  	&iio_dev_attr_ad_channel.dev_attr.attr,
>  	&iio_dev_attr_all_ad_channels.dev_attr.attr,
> 

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

* Re: [PATCH 3/4] staging:iio:ade7xxx: Don't expose the chip reset to userspace
  2013-07-16 15:08 ` [PATCH 3/4] staging:iio:ade7xxx: " Lars-Peter Clausen
@ 2013-07-16 16:57   ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2013-07-16 16:57 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

On 07/16/2013 04:08 PM, Lars-Peter Clausen wrote:
> There is no reason why userspace should want to trigger a manual reset of the
> device, so remove this functionality.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/staging/iio/meter/ade7753.c      | 18 ------------------
>  drivers/staging/iio/meter/ade7754.c      | 19 -------------------
>  drivers/staging/iio/meter/ade7758_core.c | 18 ------------------
>  drivers/staging/iio/meter/ade7759.c      | 18 ------------------
>  drivers/staging/iio/meter/ade7854.c      | 19 -------------------
>  5 files changed, 92 deletions(-)
> 
> diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
> index e5943e2..74025fb 100644
> --- a/drivers/staging/iio/meter/ade7753.c
> +++ b/drivers/staging/iio/meter/ade7753.c
> @@ -225,21 +225,6 @@ static int ade7753_reset(struct device *dev)
>  	return ade7753_spi_write_reg_16(dev, ADE7753_MODE, val);
>  }
>  
> -static ssize_t ade7753_write_reset(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t len)
> -{
> -	if (len < 1)
> -		return -1;
> -	switch (buf[0]) {
> -	case '1':
> -	case 'y':
> -	case 'Y':
> -		return ade7753_reset(dev);
> -	}
> -	return -1;
> -}
> -
>  static IIO_DEV_ATTR_AENERGY(ade7753_read_24bit, ADE7753_AENERGY);
>  static IIO_DEV_ATTR_LAENERGY(ade7753_read_24bit, ADE7753_LAENERGY);
>  static IIO_DEV_ATTR_VAENERGY(ade7753_read_24bit, ADE7753_VAENERGY);
> @@ -458,8 +443,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
>  		ade7753_read_frequency,
>  		ade7753_write_frequency);
>  
> -static IIO_DEV_ATTR_RESET(ade7753_write_reset);
> -
>  static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("27900 14000 7000 3500");
>  
>  static struct attribute *ade7753_attributes[] = {
> @@ -468,7 +451,6 @@ static struct attribute *ade7753_attributes[] = {
>  	&iio_const_attr_in_temp_scale.dev_attr.attr,
>  	&iio_dev_attr_sampling_frequency.dev_attr.attr,
>  	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_dev_attr_phcal.dev_attr.attr,
>  	&iio_dev_attr_cfden.dev_attr.attr,
>  	&iio_dev_attr_aenergy.dev_attr.attr,
> diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
> index 7b6503b..f649ebe 100644
> --- a/drivers/staging/iio/meter/ade7754.c
> +++ b/drivers/staging/iio/meter/ade7754.c
> @@ -224,22 +224,6 @@ static int ade7754_reset(struct device *dev)
>  	return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
>  }
>  
> -
> -static ssize_t ade7754_write_reset(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t len)
> -{
> -	if (len < 1)
> -		return -1;
> -	switch (buf[0]) {
> -	case '1':
> -	case 'y':
> -	case 'Y':
> -		return ade7754_reset(dev);
> -	}
> -	return -1;
> -}
> -
>  static IIO_DEV_ATTR_AENERGY(ade7754_read_24bit, ADE7754_AENERGY);
>  static IIO_DEV_ATTR_LAENERGY(ade7754_read_24bit, ADE7754_LAENERGY);
>  static IIO_DEV_ATTR_VAENERGY(ade7754_read_24bit, ADE7754_VAENERGY);
> @@ -478,8 +462,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
>  		ade7754_read_frequency,
>  		ade7754_write_frequency);
>  
> -static IIO_DEV_ATTR_RESET(ade7754_write_reset);
> -
>  static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26000 13000 65000 33000");
>  
>  static struct attribute *ade7754_attributes[] = {
> @@ -488,7 +470,6 @@ static struct attribute *ade7754_attributes[] = {
>  	&iio_const_attr_in_temp_scale.dev_attr.attr,
>  	&iio_dev_attr_sampling_frequency.dev_attr.attr,
>  	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_dev_attr_aenergy.dev_attr.attr,
>  	&iio_dev_attr_laenergy.dev_attr.attr,
>  	&iio_dev_attr_vaenergy.dev_attr.attr,
> diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
> index 8f5bcfa..6005d4a 100644
> --- a/drivers/staging/iio/meter/ade7758_core.c
> +++ b/drivers/staging/iio/meter/ade7758_core.c
> @@ -313,21 +313,6 @@ static int ade7758_reset(struct device *dev)
>  	return ret;
>  }
>  
> -static ssize_t ade7758_write_reset(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t len)
> -{
> -	if (len < 1)
> -		return -1;
> -	switch (buf[0]) {
> -	case '1':
> -	case 'y':
> -	case 'Y':
> -		return ade7758_reset(dev);
> -	}
> -	return len;
> -}
> -
>  static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO,
>  		ade7758_read_8bit,
>  		ade7758_write_8bit,
> @@ -591,8 +576,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
>  		ade7758_read_frequency,
>  		ade7758_write_frequency);
>  
> -static IIO_DEV_ATTR_RESET(ade7758_write_reset);
> -
>  static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26040 13020 6510 3255");
>  
>  static struct attribute *ade7758_attributes[] = {
> @@ -601,7 +584,6 @@ static struct attribute *ade7758_attributes[] = {
>  	&iio_const_attr_in_temp_scale.dev_attr.attr,
>  	&iio_dev_attr_sampling_frequency.dev_attr.attr,
>  	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_dev_attr_awatthr.dev_attr.attr,
>  	&iio_dev_attr_bwatthr.dev_attr.attr,
>  	&iio_dev_attr_cwatthr.dev_attr.attr,
> diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
> index 17dc373..d214ac4 100644
> --- a/drivers/staging/iio/meter/ade7759.c
> +++ b/drivers/staging/iio/meter/ade7759.c
> @@ -229,21 +229,6 @@ static int ade7759_reset(struct device *dev)
>  	return ret;
>  }
>  
> -static ssize_t ade7759_write_reset(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t len)
> -{
> -	if (len < 1)
> -		return -1;
> -	switch (buf[0]) {
> -	case '1':
> -	case 'y':
> -	case 'Y':
> -		return ade7759_reset(dev);
> -	}
> -	return -1;
> -}
> -
>  static IIO_DEV_ATTR_AENERGY(ade7759_read_40bit, ADE7759_AENERGY);
>  static IIO_DEV_ATTR_CFDEN(S_IWUSR | S_IRUGO,
>  		ade7759_read_16bit,
> @@ -418,8 +403,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
>  		ade7759_read_frequency,
>  		ade7759_write_frequency);
>  
> -static IIO_DEV_ATTR_RESET(ade7759_write_reset);
> -
>  static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("27900 14000 7000 3500");
>  
>  static struct attribute *ade7759_attributes[] = {
> @@ -428,7 +411,6 @@ static struct attribute *ade7759_attributes[] = {
>  	&iio_const_attr_in_temp_scale.dev_attr.attr,
>  	&iio_dev_attr_sampling_frequency.dev_attr.attr,
>  	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_dev_attr_phcal.dev_attr.attr,
>  	&iio_dev_attr_cfden.dev_attr.attr,
>  	&iio_dev_attr_aenergy.dev_attr.attr,
> diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c
> index c642da8..e8379c0 100644
> --- a/drivers/staging/iio/meter/ade7854.c
> +++ b/drivers/staging/iio/meter/ade7854.c
> @@ -186,22 +186,6 @@ static int ade7854_reset(struct device *dev)
>  	return st->write_reg_16(dev, ADE7854_CONFIG, val);
>  }
>  
> -
> -static ssize_t ade7854_write_reset(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t len)
> -{
> -	if (len < 1)
> -		return -1;
> -	switch (buf[0]) {
> -	case '1':
> -	case 'y':
> -	case 'Y':
> -		return ade7854_reset(dev);
> -	}
> -	return -1;
> -}
> -
>  static IIO_DEV_ATTR_AIGAIN(S_IWUSR | S_IRUGO,
>  		ade7854_read_24bit,
>  		ade7854_write_24bit,
> @@ -468,8 +452,6 @@ err_ret:
>  	return ret;
>  }
>  
> -static IIO_DEV_ATTR_RESET(ade7854_write_reset);
> -
>  static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("8000");
>  
>  static IIO_CONST_ATTR(name, "ade7854");
> @@ -515,7 +497,6 @@ static struct attribute *ade7854_attributes[] = {
>  	&iio_dev_attr_bvahr.dev_attr.attr,
>  	&iio_dev_attr_cvahr.dev_attr.attr,
>  	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
> -	&iio_dev_attr_reset.dev_attr.attr,
>  	&iio_const_attr_name.dev_attr.attr,
>  	&iio_dev_attr_vpeak.dev_attr.attr,
>  	&iio_dev_attr_ipeak.dev_attr.attr,
> 

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

* Re: [PATCH 4/4] iio: Remove IIO_DEV_ATTR_RESET macro
  2013-07-16 15:08 ` [PATCH 4/4] iio: Remove IIO_DEV_ATTR_RESET macro Lars-Peter Clausen
@ 2013-07-16 16:57   ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2013-07-16 16:57 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

On 07/16/2013 04:08 PM, Lars-Peter Clausen wrote:
> There are no users of this macro left and we have come to the conclusion that it
> is not a good idea to expose the raw chip reset to userspace so the macro is
> very unlikely to be used in new drivers.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git.

Glad to see this one go.

Thanks,

Jonathan
> ---
>  include/linux/iio/sysfs.h | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
> index b7a934b..2958c96 100644
> --- a/include/linux/iio/sysfs.h
> +++ b/include/linux/iio/sysfs.h
> @@ -73,11 +73,6 @@ struct iio_const_attr {
>  	    .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
>  
>  /* Generic attributes of onetype or another */
> -/**
> - * IIO_DEV_ATTR_RESET: resets the device
> - **/
> -#define IIO_DEV_ATTR_RESET(_store)			\
> -	IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
>  
>  /**
>   * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
> 

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

end of thread, other threads:[~2013-07-16 16:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-16 15:08 [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Lars-Peter Clausen
2013-07-16 15:08 ` [PATCH 2/4] staging:iio:adt7316: " Lars-Peter Clausen
2013-07-16 16:57   ` Jonathan Cameron
2013-07-16 15:08 ` [PATCH 3/4] staging:iio:ade7xxx: " Lars-Peter Clausen
2013-07-16 16:57   ` Jonathan Cameron
2013-07-16 15:08 ` [PATCH 4/4] iio: Remove IIO_DEV_ATTR_RESET macro Lars-Peter Clausen
2013-07-16 16:57   ` Jonathan Cameron
2013-07-16 16:56 ` [PATCH 1/4] staging:iio:ad2s1210: Don't expose the chip reset to userspace Jonathan Cameron

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).