diff mbox

[1/3] iio: cros_ec: light code cleanup

Message ID 20180104201718.221900-2-gwendal@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Gwendal Grignou Jan. 4, 2018, 8:17 p.m. UTC
- use dev instead of &pdev->dev when defined
- remove syfs.h inclusion.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c      | 5 ++---
 drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 7 +++----
 2 files changed, 5 insertions(+), 7 deletions(-)

Comments

Enric Balletbo i Serra Jan. 5, 2018, 9:22 a.m. UTC | #1
Hi Gwendal,

On 04/01/18 21:17, Gwendal Grignou wrote:
> - use dev instead of &pdev->dev when defined
> - remove syfs.h inclusion.
> 
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c      | 5 ++---
>  drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 7 +++----
>  2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> index 7d30c59da3e2..2297c8ce7cb8 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> @@ -29,7 +29,6 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> -#include <linux/sysfs.h>
>  
>  #include "cros_ec_sensors_core.h"
>  
> @@ -201,7 +200,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*state));
> +	indio_dev = devm_iio_device_alloc(dev, sizeof(*state));
>  	if (!indio_dev)
>  		return -ENOMEM;
>  
> @@ -241,7 +240,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
>  			channel->type = IIO_MAGN;
>  			break;
>  		default:
> -			dev_err(&pdev->dev, "Unknown motion sensor\n");
> +			dev_err(dev, "Unknown motion sensor\n");
>  			return -EINVAL;
>  		}
>  	}
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> index 416cae5ebbd0..d50a32ba91fe 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> @@ -24,7 +24,6 @@
>  #include <linux/mfd/cros_ec_commands.h>
>  #include <linux/module.h>
>  #include <linux/slab.h>
> -#include <linux/sysfs.h>
>  #include <linux/platform_device.h>
>  
>  #include "cros_ec_sensors_core.h"
> @@ -41,13 +40,13 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
>  {
>  	struct device *dev = &pdev->dev;
>  	struct cros_ec_sensors_core_state *state = iio_priv(indio_dev);
> -	struct cros_ec_dev *ec = dev_get_drvdata(pdev->dev.parent);
> +	struct cros_ec_dev *ec = dev_get_drvdata(dev->parent);
>  	struct cros_ec_sensor_platform *sensor_platform = dev_get_platdata(dev);
>  
>  	platform_set_drvdata(pdev, indio_dev);
>  
>  	state->ec = ec->ec_dev;
> -	state->msg = devm_kzalloc(&pdev->dev,
> +	state->msg = devm_kzalloc(dev,
>  				max((u16)sizeof(struct ec_params_motion_sense),
>  				state->ec->max_response), GFP_KERNEL);
>  	if (!state->msg)
> @@ -62,7 +61,7 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
>  	state->msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset;
>  	state->msg->outsize = sizeof(struct ec_params_motion_sense);
>  
> -	indio_dev->dev.parent = &pdev->dev;
> +	indio_dev->dev.parent = dev;
>  	indio_dev->name = pdev->name;
>  
>  	if (physical_device) {
> 

This patch looks good to me but did you miss to include the patch when you sent
v2? At least I did not receive the patch within v2 nor is available in linux-iio
patchwork v2 series.

Best regards,
 Enric
--
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
Gwendal Grignou Jan. 8, 2018, 5:20 p.m. UTC | #2
On Fri, Jan 5, 2018 at 1:22 AM, Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
> Hi Gwendal,
>
> On 04/01/18 21:17, Gwendal Grignou wrote:
>> - use dev instead of &pdev->dev when defined
>> - remove syfs.h inclusion.
>>
>> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
>> ---

>
> This patch looks good to me but did you miss to include the patch when you sent
> v2? At least I did not receive the patch within v2 nor is available in linux-iio
> patchwork v2 series.
I did not resend it as there was not change in this patch between v1
and v2, my mistake. I am resending a newer patch anyway, as the 2
other patches in v2 were incorrect.

Gwendal.
>
> Best regards,
>  Enric
--
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/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index 7d30c59da3e2..2297c8ce7cb8 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -29,7 +29,6 @@ 
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
-#include <linux/sysfs.h>
 
 #include "cros_ec_sensors_core.h"
 
@@ -201,7 +200,7 @@  static int cros_ec_sensors_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*state));
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*state));
 	if (!indio_dev)
 		return -ENOMEM;
 
@@ -241,7 +240,7 @@  static int cros_ec_sensors_probe(struct platform_device *pdev)
 			channel->type = IIO_MAGN;
 			break;
 		default:
-			dev_err(&pdev->dev, "Unknown motion sensor\n");
+			dev_err(dev, "Unknown motion sensor\n");
 			return -EINVAL;
 		}
 	}
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
index 416cae5ebbd0..d50a32ba91fe 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
@@ -24,7 +24,6 @@ 
 #include <linux/mfd/cros_ec_commands.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/sysfs.h>
 #include <linux/platform_device.h>
 
 #include "cros_ec_sensors_core.h"
@@ -41,13 +40,13 @@  int cros_ec_sensors_core_init(struct platform_device *pdev,
 {
 	struct device *dev = &pdev->dev;
 	struct cros_ec_sensors_core_state *state = iio_priv(indio_dev);
-	struct cros_ec_dev *ec = dev_get_drvdata(pdev->dev.parent);
+	struct cros_ec_dev *ec = dev_get_drvdata(dev->parent);
 	struct cros_ec_sensor_platform *sensor_platform = dev_get_platdata(dev);
 
 	platform_set_drvdata(pdev, indio_dev);
 
 	state->ec = ec->ec_dev;
-	state->msg = devm_kzalloc(&pdev->dev,
+	state->msg = devm_kzalloc(dev,
 				max((u16)sizeof(struct ec_params_motion_sense),
 				state->ec->max_response), GFP_KERNEL);
 	if (!state->msg)
@@ -62,7 +61,7 @@  int cros_ec_sensors_core_init(struct platform_device *pdev,
 	state->msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset;
 	state->msg->outsize = sizeof(struct ec_params_motion_sense);
 
-	indio_dev->dev.parent = &pdev->dev;
+	indio_dev->dev.parent = dev;
 	indio_dev->name = pdev->name;
 
 	if (physical_device) {