linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] iio: core: Use pr_err instead of printk
@ 2013-10-24 11:53 Sachin Kamat
  2013-10-24 11:53 ` [PATCH 2/9] iio: core: Add misssing braces Sachin Kamat
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

Use of pr_err is preferred to printk.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/industrialio-core.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index f721157..e4780b4 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -9,6 +9,8 @@
  * Based on elements of hwmon and input subsystems.
  */
 
+#define pr_fmt(fmt) "iio-core: " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/idr.h>
@@ -132,16 +134,13 @@ static int __init iio_init(void)
 	/* Register sysfs bus */
 	ret  = bus_register(&iio_bus_type);
 	if (ret < 0) {
-		printk(KERN_ERR
-		       "%s could not register bus type\n",
-			__FILE__);
+		pr_err("could not register bus type\n");
 		goto error_nothing;
 	}
 
 	ret = alloc_chrdev_region(&iio_devt, 0, IIO_DEV_MAX, "iio");
 	if (ret < 0) {
-		printk(KERN_ERR "%s: failed to allocate char dev region\n",
-		       __FILE__);
+		pr_err("failed to allocate char dev region\n");
 		goto error_unregister_bus_type;
 	}
 
@@ -951,7 +950,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
 		dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
 		if (dev->id < 0) {
 			/* cannot use a dev_err as the name isn't available */
-			printk(KERN_ERR "Failed to get id\n");
+			pr_err("failed to get device id\n");
 			kfree(dev);
 			return NULL;
 		}
-- 
1.7.9.5


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

* [PATCH 2/9] iio: core: Add misssing braces
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:44   ` Jonathan Cameron
  2013-10-24 11:53 ` [PATCH 3/9] iio: accel: kxsd9: Remove redundant variable Sachin Kamat
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

Silences the following checkpatch warning:
WARNING: sizeof *iio_attr should be sizeof(*iio_attr)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/industrialio-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index e4780b4..18f72e3 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -685,7 +685,7 @@ int __iio_add_chan_devattr(const char *postfix,
 	int ret;
 	struct iio_dev_attr *iio_attr, *t;
 
-	iio_attr = kzalloc(sizeof *iio_attr, GFP_KERNEL);
+	iio_attr = kzalloc(sizeof(*iio_attr), GFP_KERNEL);
 	if (iio_attr == NULL) {
 		ret = -ENOMEM;
 		goto error_ret;
-- 
1.7.9.5

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

* [PATCH 3/9] iio: accel: kxsd9: Remove redundant variable
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
  2013-10-24 11:53 ` [PATCH 2/9] iio: core: Add misssing braces Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:44   ` Jonathan Cameron
  2013-10-24 11:53 ` [PATCH 4/9] iio: adc: twl6030-gpadc: Remove redundant code Sachin Kamat
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

Return directly thereby eliminating an intermediate variable.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/accel/kxsd9.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index 709c132..d72118d 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -222,7 +222,6 @@ static int kxsd9_probe(struct spi_device *spi)
 {
 	struct iio_dev *indio_dev;
 	struct kxsd9_state *st;
-	int ret;
 
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
 	if (!indio_dev)
@@ -244,11 +243,7 @@ static int kxsd9_probe(struct spi_device *spi)
 	spi_setup(spi);
 	kxsd9_power_up(st);
 
-	ret = iio_device_register(indio_dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 static int kxsd9_remove(struct spi_device *spi)
-- 
1.7.9.5

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

* [PATCH 4/9] iio: adc: twl6030-gpadc: Remove redundant code
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
  2013-10-24 11:53 ` [PATCH 2/9] iio: core: Add misssing braces Sachin Kamat
  2013-10-24 11:53 ` [PATCH 3/9] iio: accel: kxsd9: Remove redundant variable Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:49   ` Jonathan Cameron
  2013-10-24 11:53 ` [PATCH 5/9] iio: dac: ad5421: " Sachin Kamat
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Hence return the function directly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/adc/twl6030-gpadc.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
index 0ea96c0..5d13f8b 100644
--- a/drivers/iio/adc/twl6030-gpadc.c
+++ b/drivers/iio/adc/twl6030-gpadc.c
@@ -948,9 +948,7 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
 	indio_dev->channels = pdata->iio_channels;
 	indio_dev->num_channels = pdata->nchannels;
 
-	ret = iio_device_register(indio_dev);
-
-	return ret;
+	return iio_device_register(indio_dev);
 }
 
 static int twl6030_gpadc_remove(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH 5/9] iio: dac: ad5421: Remove redundant code
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
                   ` (2 preceding siblings ...)
  2013-10-24 11:53 ` [PATCH 4/9] iio: adc: twl6030-gpadc: Remove redundant code Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:51   ` Jonathan Cameron
  2013-10-24 11:53 ` [PATCH 6/9] iio: dac: ad5755: " Sachin Kamat
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Hence return the function directly. Error messages are already
printed by iio_device_register(); hence not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/dac/ad5421.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
index c44afeb..3eeaa82 100644
--- a/drivers/iio/dac/ad5421.c
+++ b/drivers/iio/dac/ad5421.c
@@ -514,13 +514,7 @@ static int ad5421_probe(struct spi_device *spi)
 			return ret;
 	}
 
