From 91c10f14f99c22b0a8efc0a23d102c35e31785f9 Mon Sep 17 00:00:00 2001 From: Stephan Linz Date: Sun, 5 Jan 2025 09:34:08 +0100 Subject: [PATCH] drivers: mipi-dbi-spi: rename underscored macro names Rename _XFR_.*BITS and _WRITE_ONLY_ABSENT according to MISRA-C standard rules 21.1 and 21.2 (Zephyr rules 121 and 122). For details see Zephyr coding guidelines in table "Main rules". Signed-off-by: Stephan Linz --- drivers/mipi_dbi/mipi_dbi_spi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/mipi_dbi/mipi_dbi_spi.c b/drivers/mipi_dbi/mipi_dbi_spi.c index e57d3b3965fc29..85cba935dff3b2 100644 --- a/drivers/mipi_dbi/mipi_dbi_spi.c +++ b/drivers/mipi_dbi/mipi_dbi_spi.c @@ -33,26 +33,28 @@ struct mipi_dbi_spi_data { }; /* Expands to 1 if the node does not have the `write-only` property */ -#define _WRITE_ONLY_ABSENT(n) (!DT_INST_PROP(n, write_only)) | +#define MIPI_DBI_SPI_WRITE_ONLY_ABSENT(n) (!DT_INST_PROP(n, write_only)) | /* This macro will evaluate to 1 if any of the nodes with zephyr,mipi-dbi-spi * lack a `write-only` property. The intention here is to allow the entire * command_read function to be optimized out when it is not needed. */ -#define MIPI_DBI_SPI_READ_REQUIRED DT_INST_FOREACH_STATUS_OKAY(_WRITE_ONLY_ABSENT) 0 +#define MIPI_DBI_SPI_READ_REQUIRED DT_INST_FOREACH_STATUS_OKAY(MIPI_DBI_SPI_WRITE_ONLY_ABSENT) 0 uint32_t var = MIPI_DBI_SPI_READ_REQUIRED; /* Expands to 1 if the node does reflect the enum in `xfr-min-bits` property */ -#define _XFR_8BITS(n) (DT_INST_STRING_UPPER_TOKEN(n, xfr_min_bits) == MIPI_DBI_SPI_XFR_8BIT) | -#define _XFR_16BITS(n) (DT_INST_STRING_UPPER_TOKEN(n, xfr_min_bits) == MIPI_DBI_SPI_XFR_16BIT) | +#define MIPI_DBI_SPI_XFR_8BITS(n) (DT_INST_STRING_UPPER_TOKEN(n, xfr_min_bits) \ + == MIPI_DBI_SPI_XFR_8BIT) | +#define MIPI_DBI_SPI_XFR_16BITS(n) (DT_INST_STRING_UPPER_TOKEN(n, xfr_min_bits) \ + == MIPI_DBI_SPI_XFR_16BIT) | /* This macros will evaluate to 1 if any of the nodes with zephyr,mipi-dbi-spi * have the `xfr-min-bits` property to corresponding enum value. The intention * here is to allow the write helper functions to be optimized out when not all * minimum transfer bits will be needed. */ -#define MIPI_DBI_SPI_WRITE_8BIT_REQUIRED DT_INST_FOREACH_STATUS_OKAY(_XFR_8BITS) 0 -#define MIPI_DBI_SPI_WRITE_16BIT_REQUIRED DT_INST_FOREACH_STATUS_OKAY(_XFR_16BITS) 0 +#define MIPI_DBI_SPI_WRITE_8BIT_REQUIRED DT_INST_FOREACH_STATUS_OKAY(MIPI_DBI_SPI_XFR_8BITS) 0 +#define MIPI_DBI_SPI_WRITE_16BIT_REQUIRED DT_INST_FOREACH_STATUS_OKAY(MIPI_DBI_SPI_XFR_16BITS) 0 /* In Type C mode 1 MIPI BIT communication, the 9th bit of the word * (first bit sent in each word) indicates if the word is a command or