On Tue, Jul 4, 2023 at 6:52 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > On 7/4/23 17:27, Andy Shevchenko wrote: > > On Tue, Jul 04, 2023 at 04:07:43PM +0100, Dan Scally wrote: > >> On 30/06/2023 13:06, Hans de Goede wrote: ... > >>> + strscpy(work->board_info.type, fwnode_get_name(vcm_fwnode), > >>> + I2C_NAME_SIZE); > >>> + /* Strip "-<link>" postfix */ > >>> + sep = strchrnul(work->board_info.type, '-'); > >>> + *sep = 0; > >> > >> I think strreplace(work->board_info.type, '-', '\0') here would be cleaner, > >> and either way probably we need #include <linux/string.h> for the str* funcs > >> here > > > > What we need is something like strcut(str, '<$CHAR>'). > > > > But related to the above code we can (besides using sizeof() instead > > of I2C_NAME_SIZE): > > > > snprintf(work->board_info.type, sizeof(work->board_info.type), > > "%pfwP", vcm_fwnode); > > "%pfwP" ? what on earth does that do ? Prints fwnode name (as you opencoded with strscpy() + fwnode_get_name() above). -- With Best Regards, Andy Shevchenko