-	ret = iio_device_register(indio_dev);
-	if (ret) {
-		dev_err(&spi->dev, "Failed to register iio device: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 static int ad5421_remove(struct spi_device *spi)
-- 
1.7.9.5

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

* [PATCH 6/9] iio: dac: ad5755: Remove redundant code
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
                   ` (3 preceding siblings ...)
  2013-10-24 11:53 ` [PATCH 5/9] iio: dac: ad5421: " Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:51   ` Jonathan Cameron
  2013-10-24 11:53 ` [PATCH 7/9] iio: dac: max517: Remove redundant variable Sachin Kamat
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Error messages are already printed by iio_device_register();
hence not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/dac/ad5755.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index bd31dbc..9a78d5a 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -589,13 +589,7 @@ static int ad5755_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	ret = iio_device_register(indio_dev);
-	if (ret) {
-		dev_err(&spi->dev, "Failed to register iio device: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 static int ad5755_remove(struct spi_device *spi)
-- 
1.7.9.5

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

* [PATCH 7/9] iio: dac: max517: Remove redundant variable
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
                   ` (4 preceding siblings ...)
  2013-10-24 11:53 ` [PATCH 6/9] iio: dac: ad5755: " Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:52   ` Jonathan Cameron
  2013-10-24 11:53 ` [PATCH 8/9] iio: dac: mcp4725: Remove redundant code Sachin Kamat
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

Remove an inconsequential print message and return directly
thereby eliminating an intermediate variable.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/dac/max517.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
index d26be14..6e19035 100644
--- a/drivers/iio/dac/max517.c
+++ b/drivers/iio/dac/max517.c
@@ -160,7 +160,6 @@ static int max517_probe(struct i2c_client *client,
 	struct max517_data *data;
 	struct iio_dev *indio_dev;
 	struct max517_platform_data *platform_data = client->dev.platform_data;
-	int err;
 
 	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
 	if (!indio_dev)
@@ -192,13 +191,7 @@ static int max517_probe(struct i2c_client *client,
 		data->vref_mv[1] = platform_data->vref_mv[1];
 	}
 
-	err = iio_device_register(indio_dev);
-	if (err)
-		return err;
-
-	dev_info(&client->dev, "DAC registered\n");
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 static int max517_remove(struct i2c_client *client)
-- 
1.7.9.5

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

* [PATCH 8/9] iio: dac: mcp4725: Remove redundant code
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
                   ` (5 preceding siblings ...)
  2013-10-24 11:53 ` [PATCH 7/9] iio: dac: max517: Remove redundant variable Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:53   ` Jonathan Cameron
  2013-10-24 11:53 ` [PATCH 9/9] iio: light: vcnl4000: " Sachin Kamat
  2013-10-24 13:41 ` [PATCH 1/9] iio: core: Use pr_err instead of printk Jonathan Cameron
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

Remove an inconsequential print message and return directly
thereby cleaning up some code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/dac/mcp4725.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
index d982752..9f57ae8 100644
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -320,13 +320,7 @@ static int mcp4725_probe(struct i2c_client *client,
 	data->powerdown_mode = pd ? pd-1 : 2; /* 500kohm_to_gnd */
 	data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4);
 
-	err = iio_device_register(indio_dev);
-	if (err)
-		return err;
-
-	dev_info(&client->dev, "MCP4725 DAC registered\n");
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 static int mcp4725_remove(struct i2c_client *client)
-- 
1.7.9.5

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

* [PATCH 9/9] iio: light: vcnl4000: Remove redundant code
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
                   ` (6 preceding siblings ...)
  2013-10-24 11:53 ` [PATCH 8/9] iio: dac: mcp4725: Remove redundant code Sachin Kamat
@ 2013-10-24 11:53 ` Sachin Kamat
  2013-10-24 13:53   ` Jonathan Cameron
  2013-10-24 13:41 ` [PATCH 1/9] iio: core: Use pr_err instead of printk Jonathan Cameron
  8 siblings, 1 reply; 18+ messages in thread
From: Sachin Kamat @ 2013-10-24 11:53 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, sachin.kamat

The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Hence return the function directly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/iio/light/vcnl4000.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 2bb3042..ecb3341 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -179,11 +179,7 @@ static int vcnl4000_probe(struct i2c_client *client,
 	indio_dev->name = VCNL4000_DRV_NAME;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	ret = iio_device_register(indio_dev);
-	if (ret < 0)
-		return ret;
-
-	return 0;
+	return iio_device_register(indio_dev);
 }
 
 static int vcnl4000_remove(struct i2c_client *client)
-- 
1.7.9.5

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

* Re: [PATCH 1/9] iio: core: Use pr_err instead of printk
  2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
                   ` (7 preceding siblings ...)
  2013-10-24 11:53 ` [PATCH 9/9] iio: light: vcnl4000: " Sachin Kamat
@ 2013-10-24 13:41 ` Jonathan Cameron
  8 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:41 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> Use of pr_err is preferred to printk.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/industrialio-core.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index f721157..e4780b4 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -9,6 +9,8 @@
>   * Based on elements of hwmon and input subsystems.
>   */
>  
> +#define pr_fmt(fmt) "iio-core: " fmt
> +
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/idr.h>
> @@ -132,16 +134,13 @@ static int __init iio_init(void)
>  	/* Register sysfs bus */
>  	ret  = bus_register(&iio_bus_type);
>  	if (ret < 0) {
> -		printk(KERN_ERR
> -		       "%s could not register bus type\n",
> -			__FILE__);
> +		pr_err("could not register bus type\n");
>  		goto error_nothing;
>  	}
>  
>  	ret = alloc_chrdev_region(&iio_devt, 0, IIO_DEV_MAX, "iio");
>  	if (ret < 0) {
> -		printk(KERN_ERR "%s: failed to allocate char dev region\n",
> -		       __FILE__);
> +		pr_err("failed to allocate char dev region\n");
>  		goto error_unregister_bus_type;
>  	}
>  
> @@ -951,7 +950,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
>  		dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
>  		if (dev->id < 0) {
>  			/* cannot use a dev_err as the name isn't available */
> -			printk(KERN_ERR "Failed to get id\n");
> +			pr_err("failed to get device id\n");
>  			kfree(dev);
>  			return NULL;
>  		}
> 

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

* Re: [PATCH 2/9] iio: core: Add misssing braces
  2013-10-24 11:53 ` [PATCH 2/9] iio: core: Add misssing braces Sachin Kamat
@ 2013-10-24 13:44   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:44 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> Silences the following checkpatch warning:
> WARNING: sizeof *iio_attr should be sizeof(*iio_attr)
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the togreg branch of iio.git

> ---
>  drivers/iio/industrialio-core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index e4780b4..18f72e3 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -685,7 +685,7 @@ int __iio_add_chan_devattr(const char *postfix,
>  	int ret;
>  	struct iio_dev_attr *iio_attr, *t;
>  
> -	iio_attr = kzalloc(sizeof *iio_attr, GFP_KERNEL);
> +	iio_attr = kzalloc(sizeof(*iio_attr), GFP_KERNEL);
>  	if (iio_attr == NULL) {
>  		ret = -ENOMEM;
>  		goto error_ret;
> 

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

* Re: [PATCH 3/9] iio: accel: kxsd9: Remove redundant variable
  2013-10-24 11:53 ` [PATCH 3/9] iio: accel: kxsd9: Remove redundant variable Sachin Kamat
@ 2013-10-24 13:44   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:44 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> Return directly thereby eliminating an intermediate variable.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/accel/kxsd9.c |    7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
> index 709c132..d72118d 100644
> --- a/drivers/iio/accel/kxsd9.c
> +++ b/drivers/iio/accel/kxsd9.c
> @@ -222,7 +222,6 @@ static int kxsd9_probe(struct spi_device *spi)
>  {
>  	struct iio_dev *indio_dev;
>  	struct kxsd9_state *st;
> -	int ret;
>  
>  	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
>  	if (!indio_dev)
> @@ -244,11 +243,7 @@ static int kxsd9_probe(struct spi_device *spi)
>  	spi_setup(spi);
>  	kxsd9_power_up(st);
>  
> -	ret = iio_device_register(indio_dev);
> -	if (ret)
> -		return ret;
> -
> -	return 0;
> +	return iio_device_register(indio_dev);
>  }
>  
>  static int kxsd9_remove(struct spi_device *spi)
> 

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

* Re: [PATCH 4/9] iio: adc: twl6030-gpadc: Remove redundant code
  2013-10-24 11:53 ` [PATCH 4/9] iio: adc: twl6030-gpadc: Remove redundant code Sachin Kamat
@ 2013-10-24 13:49   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:49 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> The if check is redundant as the value obtained from
> iio_device_register() is already in the required format.
> Hence return the function directly.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied
> ---
>  drivers/iio/adc/twl6030-gpadc.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
> index 0ea96c0..5d13f8b 100644
> --- a/drivers/iio/adc/twl6030-gpadc.c
> +++ b/drivers/iio/adc/twl6030-gpadc.c
> @@ -948,9 +948,7 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
>  	indio_dev->channels = pdata->iio_channels;
>  	indio_dev->num_channels = pdata->nchannels;
>  
> -	ret = iio_device_register(indio_dev);
> -
> -	return ret;
> +	return iio_device_register(indio_dev);
>  }
>  
>  static int twl6030_gpadc_remove(struct platform_device *pdev)
> 

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

* Re: [PATCH 5/9] iio: dac: ad5421: Remove redundant code
  2013-10-24 11:53 ` [PATCH 5/9] iio: dac: ad5421: " Sachin Kamat
@ 2013-10-24 13:51   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:51 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> The if check is redundant as the value obtained from
> iio_device_register() is already in the required format.
> Hence return the function directly. Error messages are already
> printed by iio_device_register(); hence not needed.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>

Technically changing a dmesg output is userspace abi, but I doubt anyone
actually cares so dropping it is fine  (anyone who does should shout and we'll
put it back!)

Hence Applied to the togreg branch of iio.git

> ---
>  drivers/iio/dac/ad5421.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
> index c44afeb..3eeaa82 100644
> --- a/drivers/iio/dac/ad5421.c
> +++ b/drivers/iio/dac/ad5421.c
> @@ -514,13 +514,7 @@ static int ad5421_probe(struct spi_device *spi)
>  			return ret;
>  	}
>  
> -	ret = iio_device_register(indio_dev);
> -	if (ret) {
> -		dev_err(&spi->dev, "Failed to register iio device: %d\n", ret);
> -		return ret;
> -	}
> -
> -	return 0;
> +	return iio_device_register(indio_dev);
>  }
>  
>  static int ad5421_remove(struct spi_device *spi)
> 

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

