aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>2018-03-23 13:42:43 -0400
committerBenson Leung <bleung@chromium.org>2018-04-11 01:22:49 -0400
commit93afebbe694ecd0a22f065af2e2565e2dbd49025 (patch)
treeb4acaa7dd9393030a0ce081ecc9f20cf343ab101
parent311394248ca539c12b33d396b2944e03cd0d6bfc (diff)
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Add a define to get the cros_ec_dev from device and use it. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
-rw-r--r--drivers/platform/chrome/cros_ec_sysfs.c11
1 files 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 @@
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/uaccess.h> 35#include <linux/uaccess.h>
36 36
37#define to_cros_ec_dev(dev) container_of(dev, struct cros_ec_dev, class_dev)
38
37/* Accessor functions */ 39/* Accessor functions */
38 40
39static ssize_t show_ec_reboot(struct device *dev, 41static ssize_t show_ec_reboot(struct device *dev,
@@ -70,8 +72,7 @@ static ssize_t store_ec_reboot(struct device *dev,
70 int got_cmd = 0, offset = 0; 72 int got_cmd = 0, offset = 0;
71 int i; 73 int i;
72 int ret; 74 int ret;
73 struct cros_ec_dev *ec = container_of(dev, 75 struct cros_ec_dev *ec = to_cros_ec_dev(dev);
74 struct cros_ec_dev, class_dev);
75 76
76 msg = kmalloc(sizeof(*msg) + sizeof(*param), GFP_KERNEL); 77 msg = kmalloc(sizeof(*msg) + sizeof(*param), GFP_KERNEL);
77 if (!msg) 78 if (!msg)
@@ -132,8 +133,7 @@ static ssize_t show_ec_version(struct device *dev,
132 struct cros_ec_command *msg; 133 struct cros_ec_command *msg;
133 int ret; 134 int ret;
134 int count = 0; 135 int count = 0;
135 struct cros_ec_dev *ec = container_of(dev, 136 struct cros_ec_dev *ec = to_cros_ec_dev(dev);
136 struct cros_ec_dev, class_dev);
137 137
138 msg = kmalloc(sizeof(*msg) + EC_HOST_PARAM_SIZE, GFP_KERNEL); 138 msg = kmalloc(sizeof(*msg) + EC_HOST_PARAM_SIZE, GFP_KERNEL);
139 if (!msg) 139 if (!msg)
@@ -231,8 +231,7 @@ static ssize_t show_ec_flashinfo(struct device *dev,
231 struct ec_response_flash_info *resp; 231 struct ec_response_flash_info *resp;
232 struct cros_ec_command *msg; 232 struct cros_ec_command *msg;
233 int ret; 233 int ret;
234 struct cros_ec_dev *ec = container_of(dev, 234 struct cros_ec_dev *ec = to_cros_ec_dev(dev);
235 struct cros_ec_dev, class_dev);
236 235
237 msg = kmalloc(sizeof(*msg) + sizeof(*resp), GFP_KERNEL); 236 msg = kmalloc(sizeof(*msg) + sizeof(*resp), GFP_KERNEL);
238 if (!msg) 237 if (!msg)