Commit 667eeb11 authored by Gerard Marull-Paretas's avatar Gerard Marull-Paretas Committed by Carles Cufi
Browse files

shell: fix MISRA 5.7 violations on `struct shell`



MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: default avatarGerard Marull-Paretas <gerard.marull@nordicsemi.no>
parent c7c8ea6a
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ Abstract code for this task would look like this:

.. code-block:: c

	static int gain_cmd_handler(const struct shell *shell,
	static int gain_cmd_handler(const struct shell *sh,
				    size_t argc, char **argv, void *data)
	{
		int gain;
@@ -172,7 +172,7 @@ Abstract code for this task would look like this:
		gain = (int)data;
		adc_set_gain(gain);

		shell_print(shell, "ADC gain set to: %s\n"
		shell_print(sh, "ADC gain set to: %s\n"
				   "Value send to ADC driver: %d",
				   argv[0],
				   gain);
@@ -332,7 +332,7 @@ Simple command handler implementation:

.. code-block:: c

	static int cmd_handler(const struct shell *shell, size_t argc,
	static int cmd_handler(const struct shell *sh, size_t argc,
				char **argv)
	{
		ARG_UNUSED(argc);
@@ -340,11 +340,11 @@ Simple command handler implementation:

		shell_fprintf(shell, SHELL_INFO, "Print info message\n");

		shell_print(shell, "Print simple text.");
		shell_print(sh, "Print simple text.");

		shell_warn(shell, "Print warning text.");
		shell_warn(sh, "Print warning text.");

		shell_error(shell, "Print error text.");
		shell_error(sh, "Print error text.");

		return 0;
	}
@@ -379,7 +379,7 @@ commands or the parent commands, depending on how you index ``argv``.

.. code-block:: c

	static int cmd_handler(const struct shell *shell, size_t argc,
	static int cmd_handler(const struct shell *sh, size_t argc,
			       char **argv)
	{
		ARG_UNUSED(argc);
@@ -387,14 +387,14 @@ commands or the parent commands, depending on how you index ``argv``.
		/* If it is a subcommand handler parent command syntax
		 * can be found using argv[-1].
		 */
		shell_print(shell, "This command has a parent command: %s",
		shell_print(sh, "This command has a parent command: %s",
			      argv[-1]);

		/* Print this command syntax */
		shell_print(shell, "This command syntax is: %s", argv[0]);
		shell_print(sh, "This command syntax is: %s", argv[0]);

		/* Print first argument */
		shell_print(shell, "%s", argv[1]);
		shell_print(sh, "%s", argv[1]);

		return 0;
	}
@@ -665,24 +665,24 @@ The following code shows a simple use case of this library:

	}

	static int cmd_demo_ping(const struct shell *shell, size_t argc,
	static int cmd_demo_ping(const struct shell *sh, size_t argc,
				 char **argv)
	{
		ARG_UNUSED(argc);
		ARG_UNUSED(argv);

		shell_print(shell, "pong");
		shell_print(sh, "pong");
		return 0;
	}

	static int cmd_demo_params(const struct shell *shell, size_t argc,
	static int cmd_demo_params(const struct shell *sh, size_t argc,
				   char **argv)
	{
		int cnt;

		shell_print(shell, "argc = %d", argc);
		shell_print(sh, "argc = %d", argc);
		for (cnt = 0; cnt < argc; cnt++) {
			shell_print(shell, "  argv[%d] = %s", cnt, argv[cnt]);
			shell_print(sh, "  argv[%d] = %s", cnt, argv[cnt]);
		}
		return 0;
	}
+24 −24
Original line number Diff line number Diff line
@@ -124,19 +124,19 @@ static struct adc_hdl *get_adc(const char *device_label)
	return NULL;
}

static int cmd_adc_ch_id(const struct shell *shell, size_t argc, char **argv)
static int cmd_adc_ch_id(const struct shell *sh, size_t argc, char **argv)
{
	/* -2: index of ADC label name */
	struct adc_hdl *adc = get_adc(argv[-2]);
	int retval = 0;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

	if (isdigit((unsigned char)argv[1][0]) == 0) {
		shell_error(shell, "<channel> must be digits");
		shell_error(sh, "<channel> must be digits");
		return -EINVAL;
	}

@@ -147,7 +147,7 @@ static int cmd_adc_ch_id(const struct shell *shell, size_t argc, char **argv)
	return retval;
}

static int cmd_adc_ch_neg(const struct shell *shell, size_t argc, char **argv)
static int cmd_adc_ch_neg(const struct shell *sh, size_t argc, char **argv)
{
#if CONFIG_ADC_CONFIGURABLE_INPUTS
	/* -2: index of ADC label name */
@@ -155,12 +155,12 @@ static int cmd_adc_ch_neg(const struct shell *shell, size_t argc, char **argv)
	int retval = 0;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

	if (isdigit((unsigned char)argv[1][0]) == 0) {
		shell_error(shell, "<negative input> must be digits");
		shell_error(sh, "<negative input> must be digits");
		return -EINVAL;
	}

@@ -174,7 +174,7 @@ static int cmd_adc_ch_neg(const struct shell *shell, size_t argc, char **argv)
#endif
}

static int cmd_adc_ch_pos(const struct shell *shell, size_t argc, char **argv)
static int cmd_adc_ch_pos(const struct shell *sh, size_t argc, char **argv)
{
#if CONFIG_ADC_CONFIGURABLE_INPUTS
	/* -2: index of ADC label name */
@@ -182,12 +182,12 @@ static int cmd_adc_ch_pos(const struct shell *shell, size_t argc, char **argv)
	int retval = 0;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

	if (isdigit((unsigned char)argv[1][0]) == 0) {
		shell_error(shell, "<positive input> must be digits");
		shell_error(sh, "<positive input> must be digits");
		return -EINVAL;
	}

@@ -201,7 +201,7 @@ static int cmd_adc_ch_pos(const struct shell *shell, size_t argc, char **argv)
#endif
}

static int cmd_adc_gain(const struct shell *shell, size_t argc, char **argv,
static int cmd_adc_gain(const struct shell *sh, size_t argc, char **argv,
			void *data)
{
	/* -2: index of ADC label name */
@@ -210,7 +210,7 @@ static int cmd_adc_gain(const struct shell *shell, size_t argc, char **argv,
	int retval = -EINVAL;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

@@ -225,7 +225,7 @@ static int cmd_adc_gain(const struct shell *shell, size_t argc, char **argv,
	return retval;
}

static int cmd_adc_acq(const struct shell *shell, size_t argc, char **argv)
static int cmd_adc_acq(const struct shell *sh, size_t argc, char **argv)
{
	/* -1 index of ADC label name */
	struct adc_hdl *adc = get_adc(argv[-1]);
@@ -233,12 +233,12 @@ static int cmd_adc_acq(const struct shell *shell, size_t argc, char **argv)
	int retval;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

	if (isdigit((unsigned char)argv[1][0]) == 0) {
		shell_error(shell, "<time> must be digits");
		shell_error(sh, "<time> must be digits");
		return -EINVAL;
	}

@@ -261,19 +261,19 @@ static int cmd_adc_acq(const struct shell *shell, size_t argc, char **argv)

	return retval;
}
static int cmd_adc_reso(const struct shell *shell, size_t argc, char **argv)
static int cmd_adc_reso(const struct shell *sh, size_t argc, char **argv)
{
	/* -1 index of ADC label name */
	struct adc_hdl *adc = get_adc(argv[-1]);
	int retval;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

	if (isdigit((unsigned char)argv[1][0]) == 0) {
		shell_error(shell, "<resolution> must be digits");
		shell_error(sh, "<resolution> must be digits");
		return -EINVAL;
	}

@@ -283,7 +283,7 @@ static int cmd_adc_reso(const struct shell *shell, size_t argc, char **argv)
	return retval;
}

static int cmd_adc_ref(const struct shell *shell, size_t argc, char **argv,
static int cmd_adc_ref(const struct shell *sh, size_t argc, char **argv,
		       void *data)
{
	/* -2 index of ADC label name */
@@ -292,7 +292,7 @@ static int cmd_adc_ref(const struct shell *shell, size_t argc, char **argv,
	int retval = -EINVAL;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

@@ -309,7 +309,7 @@ static int cmd_adc_ref(const struct shell *shell, size_t argc, char **argv,
}

#define BUFFER_SIZE 1
static int cmd_adc_read(const struct shell *shell, size_t argc, char **argv)
static int cmd_adc_read(const struct shell *sh, size_t argc, char **argv)
{
	uint8_t adc_channel_id = strtol(argv[1], NULL, 10);
	/* -1 index of adc label name */
@@ -318,7 +318,7 @@ static int cmd_adc_read(const struct shell *shell, size_t argc, char **argv)
	int retval;

	if (!device_is_ready(adc->dev)) {
		shell_error(shell, "ADC device not ready");
		shell_error(sh, "ADC device not ready");
		return -ENODEV;
	}

@@ -332,18 +332,18 @@ static int cmd_adc_read(const struct shell *shell, size_t argc, char **argv)

	retval = adc_read(adc->dev, &sequence);
	if (retval >= 0) {
		shell_print(shell, "read: %i", m_sample_buffer[0]);
		shell_print(sh, "read: %i", m_sample_buffer[0]);
	}

	return retval;
}

static int cmd_adc_print(const struct shell *shell, size_t argc, char **argv)
static int cmd_adc_print(const struct shell *sh, size_t argc, char **argv)
{
	/* -1 index of ADC label name */
	struct adc_hdl *adc = get_adc(argv[-1]);

	shell_print(shell, "%s:\n"
	shell_print(sh, "%s:\n"
			   "Gain: %s\n"
			   "Reference: %s\n"
			   "Acquisition Time: %u\n"
+7 −7
Original line number Diff line number Diff line
@@ -735,7 +735,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(clock), clk_init, NULL,
		 PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
		 &clock_control_api);

static int cmd_status(const struct shell *shell, size_t argc, char **argv)
static int cmd_status(const struct shell *sh, size_t argc, char **argv)
{
	nrf_clock_hfclk_t hfclk_src;
	bool hf_status;
@@ -757,15 +757,15 @@ static int cmd_status(const struct shell *shell, size_t argc, char **argv)
	abs_stop = hf_stop_tstamp;
	irq_unlock(key);

	shell_print(shell, "HF clock:");
	shell_print(shell, "\t- %srunning (users: %u)",
	shell_print(sh, "HF clock:");
	shell_print(sh, "\t- %srunning (users: %u)",
			hf_status ? "" : "not ", hf_mgr->refs);
	shell_print(shell, "\t- last start: %u ms (%u ms ago)",
	shell_print(sh, "\t- last start: %u ms (%u ms ago)",
			(uint32_t)abs_start, (uint32_t)(now - abs_start));
	shell_print(shell, "\t- last stop: %u ms (%u ms ago)",
	shell_print(sh, "\t- last stop: %u ms (%u ms ago)",
			(uint32_t)abs_stop, (uint32_t)(now - abs_stop));
	shell_print(shell, "LF clock:");
	shell_print(shell, "\t- %srunning (users: %u)",
	shell_print(sh, "LF clock:");
	shell_print(sh, "\t- %srunning (users: %u)",
			lf_status ? "" : "not ", lf_mgr->refs);

	return 0;
+6 −6
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ static const struct args_index args_indx = {
	.resolution = 3,
};

static int cmd_setup(const struct shell *shell, size_t argc, char **argv)
static int cmd_setup(const struct shell *sh, size_t argc, char **argv)
{
	struct dac_channel_cfg cfg;
	const struct device *dac;
@@ -35,7 +35,7 @@ static int cmd_setup(const struct shell *shell, size_t argc, char **argv)

	dac = device_get_binding(argv[args_indx.device]);
	if (!dac) {
		shell_error(shell, "DAC device not found");
		shell_error(sh, "DAC device not found");
		return -EINVAL;
	}

@@ -44,14 +44,14 @@ static int cmd_setup(const struct shell *shell, size_t argc, char **argv)

	err = dac_channel_setup(dac, &cfg);
	if (err) {
		shell_error(shell, "Failed to setup DAC channel (err %d)", err);
		shell_error(sh, "Failed to setup DAC channel (err %d)", err);
		return err;
	}

	return 0;
}

static int cmd_write_value(const struct shell *shell, size_t argc, char **argv)
static int cmd_write_value(const struct shell *sh, size_t argc, char **argv)
{
	const struct device *dac;
	uint8_t channel;
@@ -60,7 +60,7 @@ static int cmd_write_value(const struct shell *shell, size_t argc, char **argv)

	dac = device_get_binding(argv[args_indx.device]);
	if (!dac) {
		shell_error(shell, "DAC device not found");
		shell_error(sh, "DAC device not found");
		return -EINVAL;
	}

@@ -69,7 +69,7 @@ static int cmd_write_value(const struct shell *shell, size_t argc, char **argv)

	err = dac_write_value(dac, channel, value);
	if (err) {
		shell_error(shell, "Failed to write DAC value (err %d)", err);
		shell_error(sh, "Failed to write DAC value (err %d)", err);
		return err;
	}

+57 −57
Original line number Diff line number Diff line
@@ -35,23 +35,23 @@
 * devmem [width [value]]       Physical memory read / write
 */

static void decode_ecc_error(const struct shell *shell, uint64_t ecc_error)
static void decode_ecc_error(const struct shell *sh, uint64_t ecc_error)
{
	uint64_t erradd = ECC_ERROR_ERRADD(ecc_error);
	unsigned long errsynd = ECC_ERROR_ERRSYND(ecc_error);

	shell_fprintf(shell, SHELL_NORMAL,
	shell_fprintf(sh, SHELL_NORMAL,
		      "CMI Error address: 0x%llx\n", erradd);
	shell_fprintf(shell, SHELL_NORMAL,
	shell_fprintf(sh, SHELL_NORMAL,
		      "Error Syndrome: 0x%lx\n", errsynd);

	if (ecc_error & ECC_ERROR_MERRSTS) {
		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Uncorrectable Error (UE)\n");
	}

	if (ecc_error & ECC_ERROR_CERRSTS) {
		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Correctable Error (CE)\n");
	}
}
@@ -92,30 +92,30 @@ static int parity_error_show(const struct shell *sh, const struct device *dev)
	return 0;
}

static int cmd_edac_info(const struct shell *shell, size_t argc, char **argv)
static int cmd_edac_info(const struct shell *sh, size_t argc, char **argv)
{
	const struct device *dev;
	int err;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	shell_fprintf(shell, SHELL_NORMAL, "Show EDAC status\n");
	shell_fprintf(sh, SHELL_NORMAL, "Show EDAC status\n");

	err = ecc_error_show(shell, dev);
	err = ecc_error_show(sh, dev);
	if (err != 0) {
		return err;
	}

	err = parity_error_show(shell, dev);
	err = parity_error_show(sh, dev);
	if (err != 0) {
		return err;
	}

	shell_fprintf(shell, SHELL_NORMAL,
	shell_fprintf(sh, SHELL_NORMAL,
		      "Errors correctable: %d Errors uncorrectable %d\n",
		      edac_errors_cor_get(dev), edac_errors_uc_get(dev));

@@ -123,20 +123,20 @@ static int cmd_edac_info(const struct shell *shell, size_t argc, char **argv)
}

#if defined(CONFIG_EDAC_ERROR_INJECT)
static int cmd_inject_addr(const struct shell *shell, size_t argc, char **argv)
static int cmd_inject_addr(const struct shell *sh, size_t argc, char **argv)
{
	const struct device *dev;
	int err;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	if (argc > 2) {
		/* Usage */
		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Usage: edac inject %s [addr]\n", argv[0]);
		return -ENOTSUP;
	}
@@ -146,22 +146,22 @@ static int cmd_inject_addr(const struct shell *shell, size_t argc, char **argv)

		err = edac_inject_get_param1(dev, &addr);
		if (err != 0) {
			shell_error(shell, "Error getting address (err %d)",
			shell_error(sh, "Error getting address (err %d)",
				    err);
			return err;
		}

		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Injection address base: 0x%llx\n", addr);
	} else {
		unsigned long value = strtoul(argv[1], NULL, 16);

		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Set injection address base to: %s\n", argv[1]);

		err = edac_inject_set_param1(dev, value);
		if (err != 0) {
			shell_error(shell, "Error setting address (err %d)",
			shell_error(sh, "Error setting address (err %d)",
				    err);
			return err;
		}
@@ -170,20 +170,20 @@ static int cmd_inject_addr(const struct shell *shell, size_t argc, char **argv)
	return err;
}

static int cmd_inject_mask(const struct shell *shell, size_t argc, char **argv)
static int cmd_inject_mask(const struct shell *sh, size_t argc, char **argv)
{
	const struct device *dev;
	int err;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	if (argc > 2) {
		/* Usage */
		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Usage: edac inject %s [mask]\n", argv[0]);
		return -ENOTSUP;
	}
@@ -193,21 +193,21 @@ static int cmd_inject_mask(const struct shell *shell, size_t argc, char **argv)

		err = edac_inject_get_param2(dev, &mask);
		if (err != 0) {
			shell_error(shell, "Error getting mask (err %d)", err);
			shell_error(sh, "Error getting mask (err %d)", err);
			return err;
		}

		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Injection address mask: 0x%llx\n", mask);
	} else {
		uint64_t value = strtoul(argv[1], NULL, 16);

		shell_fprintf(shell, SHELL_NORMAL,
		shell_fprintf(sh, SHELL_NORMAL,
			      "Set injection address mask to %llx\n", value);

		err = edac_inject_set_param2(dev, value);
		if (err != 0) {
			shell_error(shell, "Error setting mask (err %d)", err);
			shell_error(sh, "Error setting mask (err %d)", err);
			return err;
		}
	}
@@ -215,25 +215,25 @@ static int cmd_inject_mask(const struct shell *shell, size_t argc, char **argv)
	return err;
}

static int cmd_inject_trigger(const struct shell *shell, size_t argc,
static int cmd_inject_trigger(const struct shell *sh, size_t argc,
			      char **argv)
{
	const struct device *dev;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	shell_fprintf(shell, SHELL_NORMAL, "Triggering injection\n");
	shell_fprintf(sh, SHELL_NORMAL, "Triggering injection\n");

	edac_inject_error_trigger(dev);

	return 0;
}

static int cmd_inject_disable_nmi(const struct shell *shell, size_t argc,
static int cmd_inject_disable_nmi(const struct shell *sh, size_t argc,
				  char **argv)
{
	sys_out8((sys_in8(0x70) | 0x80), 0x70);
@@ -241,7 +241,7 @@ static int cmd_inject_disable_nmi(const struct shell *shell, size_t argc,
	return 0;
}

static int cmd_inject_enable_nmi(const struct shell *shell, size_t argc,
static int cmd_inject_enable_nmi(const struct shell *sh, size_t argc,
				 char **argv)
{
	sys_out8((sys_in8(0x70) & 0x7F), 0x70);
@@ -261,7 +261,7 @@ static const char *get_error_type(uint32_t type)
	}
}

static int cmd_inject_error_type_show(const struct shell *shell, size_t argc,
static int cmd_inject_error_type_show(const struct shell *sh, size_t argc,
				      char **argv)
{
	const struct device *dev;
@@ -270,57 +270,57 @@ static int cmd_inject_error_type_show(const struct shell *shell, size_t argc,

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	err = edac_inject_get_error_type(dev, &error_type);
	if (err != 0) {
		shell_error(shell, "Error getting error type (err %d)", err);
		shell_error(sh, "Error getting error type (err %d)", err);
		return err;
	}

	shell_fprintf(shell, SHELL_NORMAL, "Injection error type: %s\n",
	shell_fprintf(sh, SHELL_NORMAL, "Injection error type: %s\n",
		      get_error_type(error_type));

	return err;
}

static int set_error_type(const struct shell *shell, uint32_t error_type)
static int set_error_type(const struct shell *sh, uint32_t error_type)
{
	const struct device *dev;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	shell_fprintf(shell, SHELL_NORMAL, "Set injection error type: %s\n",
	shell_fprintf(sh, SHELL_NORMAL, "Set injection error type: %s\n",
		      get_error_type(error_type));

	return edac_inject_set_error_type(dev, error_type);
}

static int cmd_inject_error_type_cor(const struct shell *shell, size_t argc,
static int cmd_inject_error_type_cor(const struct shell *sh, size_t argc,
				     char **argv)
{
	return set_error_type(shell, EDAC_ERROR_TYPE_DRAM_COR);
	return set_error_type(sh, EDAC_ERROR_TYPE_DRAM_COR);
}

static int cmd_inject_error_type_uc(const struct shell *shell, size_t argc,
static int cmd_inject_error_type_uc(const struct shell *sh, size_t argc,
				    char **argv)
{
	return set_error_type(shell, EDAC_ERROR_TYPE_DRAM_UC);
	return set_error_type(sh, EDAC_ERROR_TYPE_DRAM_UC);
}

static int cmd_inject_test(const struct shell *shell, size_t argc, char **argv)
static int cmd_inject_test(const struct shell *sh, size_t argc, char **argv)
{
	const struct device *dev;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

@@ -357,21 +357,21 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_inject_cmds,
);
#endif /* CONFIG_EDAC_ERROR_INJECT */

static int cmd_ecc_error_show(const struct shell *shell, size_t argc,
static int cmd_ecc_error_show(const struct shell *sh, size_t argc,
			      char **argv)
{
	const struct device *dev;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	return ecc_error_show(shell, dev);
	return ecc_error_show(sh, dev);
}

static int cmd_ecc_error_clear(const struct shell *shell, size_t argc,
static int cmd_ecc_error_clear(const struct shell *sh, size_t argc,
			       char **argv)
{
	const struct device *dev;
@@ -379,18 +379,18 @@ static int cmd_ecc_error_clear(const struct shell *shell, size_t argc,

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	err = edac_ecc_error_log_clear(dev);
	if (err != 0) {
		shell_error(shell, "Error clear ecc error log (err %d)",
		shell_error(sh, "Error clear ecc error log (err %d)",
			    err);
		return err;
	}

	shell_fprintf(shell, SHELL_NORMAL, "ECC Error Log cleared\n");
	shell_fprintf(sh, SHELL_NORMAL, "ECC Error Log cleared\n");

	return 0;
}
@@ -401,21 +401,21 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_ecc_error_cmds,
	SHELL_SUBCMD_SET_END /* Array terminated */
);

static int cmd_parity_error_show(const struct shell *shell, size_t argc,
static int cmd_parity_error_show(const struct shell *sh, size_t argc,
				 char **argv)
{
	const struct device *dev;

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	return parity_error_show(shell, dev);
	return parity_error_show(sh, dev);
}

static int cmd_parity_error_clear(const struct shell *shell, size_t argc,
static int cmd_parity_error_clear(const struct shell *sh, size_t argc,
				  char **argv)
{
	const struct device *dev;
@@ -423,18 +423,18 @@ static int cmd_parity_error_clear(const struct shell *shell, size_t argc,

	dev = DEVICE_DT_GET(DT_NODELABEL(ibecc));
	if (!device_is_ready(dev)) {
		shell_error(shell, "IBECC device not ready");
		shell_error(sh, "IBECC device not ready");
		return -ENODEV;
	}

	err = edac_parity_error_log_clear(dev);
	if (err != 0) {
		shell_error(shell, "Error clear parity error log (err %d)",
		shell_error(sh, "Error clear parity error log (err %d)",
			    err);
		return err;
	}

	shell_fprintf(shell, SHELL_NORMAL, "Parity Error Log cleared\n");
	shell_fprintf(sh, SHELL_NORMAL, "Parity Error Log cleared\n");

	return 0;
}
Loading