* Re: [PATCH 6/9] iio: dac: ad5755: Remove redundant code
  2013-10-24 11:53 ` [PATCH 6/9] iio: dac: ad5755: " Sachin Kamat
@ 2013-10-24 13:51   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:51 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> The if check is redundant as the value obtained from
> iio_device_register() is already in the required format.
> Error messages are already printed by iio_device_register();
> hence not needed.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/dac/ad5755.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> index bd31dbc..9a78d5a 100644
> --- a/drivers/iio/dac/ad5755.c
> +++ b/drivers/iio/dac/ad5755.c
> @@ -589,13 +589,7 @@ static int ad5755_probe(struct spi_device *spi)
>  	if (ret)
>  		return ret;
>  
> -	ret = iio_device_register(indio_dev);
> -	if (ret) {
> -		dev_err(&spi->dev, "Failed to register iio device: %d\n", ret);
> -		return ret;
> -	}
> -
> -	return 0;
> +	return iio_device_register(indio_dev);
>  }
>  
>  static int ad5755_remove(struct spi_device *spi)
> 

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

* Re: [PATCH 7/9] iio: dac: max517: Remove redundant variable
  2013-10-24 11:53 ` [PATCH 7/9] iio: dac: max517: Remove redundant variable Sachin Kamat
@ 2013-10-24 13:52   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:52 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> Remove an inconsequential print message and return directly
> thereby eliminating an intermediate variable.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/dac/max517.c |    9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
> index d26be14..6e19035 100644
> --- a/drivers/iio/dac/max517.c
> +++ b/drivers/iio/dac/max517.c
> @@ -160,7 +160,6 @@ static int max517_probe(struct i2c_client *client,
>  	struct max517_data *data;
>  	struct iio_dev *indio_dev;
>  	struct max517_platform_data *platform_data = client->dev.platform_data;
> -	int err;
>  
>  	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
>  	if (!indio_dev)
> @@ -192,13 +191,7 @@ static int max517_probe(struct i2c_client *client,
>  		data->vref_mv[1] = platform_data->vref_mv[1];
>  	}
>  
> -	err = iio_device_register(indio_dev);
> -	if (err)
> -		return err;
> -
> -	dev_info(&client->dev, "DAC registered\n");
> -
> -	return 0;
> +	return iio_device_register(indio_dev);
>  }
>  
>  static int max517_remove(struct i2c_client *client)
> 

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

