On Wed, Nov 22, 2023 at 06:29:44PM +0100, Ahmad Fatoum wrote: > Upcoming sync of SCMI with the kernel will start using IDR API, which we > lack in barebox, so let's retrofit it. > > Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> > --- > v1 -> v2: > - factor out longer IDR functions into separate source file > instead of header > - add IDR Kconfig symbol > - fix implementation of idr_remove, idr_destory, idr_for_each_entry > - keep IDR sorted There's a bug in this patch. With this one applied my Rock3a fails with: SCMI DRIVER - Requesting SCMI device (clocks) for protocol 0x14 SCMI DRIVER - Requesting SCMI device (regulator) for protocol 0x17 scmi_protocol_device_request: id_table: 0x0000000000000018 scmi_protocol_device_request: name: 0x00786f6265726162 DABT (current EL) exception (ESR 0x96000004) at 0x00786f6265726162 elr: 000000007fd6b8c8 lr : 000000007fd6c3a0 x0 : 00786f6265726162 x1 : 00786f6265726161 x2 : 00786f6265726162 x3 : 00000000ffffffff x4 : 00000000ffffffff x5 : 0000000000000000 x6 : 00000000ffffffd8 x7 : 000000007fff7a52 x8 : 000000007fff7e48 x9 : 0000000000000020 x10: 0000000000000000 x11: 0000000000000011 x12: 0000000000000010 x13: 000000007fdb34fa x14: 0000000000000000 x15: 0000000000000007 x16: 000000007fff77b8 x17: 0000000000000007 x18: 000000007fff7e80 x19: 000000007fff7a3e x20: 00000000ffffffff x21: 00786f6265726162 x22: 000000007fff7e3a x23: 0000000000000000 x24: 000000007fd90dbd x25: 000000007fff7a20 x26: 000000007fff7e80 x27: 000000007fff7e3a x28: 000000007fff7e80 x29: 000000007fff7910 Call trace: [<7fd6b8c8>] (strnlen+0x10/0x28) from [<7fd6ca90>] (vsnprintf+0x440/0x71c) [<7fd6ca90>] (vsnprintf+0x440/0x71c) from [<7fd01198>] (printf+0x6c/0x90) [<7fd01198>] (printf+0x6c/0x90) from [<7fd5dabc>] (scmi_protocol_device_request+0x154/0x320) [<7fd5dabc>] (scmi_protocol_device_request+0x154/0x320) from [<7fd5ca38>] (scmi_driver_register+0x34/0x84) [<7fd5ca38>] (scmi_driver_register+0x34/0x84) from [<7fd59920>] (scmi_drv_register+0x14/0x1c) [<7fd59920>] (scmi_drv_register+0x14/0x1c) from [<7fd01a2c>] (start_barebox+0x60/0x8c) [<7fd01a2c>] (start_barebox+0x60/0x8c) from [<7fd8e71c>] (barebox_non_pbl_start+0x11c/0x150) [<7fd8e71c>] (barebox_non_pbl_start+0x11c/0x150) from [<7fd0000c>] (__bare_init_start+0x0/0x4) [<7fd0000c>] (__bare_init_start+0x0/0x4) from [<00a01b3c>] (0xa01b3c) [<00a01b3c>] (0xa01b3c) from [<00a014ec>] (0xa014ec) The above was printed with these printfs added to scmi_protocol_device_request(): list_for_each_entry(rdev, head, node) { printf("%s: id_table: 0x%p\n", rdev->id_table); printf("%s: name: 0x%p\n", rdev->id_table_name); if (!strcmp(rdev->id_table->name, id_table->name)) { ... Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |