Re: [PATCH v6 4/4] media: chips-media: wave5: Improve performance of decoder
From: Nicolas Dufresne
Date: Mon Nov 17 2025 - 08:50:50 EST
Hi,
Le lundi 17 novembre 2025 à 02:07 +0000, jackson.lee a écrit :
> > > } else {
> > > + spin_lock_irqsave(&inst->state_spinlock, flags);
> >
> > Move the locking inside the set_state function.
> >
> > cheers,
> > Nicolas
>
> I think the locking should not be move into the set_state
> function(switch_state).
> Because the send_eos_event, handle_dynamic_resolution_change and
> flag_last_buffer_done already have the lockdep_assert_held(&inst-
> >state_spinlock); inside those function,
> So to concisify the above code, even if the locking is moved into
> switch_statue, the locking should be called again outside.
My suggestion is to try and reduce code redundancy, another method commonly used
is to have a small version of the function that takes the locking, this you can
turn 3 lines into one in many places.
Nicolas
Attachment:
signature.asc
Description: This is a digitally signed message part