On Mon, May 13, 2024 at 06:54:25PM +0300, Ilpo Järvinen wrote: > On Mon, 13 May 2024, Andy Shevchenko wrote: > > On Mon, May 13, 2024 at 05:33:10PM +0200, Hans de Goede wrote: > > > On 5/13/24 5:19 PM, Andy Shevchenko wrote: > > > > On Mon, May 13, 2024 at 03:18:10PM +0200, Hans de Goede wrote: > > > >> On 5/13/24 2:58 PM, Andy Shevchenko wrote: > > > >>> On Mon, May 13, 2024 at 01:15:50PM +0200, Hans de Goede wrote: > > > > > >>>> +static int dell_uart_bl_command(struct dell_uart_backlight *dell_bl, > > > >>>> + const u8 *cmd, int cmd_len, > > > >>>> + u8 *resp, int resp_max_len) > > > >>>> +{ > > > >>>> + int ret; > > > >>>> + > > > >>>> + ret = mutex_lock_killable(&dell_bl->mutex); > > > >>> > > > >>> Can't be called via cleanup.h? > > > >> > > > >> I prefer to have the locking explicit rather then use cleanup.h . > > > > > > > > Hmm... interesting, so you push-back the cleanup.h usage? > > > > > > I'm in favor of the guard(mutex)(&smne_mutex); syntax, but this > > > is a mutex_lock_killable() for which that does not work AFAIK. > > > > > > So in this case AFAICT we would need to use the cleanup stuff manually > > > and in that case I believe that in that case just sticking with > > > the current code is better. > > > > There is scoped_cond_guard(). > > But there is no DEFINE_GUARD_COND() for mutex_lock_killable(). > > Is there a way to return the original error code with scoped_cond_guard() > or does that it force overriding the original return value with a > hard-coded one provided by the caller which seems a step backwards? Yeah, that's also a downside. Perhaps you can reply to the original thread about this. But it seems it was developed for boolean type of functions w/o thinking a lot about returned values. -- With Best Regards, Andy Shevchenko