[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vdc1E1g7AYzASRZRfvsRsGFE6OT0+hD82YTfxMcnhGRrQ@mail.gmail.com>
Date: Wed, 21 Feb 2018 21:04:28 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Enric Balletbo i Serra <enric.balletbo@...labora.com>
Cc: Lee Jones <lee.jones@...aro.org>,
Benson Leung <bleung@...omium.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
kernel@...labora.com, groeck@...omium.org,
Gwendal Grignou <gwendal@...omium.org>
Subject: Re: [PATCH v2 2/6] platform/chrome: cros_ec_sysfs: introduce
to_cros_ec_dev define.
On Wed, Feb 21, 2018 at 7:07 PM, Enric Balletbo i Serra
<enric.balletbo@...labora.com> wrote:
> Add a define to get the cros_ec_dev from device and use it.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@...labora.com>
> ---
> Changes since v1:
> - New in this series. Suggested by Andy Shevchenko.
We have an established tag
Suggested-by: Andy Shevchenko <andy.shevchenko@...il.com>
>
> drivers/platform/chrome/cros_ec_sysfs.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c
> index c03621e523a3..85bb9580439e 100644
> --- a/drivers/platform/chrome/cros_ec_sysfs.c
> +++ b/drivers/platform/chrome/cros_ec_sysfs.c
> @@ -34,6 +34,8 @@
> #include <linux/types.h>
> #include <linux/uaccess.h>
>
> +#define to_cros_ec_dev(dev) container_of(dev, struct cros_ec_dev, class_dev)
> +
> /* Accessor functions */
>
> static ssize_t show_ec_reboot(struct device *dev,
> @@ -70,8 +72,7 @@ static ssize_t store_ec_reboot(struct device *dev,
> int got_cmd = 0, offset = 0;
> int i;
> int ret;
> - struct cros_ec_dev *ec = container_of(dev,
> - struct cros_ec_dev, class_dev);
> + struct cros_ec_dev *ec = to_cros_ec_dev(dev);
>
> msg = kmalloc(sizeof(*msg) + sizeof(*param), GFP_KERNEL);
> if (!msg)
> @@ -132,8 +133,7 @@ static ssize_t show_ec_version(struct device *dev,
> struct cros_ec_command *msg;
> int ret;
> int count = 0;
> - struct cros_ec_dev *ec = container_of(dev,
> - struct cros_ec_dev, class_dev);
> + struct cros_ec_dev *ec = to_cros_ec_dev(dev);
>
> msg = kmalloc(sizeof(*msg) + EC_HOST_PARAM_SIZE, GFP_KERNEL);
> if (!msg)
> @@ -231,8 +231,7 @@ static ssize_t show_ec_flashinfo(struct device *dev,
> struct ec_response_flash_info *resp;
> struct cros_ec_command *msg;
> int ret;
> - struct cros_ec_dev *ec = container_of(dev,
> - struct cros_ec_dev, class_dev);
> + struct cros_ec_dev *ec = to_cros_ec_dev(dev);
>
> msg = kmalloc(sizeof(*msg) + sizeof(*resp), GFP_KERNEL);
> if (!msg)
> --
> 2.16.1
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists