Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 93afebbe authored by Enric Balletbo i Serra's avatar Enric Balletbo i Serra Committed by Benson Leung
Browse files

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: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarBenson Leung <bleung@chromium.org>
parent 31139424
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -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)