From 431f6cce118d22c98a65d20e9b512ecc31fc1c8e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 28 Oct 2025 14:58:57 +0100 Subject: firmware: scmi: Fix up code comments Fix multiple instances of copy-paste errors. Fill in missing headers for CLOCK_GET_PERMISSIONS message and response. Signed-off-by: Marek Vasut Reviewed-by: Alice Guo Signed-off-by: Peng Fan --- include/scmi_protocols.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h index bb74a57f79a..bcd8e671149 100644 --- a/include/scmi_protocols.h +++ b/include/scmi_protocols.h @@ -399,7 +399,7 @@ int scmi_generic_protocol_version(struct udevice *dev, int scmi_base_protocol_version(struct udevice *dev, u32 *version); /** - * scmi_protocol_attrs - get protocol attributes + * scmi_base_protocol_attrs - get protocol attributes * @dev: SCMI protocol device * @num_agents: Number of SCMI agents * @num_protocols: Number of SCMI protocols @@ -414,7 +414,7 @@ int scmi_base_protocol_attrs(struct udevice *dev, u32 *num_agents, u32 *num_protocols); /** - * scmi_protocol_message_attrs - get message-specific attributes + * scmi_base_protocol_message_attrs - get message-specific attributes * @dev: SCMI protocol device * @message_id: SCMI message ID * @attributes: Message-specific attributes @@ -754,7 +754,7 @@ enum scmi_clock_message_id { #define SCMI_CLOCK_NAME_LENGTH_MAX 16 /** - * struct scmi_clk_get_nb_out - Response for SCMI_PROTOCOL_ATTRIBUTES command + * struct scmi_clk_protocol_attr_out - Response for SCMI_PROTOCOL_ATTRIBUTES command * @status: SCMI command status * @attributes: Attributes of the clock protocol, mainly number of clocks exposed */ @@ -772,7 +772,7 @@ struct scmi_clk_attribute_in { }; /** - * struct scmi_clk_get_nb_out - Response payload for SCMI_CLOCK_ATTRIBUTES command + * struct scmi_clk_attribute_out - Response payload for SCMI_CLOCK_ATTRIBUTES command * @status: SCMI command status * @attributes: clock attributes * @clock_name: name of the clock @@ -785,7 +785,7 @@ struct scmi_clk_attribute_out { }; /** - * struct scmi_clk_get_nb_out_v2 - Response payload for SCMI_CLOCK_ATTRIBUTES command + * struct scmi_clk_attribute_out_v2 - Response payload for SCMI_CLOCK_ATTRIBUTES command * Clock management Protocol 2.0 * @status: SCMI command status * @attributes: clock attributes @@ -818,7 +818,7 @@ struct scmi_clk_state_out { }; /** - * struct scmi_clk_state_in - Message payload for CLOCK_RATE_GET command + * struct scmi_clk_rate_get_in - Message payload for CLOCK_RATE_GET command * @clock_id: SCMI clock ID * @attributes: Attributes of the targets clock state */ @@ -839,7 +839,7 @@ struct scmi_clk_rate_get_out { }; /** - * struct scmi_clk_state_in - Message payload for CLOCK_RATE_SET command + * struct scmi_clk_rate_set_in - Message payload for CLOCK_RATE_SET command * @flags: Flags for the clock rate set request * @clock_id: SCMI clock ID * @rate_lsb: 32bit LSB of the clock rate in Hertz @@ -861,7 +861,7 @@ struct scmi_clk_rate_set_out { }; /** - * struct scmi_clk_parent_state_in - Message payload for CLOCK_PARENT_SET command + * struct scmi_clk_parent_set_in - Message payload for CLOCK_PARENT_SET command * @clock_id: SCMI clock ID * @parent_clk: SCMI clock ID */ @@ -879,6 +879,7 @@ struct scmi_clk_parent_set_out { }; /** + * struct scmi_clk_get_permissions_in - Message payload for CLOCK_GET_PERMISSIONS command * @clock_id: Identifier for the clock device. */ struct scmi_clk_get_permissions_in { @@ -886,6 +887,7 @@ struct scmi_clk_get_permissions_in { }; /** + * struct scmi_clk_get_permissions_out - Response payload for CLOCK_GET_PERMISSIONS command * @status: Negative 32-bit integers are used to return error status codes. * @permissions: Bit[31] Clock state control, Bit[30] Clock parent control, * Bit[29] Clock rate control, Bits[28:0] Reserved, must be zero. @@ -1082,7 +1084,7 @@ struct scmi_pin_config { }; /** - * struct scmi_pad_config_set_in - Message payload for PAD_CONFIG_SET command + * struct scmi_pinctrl_config_set_in - Message payload for PAD_CONFIG_SET command * @identifier: Identifier for the pin or group. * @function_id: Identifier for the function selected to be enabled * for the selected pin or group. This field is set to -- cgit v1.3.1 From 0619cb32030b1d78379f3181d3e1103bb86124fb Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Wed, 5 Nov 2025 04:42:26 +0100 Subject: firmware: scmi: Add clock v3.2 CONFIG_SET support SCMI v3.2 introduces a new clock CONFIG_SET message format that can optionally carry also OEM specific configuration values beside the usual clock enable/disable requests. Add support to use such new format when talking to a v3.2 compliant SCMI platform. Support existing enable/disable operations across different clock protocol versions: this patch still does not add protocol operations to support the new OEM specific optional configuration capabilities. No functional change for the SCMI drivers users of the related enable and disable clock operations. [Marek: Remodel after Linux e49e314a2cf7 ("firmware: arm_scmi: Add clock v3.2 CONFIG_SET support") Support both old < 2.1 and new >= 2.1 protocol versions. Update commit message based on Linux one] Signed-off-by: Vinh Nguyen Signed-off-by: Marek Vasut Reviewed-by: Alice Guo Signed-off-by: Peng Fan --- arch/arm/mach-imx/imx9/scmi/clock_scmi.c | 2 +- drivers/clk/clk_scmi.c | 23 ++++++++++++++++++----- drivers/firmware/scmi/sandbox-scmi_agent.c | 4 ++-- include/scmi_protocols.h | 17 +++++++++++++++-- 4 files changed, 36 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-imx/imx9/scmi/clock_scmi.c b/arch/arm/mach-imx/imx9/scmi/clock_scmi.c index b6be20ec674..9030dbf600d 100644 --- a/arch/arm/mach-imx/imx9/scmi/clock_scmi.c +++ b/arch/arm/mach-imx/imx9/scmi/clock_scmi.c @@ -10,7 +10,7 @@ int imx_clk_scmi_enable(u32 clock_id, bool enable) { - struct scmi_clk_state_in in = { + struct scmi_clk_state_in_v1 in = { .clock_id = clock_id, .attributes = !!enable, }; diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c index a7d89f32cd7..54378b4e1ec 100644 --- a/drivers/clk/clk_scmi.c +++ b/drivers/clk/clk_scmi.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -134,17 +135,28 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name, static int scmi_clk_gate(struct clk *clk, int enable) { - struct scmi_clk_state_in in = { + struct scmi_clock_priv *priv = dev_get_parent_priv(clk->dev); + struct scmi_clk_state_in_v1 in_v1 = { + .clock_id = clk_get_id(clk), + .attributes = enable, + }; + /* Valid only from SCMI clock v2.1 */ + struct scmi_clk_state_in_v2 in_v2 = { .clock_id = clk_get_id(clk), .attributes = enable, }; struct scmi_clk_state_out out; - struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK, - SCMI_CLOCK_CONFIG_SET, - in, out); + struct scmi_msg msg_v1 = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK, + SCMI_CLOCK_CONFIG_SET, + in_v1, out); + struct scmi_msg msg_v2 = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK, + SCMI_CLOCK_CONFIG_SET, + in_v2, out); int ret; - ret = devm_scmi_process_msg(clk->dev, &msg); + ret = devm_scmi_process_msg(clk->dev, + (priv->version < CLOCK_PROTOCOL_VERSION_2_1) ? + &msg_v1 : &msg_v2); if (ret) return ret; @@ -319,6 +331,7 @@ static int scmi_clk_probe(struct udevice *dev) } dev_clk_dm(dev, i, &clk_scmi->clk); + dev_set_parent_priv(clk_scmi->clk.dev, priv); if (CLK_HAS_RESTRICTIONS(attributes)) { u32 perm; diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c index 74a87832dcb..5b242a039c2 100644 --- a/drivers/firmware/scmi/sandbox-scmi_agent.c +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c @@ -828,7 +828,7 @@ static int sandbox_scmi_clock_rate_get(struct udevice *dev, static int sandbox_scmi_clock_gate(struct udevice *dev, struct scmi_msg *msg) { - struct scmi_clk_state_in *in = NULL; + struct scmi_clk_state_in_v1 *in = NULL; struct scmi_clk_state_out *out = NULL; struct sandbox_scmi_clk *clk_state = NULL; @@ -836,7 +836,7 @@ static int sandbox_scmi_clock_gate(struct udevice *dev, struct scmi_msg *msg) !msg->out_msg || msg->out_msg_sz < sizeof(*out)) return -EINVAL; - in = (struct scmi_clk_state_in *)msg->in_msg; + in = (struct scmi_clk_state_in_v1 *)msg->in_msg; out = (struct scmi_clk_state_out *)msg->out_msg; clk_state = get_scmi_clk_state(in->clock_id); diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h index bcd8e671149..ecab021b472 100644 --- a/include/scmi_protocols.h +++ b/include/scmi_protocols.h @@ -733,6 +733,7 @@ int scmi_pwd_name_get(struct udevice *dev, u32 domain_id, u8 **name); /* * SCMI Clock Protocol */ +#define CLOCK_PROTOCOL_VERSION_2_1 0x20001 #define CLOCK_PROTOCOL_VERSION_3_0 0x30000 enum scmi_clock_message_id { @@ -800,15 +801,27 @@ struct scmi_clk_attribute_out_v2 { }; /** - * struct scmi_clk_state_in - Message payload for CLOCK_CONFIG_SET command + * struct scmi_clk_state_in_v1 - Message payload for CLOCK_CONFIG_SET command for protocol < 2.1 * @clock_id: SCMI clock ID * @attributes: Attributes of the targets clock state */ -struct scmi_clk_state_in { +struct scmi_clk_state_in_v1 { u32 clock_id; u32 attributes; }; +/** + * struct scmi_clk_state_in_v2 - Message payload for CLOCK_CONFIG_SET command for protocol >= 2.1 + * @clock_id: SCMI clock ID + * @attributes: Attributes of the targets clock state + * @extended_config_val: Extended and OEM specific configuration + */ +struct scmi_clk_state_in_v2 { + u32 clock_id; + u32 attributes; + u32 extended_config_val; +}; + /** * struct scmi_clk_state_out - Response payload for CLOCK_CONFIG_SET command * @status: SCMI command status -- cgit v1.3.1 From 307b0f03b97f021cc635f031aab98ae72a7e5a45 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 9 Nov 2025 08:05:21 +0100 Subject: dm: typo programmaticaly %s/programmaticaly/programmatically/ Signed-off-by: Heinrich Schuchardt Reviewed-by: Bin Meng --- include/dm/root.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/dm/root.h b/include/dm/root.h index 286bd9a2ddd..61a61e1ce46 100644 --- a/include/dm/root.h +++ b/include/dm/root.h @@ -114,7 +114,7 @@ int dm_extended_scan(bool pre_reloc_only); * * Some devices may not be visible to Driver Model. This weak function can * be provided by boards which wish to create their own devices - * programmaticaly. They should do this by calling device_bind() on each + * programmatically. They should do this by calling device_bind() on each * device. * * @pre_reloc_only: If true, bind only nodes with special devicetree properties, -- cgit v1.3.1 From 8b984b5a397bc5fe829ca95e64f990c1e287beaa Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 3 Nov 2025 23:59:17 +0800 Subject: mtd: spinand: add support for FudanMicro FM25S01A Add support for FudanMicro FM25S01A SPI NAND. This driver is ported from linux v6.18 and tested on a MT7981 board. Link: https://lore.kernel.org/linux-mtd/20250824170013.3328777-1-cnsztl@gmail.com/ Reviewed-by: Mikhail Kshevetskiy Signed-off-by: Tianling Shen --- drivers/mtd/nand/spi/Makefile | 2 +- drivers/mtd/nand/spi/core.c | 1 + drivers/mtd/nand/spi/fmsh.c | 76 +++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/spinand.h | 1 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/spi/fmsh.c (limited to 'include') diff --git a/drivers/mtd/nand/spi/Makefile b/drivers/mtd/nand/spi/Makefile index 152aa1a3783..a7a0b2cb4b9 100644 --- a/drivers/mtd/nand/spi/Makefile +++ b/drivers/mtd/nand/spi/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 spinand-objs := core.o otp.o -spinand-objs += alliancememory.o ato.o esmt.o foresee.o gigadevice.o macronix.o +spinand-objs += alliancememory.o ato.o esmt.o fmsh.o foresee.o gigadevice.o macronix.o spinand-objs += micron.o paragon.o skyhigh.o toshiba.o winbond.o xtx.o obj-$(CONFIG_MTD_SPI_NAND) += spinand.o diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 0c435059546..14af4264612 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -1227,6 +1227,7 @@ static const struct spinand_manufacturer *spinand_manufacturers[] = { &alliancememory_spinand_manufacturer, &ato_spinand_manufacturer, &esmt_c8_spinand_manufacturer, + &fmsh_spinand_manufacturer, &foresee_spinand_manufacturer, &gigadevice_spinand_manufacturer, ¯onix_spinand_manufacturer, diff --git a/drivers/mtd/nand/spi/fmsh.c b/drivers/mtd/nand/spi/fmsh.c new file mode 100644 index 00000000000..80837b7dd42 --- /dev/null +++ b/drivers/mtd/nand/spi/fmsh.c @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2020-2021 Rockchip Electronics Co., Ltd. + * + * Author: Dingqiang Lin + */ + +#ifndef __UBOOT__ +#include +#include +#endif +#include + +#define SPINAND_MFR_FMSH 0xA1 + +static SPINAND_OP_VARIANTS(read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0, 0), + SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0, 0), + SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0, 0)); + +static SPINAND_OP_VARIANTS(write_cache_variants, + SPINAND_PROG_LOAD_1S_1S_4S_OP(true, 0, NULL, 0), + SPINAND_PROG_LOAD_1S_1S_1S_OP(true, 0, NULL, 0)); + +static SPINAND_OP_VARIANTS(update_cache_variants, + SPINAND_PROG_LOAD_1S_1S_4S_OP(false, 0, NULL, 0), + SPINAND_PROG_LOAD_1S_1S_1S_OP(false, 0, NULL, 0)); + +static int fm25s01a_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + return -ERANGE; +} + +static int fm25s01a_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + if (section) + return -ERANGE; + + region->offset = 2; + region->length = 62; + + return 0; +} + +static const struct mtd_ooblayout_ops fm25s01a_ooblayout = { + .ecc = fm25s01a_ooblayout_ecc, + .rfree = fm25s01a_ooblayout_free, +}; + +static const struct spinand_info fmsh_spinand_table[] = { + SPINAND_INFO("FM25S01A", + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4), + NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), + NAND_ECCREQ(1, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&fm25s01a_ooblayout, NULL)), +}; + +static const struct spinand_manufacturer_ops fmsh_spinand_manuf_ops = { +}; + +const struct spinand_manufacturer fmsh_spinand_manufacturer = { + .id = SPINAND_MFR_FMSH, + .name = "Fudan Micro", + .chips = fmsh_spinand_table, + .nchips = ARRAY_SIZE(fmsh_spinand_table), + .ops = &fmsh_spinand_manuf_ops, +}; diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index cf9b9656d05..e9561c0a395 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -361,6 +361,7 @@ struct spinand_manufacturer { extern const struct spinand_manufacturer alliancememory_spinand_manufacturer; extern const struct spinand_manufacturer ato_spinand_manufacturer; extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer; +extern const struct spinand_manufacturer fmsh_spinand_manufacturer; extern const struct spinand_manufacturer foresee_spinand_manufacturer; extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; extern const struct spinand_manufacturer macronix_spinand_manufacturer; -- cgit v1.3.1 From 2d226a735e0e9df2c017259c72cfd569986db480 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 6 Nov 2025 17:28:38 -0600 Subject: smbios: Fix warning when building with clang When building with clang, we see warnings such as: error: field max_size within 'struct smbios_type7' is less aligned than 'union cache_size_word' and is usually due to 'struct smbios_type7' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] when building drivers/sysinfo/smbios.c. Resolve this error by packing the unions as well after verifying they are complete (16 or 32 bits). Reviewed-by: Raymond Mao Reviewed-by: Ilias Apalodimas Signed-off-by: Tom Rini --- include/smbios.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/smbios.h b/include/smbios.h index b5fed57aba2..f2f7483bce5 100644 --- a/include/smbios.h +++ b/include/smbios.h @@ -204,7 +204,7 @@ struct __packed smbios_type4 { char eos[SMBIOS_STRUCT_EOS_BYTES]; }; -union cache_config { +union __packed cache_config { struct { u16 level:3; u16 bsocketed:1; @@ -217,7 +217,7 @@ union cache_config { u16 data; }; -union cache_size_word { +union __packed cache_size_word { struct { u16 size:15; u16 granu:1; @@ -225,7 +225,7 @@ union cache_size_word { u16 data; }; -union cache_size_dword { +union __packed cache_size_dword { struct { u32 size:31; u32 granu:1; @@ -233,7 +233,7 @@ union cache_size_dword { u32 data; }; -union cache_sram_type { +union __packed cache_sram_type { struct { u16 other:1; u16 unknown:1; -- cgit v1.3.1 From 8d18eac76d35b873da326a5ea9b3d73a30cde230 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 18 Nov 2025 21:17:31 +0100 Subject: test: document ut.h Add missing Sphinx comments in include/test/ut.h Reviewed-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- include/test/ut.h | 159 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 132 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/include/test/ut.h b/include/test/ut.h index be5502e03a1..6510c35997f 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -130,18 +130,28 @@ int ut_check_console_end(struct unit_test_state *uts); * * This only supports a byte dump. * - * @total_bytes: Size of the expected dump in bytes` - * Return: 0 if OK (looks like a dump and the length matches), other value on - * error + * @uts: Test state + * @total_bytes: Size of the expected dump in bytes + * Return: 0 if OK (looks like a dump and the length matches), + * other value on error */ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); -/* Report a failure, with printf() string */ +/** + * ut_report() - Report a failure, with printf() string + * + * @fmt: format string + * @args: arguments to be printed + */ #define ut_reportf(fmt, args...) \ ut_failf(uts, __FILE__, __LINE__, __func__, "report", \ fmt, ##args) -/* Assert that a condition is non-zero */ +/** + * ut_assert() - Assert that a condition is true (not 0) + * + * @cond: condition + */ #define ut_assert(cond) ({ \ int __ret = 0; \ \ @@ -152,7 +162,13 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that a condition is non-zero, with printf() string */ +/** + * ut_assertf() - Assert that a condition is true with printf string + * + * @cond: condition + * @fmt: format string + * @args: arguments to be printed + */ #define ut_assertf(cond, fmt, args...) ({ \ int __ret = 0; \ \ @@ -164,7 +180,12 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that two int expressions are equal */ +/** + * ut_asserteq() - Assert that two int32 expressions are equal + * + * @expr1: expected value + * @expr2: actual value + */ #define ut_asserteq(expr1, expr2) ({ \ unsigned int _val1 = (expr1), _val2 = (expr2); \ int __ret = 0; \ @@ -179,7 +200,12 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that two 64 int expressions are equal */ +/** + * ut_asserteq_64() - Assert that two int64 expressions are equal + * + * @expr1: expected value + * @expr2: actual value + */ #define ut_asserteq_64(expr1, expr2) ({ \ u64 _val1 = (expr1), _val2 = (expr2); \ int __ret = 0; \ @@ -197,7 +223,12 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that two string expressions are equal */ +/** + * ut_asserteq_str() - Assert that two string expressions are equal + * + * @expr1: expected value + * @expr2: actual value + */ #define ut_asserteq_str(expr1, expr2) ({ \ const char *_val1 = (expr1), *_val2 = (expr2); \ int __ret = 0; \ @@ -211,9 +242,12 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* - * Assert that two string expressions are equal, up to length of the - * first +/** + * ut_asserteq_strn() - Assert that two string expressions are equal + * up to the length of the first expression + * + * @expr1: expected value + * @expr2: actual value */ #define ut_asserteq_strn(expr1, expr2) ({ \ const char *_val1 = (expr1), *_val2 = (expr2); \ @@ -230,7 +264,13 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that two memory areas are equal */ +/** + * ut_asserteq_mem() - Assert that two memory areas are equal + * + * @expr1: expected value + * @expr2: actual value + * @len: length of the memory areas + */ #define ut_asserteq_mem(expr1, expr2, len) ({ \ const u8 *_val1 = (u8 *)(expr1), *_val2 = (u8 *)(expr2); \ const uint __len = len; \ @@ -250,7 +290,12 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that two pointers are equal */ +/** + * ut_asserteq_ptr() - Assert that two string pointers are equal + * + * @expr1: expected value + * @expr2: actual value + */ #define ut_asserteq_ptr(expr1, expr2) ({ \ const void *_val1 = (expr1), *_val2 = (expr2); \ int __ret = 0; \ @@ -264,7 +309,13 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that two addresses (converted from pointers) are equal */ +/** + * ut_asserteq_addr() - Assert that two addresses (converted from pointers) + * are equal + * + * @expr1: expected value + * @expr2: actual value + */ #define ut_asserteq_addr(expr1, expr2) ({ \ ulong _val1 = map_to_sysmem(expr1); \ ulong _val2 = map_to_sysmem(expr2); \ @@ -279,7 +330,11 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that a pointer is NULL */ +/** + * ut_assertnull() - Assert that a pointer is NULL + * + * @expr: pointer + */ #define ut_assertnull(expr) ({ \ const void *_val = (expr); \ int __ret = 0; \ @@ -293,7 +348,11 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that a pointer is not NULL */ +/** + * ut_assertnonnull() - Assert that a pointer is not NULL + * + * @expr: pointer + */ #define ut_assertnonnull(expr) ({ \ const void *_val = (expr); \ int __ret = 0; \ @@ -307,7 +366,11 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that a pointer is not an error pointer */ +/** + * ut_assertok_ptr() - Assert that a pointer is not an error pointer + * + * @expr: pointer + */ #define ut_assertok_ptr(expr) ({ \ const void *_val = (expr); \ int __ret = 0; \ @@ -322,10 +385,19 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that an operation succeeds (returns 0) */ +/** + * ut_assertok() - Assert that an operation succeeds (returns 0) + * + * @cond: expression + */ #define ut_assertok(cond) ut_asserteq(0, cond) -/* Assert that the next console output line matches */ +/** + * ut_assert_nextline() - Assert that the next console output line matches + * + * @fmt: format string + * @args: print arguments + */ #define ut_assert_nextline(fmt, args...) ({ \ int __ret = 0; \ \ @@ -338,7 +410,13 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that the next console output line matches up to the length */ +/** + * ut_assert_nextlinen() - Assert that the next console output line matches + * up to the length of the expected string. + * + * @fmt: format string + * @args: print arguments + */ #define ut_assert_nextlinen(fmt, args...) ({ \ int __ret = 0; \ \ @@ -351,7 +429,10 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that there is a 'next' console output line, and skip it */ +/** + * ut_assert_skipline() - Assert that there is a 'next' console output line, + * and skip it + */ #define ut_assert_skipline() ({ \ int __ret = 0; \ \ @@ -363,7 +444,13 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that a following console output line matches */ +/** + * ut_assert_skip_to_line() - Assert that a following console output line + * matches + * + * @fmt: format string + * @args: print arguments + */ #define ut_assert_skip_to_line(fmt, args...) ({ \ int __ret = 0; \ \ @@ -376,7 +463,13 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that a following console output line matches */ +/** + * ut_assert_skip_to_linen() - Assert that a following console output line + * matches up to the length of the expected string + * + * @fmt: format string + * @args: print arguments + */ #define ut_assert_skip_to_linen(fmt, args...) ({ \ int __ret = 0; \ \ @@ -389,7 +482,9 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that there is no more console output */ +/** + * ut_assert_console_end() - Assert that there is no more console output + */ #define ut_assert_console_end() ({ \ int __ret = 0; \ \ @@ -402,7 +497,12 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that the next lines are print_buffer() dump at an address */ +/** + * ut_assert_nextlines_are_dump - Assert that the next lines are print_buffer() + * dump at an address + * + * @total_bytes: Size of the expected dump in bytes + */ #define ut_assert_nextlines_are_dump(total_bytes) ({ \ int __ret = 0; \ \ @@ -416,7 +516,10 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); __ret; \ }) -/* Assert that the next console output line is empty */ +/** + * ut_assert_nextline_empty() - Assert that the next console output line is + * empty + */ #define ut_assert_nextline_empty() \ ut_assert_nextline("%s", "") @@ -451,6 +554,8 @@ void ut_silence_console(struct unit_test_state *uts); * * This restarts console output again and turns off console recording. This * happens on all boards, including sandbox. + * + * @uts: Test state */ void ut_unsilence_console(struct unit_test_state *uts); -- cgit v1.3.1