Skip to contentSkip to conversation

platform/chrome: lightbar: Optimize command size

PATCH In review Gwendal Grignou 2 participants 2 messages Feb 4 – Feb 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/chrome: lightbar: Optimize command size

Enabling tracing with:
echo 1 > /sys/kernel/debug/tracing/events/cros_ec/cros_ec_request_start/enable

To monitor the command and response size. The defaults are 194 and 128 respectively:
cros_ec_request_start: version: 0, offset: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 194, insize: 128

Reduce the sizes to the expected subcommands.

---
 drivers/platform/chrome/cros_ec_lightbar.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/chrome/cros_ec_lightbar.c +3 -0
index 2d1aa6edda1a..f69f2f6de276 100644
@@ -461,6 +461,8 @@ static ssize_t sequence_store(struct device *dev, struct device_attribute *attr,
 	param = (struct ec_params_lightbar *)msg->data;
 	param->cmd = LIGHTBAR_CMD_SEQ;
 	param->seq.num = num;
+	msg->outsize = offsetof(typeof(*param), seq) + sizeof(param->seq);
+	msg->insize = 0;
 	ret = lb_throttle();
 	if (ret)
 		goto exit;
@@ -516,6 +518,7 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		goto exit;
 	param = (struct ec_params_lightbar *)msg->data;
+	msg->insize = 0;
 
 	if (lb_version < 3) {
 		dev_info(dev, "Copying %zu byte program to EC", count);
Signature · 1 line
2.53.0.rc2.204.g2597b5adb4-goog
maintainer
#1 lore raw
Quoted 9 lines · Gwendal Grignou

Enabling tracing with:
echo 1 > /sys/kernel/debug/tracing/events/cros_ec/cros_ec_request_start/enable

To monitor the command and response size. The defaults are 194 and 128 respectively:
cros_ec_request_start: version: 0, offset: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 194, insize: 128

Reduce the sizes to the expected subcommands.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next

[1/1] platform/chrome: lightbar: Optimize command size

      commit: 286386820d524a76647b8a1de9e4122270da6975

Thanks!