* Re: [PATCH 8/9] iio: dac: mcp4725: Remove redundant code
  2013-10-24 11:53 ` [PATCH 8/9] iio: dac: mcp4725: Remove redundant code Sachin Kamat
@ 2013-10-24 13:53   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:53 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> Remove an inconsequential print message and return directly
> thereby cleaning up some code.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the toreg branch of iio.git
(same comment on does anyone care about the message drop?)
> ---
>  drivers/iio/dac/mcp4725.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
> index d982752..9f57ae8 100644
> --- a/drivers/iio/dac/mcp4725.c
> +++ b/drivers/iio/dac/mcp4725.c
> @@ -320,13 +320,7 @@ static int mcp4725_probe(struct i2c_client *client,
>  	data->powerdown_mode = pd ? pd-1 : 2; /* 500kohm_to_gnd */
>  	data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4);
>  
> -	err = iio_device_register(indio_dev);
> -	if (err)
> -		return err;
> -
> -	dev_info(&client->dev, "MCP4725 DAC registered\n");
> -
> -	return 0;
> +	return iio_device_register(indio_dev);
>  }
>  
>  static int mcp4725_remove(struct i2c_client *client)
> 

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

* Re: [PATCH 9/9] iio: light: vcnl4000: Remove redundant code
  2013-10-24 11:53 ` [PATCH 9/9] iio: light: vcnl4000: " Sachin Kamat
@ 2013-10-24 13:53   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2013-10-24 13:53 UTC (permalink / raw)
  To: Sachin Kamat, linux-iio

On 10/24/13 12:53, Sachin Kamat wrote:
> The if check is redundant as the value obtained from
> iio_device_register() is already in the required format.
> Hence return the function directly.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied to the togreg branch of iio.git

Thanks for the series.
> ---
>  drivers/iio/light/vcnl4000.c |    6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 2bb3042..ecb3341 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -179,11 +179,7 @@ static int vcnl4000_probe(struct i2c_client *client,
>  	indio_dev->name = VCNL4000_DRV_NAME;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  
> -	ret = iio_device_register(indio_dev);
> -	if (ret < 0)
> -		return ret;
> -
> -	return 0;
> +	return iio_device_register(indio_dev);
>  }
>  
>  static int vcnl4000_remove(struct i2c_client *client)
> 

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

end of thread, other threads:[~2013-10-24 12:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-24 11:53 [PATCH 1/9] iio: core: Use pr_err instead of printk Sachin Kamat
2013-10-24 11:53 ` [PATCH 2/9] iio: core: Add misssing braces Sachin Kamat
2013-10-24 13:44   ` Jonathan Cameron
2013-10-24 11:53 ` [PATCH 3/9] iio: accel: kxsd9: Remove redundant variable Sachin Kamat
2013-10-24 13:44   ` Jonathan Cameron
2013-10-24 11:53 ` [PATCH 4/9] iio: adc: twl6030-gpadc: Remove redundant code Sachin Kamat
2013-10-24 13:49   ` Jonathan Cameron
2013-10-24 11:53 ` [PATCH 5/9] iio: dac: ad5421: " Sachin Kamat
2013-10-24 13:51   ` Jonathan Cameron
2013-10-24 11:53 ` [PATCH 6/9] iio: dac: ad5755: " Sachin Kamat
2013-10-24 13:51   ` Jonathan Cameron
2013-10-24 11:53 ` [PATCH 7/9] iio: dac: max517: Remove redundant variable Sachin Kamat
2013-10-24 13:52   ` Jonathan Cameron
2013-10-24 11:53 ` [PATCH 8/9] iio: dac: mcp4725: Remove redundant code Sachin Kamat
2013-10-24 13:53   ` Jonathan Cameron
2013-10-24 11:53 ` [PATCH 9/9] iio: light: vcnl4000: " Sachin Kamat
2013-10-24 13:53   ` Jonathan Cameron
2013-10-24 13:41 ` [PATCH 1/9] iio: core: Use pr_err instead of printk 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).