From e02e53227271e79824ae4b9dceaa9cc43d9c5471 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Fri, 2 May 2025 00:32:45 +0700 Subject: [PATCH] drivers: sensor: shell_stream: align `struct shell *` name to `sh` Aligned the `struct shell *` argument name from `shell_ptr` to `sh` for consistency with other drivers' usage of `sh`, and to match the `shell_cmd_handler` argument name. Signed-off-by: Pisit Sawangvonganan --- drivers/sensor/sensor_shell.h | 2 +- drivers/sensor/sensor_shell_stream.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/sensor/sensor_shell.h b/drivers/sensor/sensor_shell.h index cfc8b2489db..049b0ac101e 100644 --- a/drivers/sensor/sensor_shell.h +++ b/drivers/sensor/sensor_shell.h @@ -19,7 +19,7 @@ struct sensor_shell_processing_context { extern struct rtio sensor_read_rtio; -int cmd_sensor_stream(const struct shell *shell_ptr, size_t argc, char *argv[]); +int cmd_sensor_stream(const struct shell *sh, size_t argc, char *argv[]); void sensor_shell_processing_callback(int result, uint8_t *buf, uint32_t buf_len, void *userdata); diff --git a/drivers/sensor/sensor_shell_stream.c b/drivers/sensor/sensor_shell_stream.c index ab3b835aa10..e4a7e68cfb1 100644 --- a/drivers/sensor/sensor_shell_stream.c +++ b/drivers/sensor/sensor_shell_stream.c @@ -38,24 +38,24 @@ static void sensor_shell_processing_entry_point(void *a, void *b, void *c) K_THREAD_DEFINE(sensor_shell_processing_tid, CONFIG_SENSOR_SHELL_THREAD_STACK_SIZE, sensor_shell_processing_entry_point, NULL, NULL, NULL, 0, 0, 0); -int cmd_sensor_stream(const struct shell *shell_ptr, size_t argc, char *argv[]) +int cmd_sensor_stream(const struct shell *sh, size_t argc, char *argv[]) { static struct rtio_sqe *current_streaming_handle; static struct sensor_shell_processing_context ctx; const struct device *dev = device_get_binding(argv[1]); if (argc != 5 && argc != 3) { - shell_error(shell_ptr, "Wrong number of arguments (%zu)", argc); + shell_error(sh, "Wrong number of arguments (%zu)", argc); return -EINVAL; } if (dev == NULL) { - shell_error(shell_ptr, "Device unknown (%s)", argv[1]); + shell_error(sh, "Device unknown (%s)", argv[1]); return -ENODEV; } if (current_streaming_handle != NULL) { - shell_info(shell_ptr, "Disabling existing stream"); + shell_info(sh, "Disabling existing stream"); rtio_sqe_cancel(current_streaming_handle); } @@ -64,7 +64,7 @@ int cmd_sensor_stream(const struct shell *shell_ptr, size_t argc, char *argv[]) } if (strcmp("on", argv[2]) != 0) { - shell_error(shell_ptr, "Unknown streaming operation (%s)", argv[2]); + shell_error(sh, "Unknown streaming operation (%s)", argv[2]); return -EINVAL; } @@ -91,7 +91,7 @@ int cmd_sensor_stream(const struct shell *shell_ptr, size_t argc, char *argv[]) } else if (strcmp("tap", argv[3]) == 0) { iodev_sensor_shell_trigger.trigger = SENSOR_TRIG_TAP; } else { - shell_error(shell_ptr, "Invalid trigger (%s)", argv[3]); + shell_error(sh, "Invalid trigger (%s)", argv[3]); return -EINVAL; } @@ -102,23 +102,23 @@ int cmd_sensor_stream(const struct shell *shell_ptr, size_t argc, char *argv[]) } else if (strcmp("nop", argv[4]) == 0) { iodev_sensor_shell_trigger.opt = SENSOR_STREAM_DATA_NOP; } else { - shell_error(shell_ptr, "Unknown trigger op (%s)", argv[4]); + shell_error(sh, "Unknown trigger op (%s)", argv[4]); return -EINVAL; } - shell_print(shell_ptr, "Enabling stream..."); + shell_print(sh, "Enabling stream..."); iodev_sensor_shell_stream_config.sensor = dev; iodev_sensor_shell_stream_config.count = 1; ctx.dev = dev; - ctx.sh = shell_ptr; + ctx.sh = sh; int rc = sensor_stream(&iodev_sensor_shell_stream, &sensor_read_rtio, &ctx, ¤t_streaming_handle); if (rc != 0) { - shell_error(shell_ptr, "Failed to start stream"); + shell_error(sh, "Failed to start stream"); } return rc; }