On 07.07.23 12:56, Niklas Schnelle wrote: [...] > Instead of expanding the use of the clients_lock further add a separate > array in struct ism_dev which references clients subscribed to the > device's events and IRQs. This array is protected by ism->lock which is > already taken in ism_handle_irq() and can be taken outside the IRQ > handler when adding/removing subscribers or the accessing typo? s/the accessing/accessing the/g > ism->sba_client_arr[]. This also means that the clients_lock is no > longer taken in IRQ context. > [...] > @@ -554,6 +577,7 @@ static void ism_dev_add_work_func(struct work_struct *work) > add_work); > > client->add(client->tgt_ism); > + ism_setup_forwarding(client, client->tgt_ism); > atomic_dec(&client->tgt_ism->add_dev_cnt); > wake_up(&client->tgt_ism->waitq); > } > @@ -691,7 +715,11 @@ static void ism_dev_remove_work_func(struct work_struct *work) > { > struct ism_client *client = container_of(work, struct ism_client, > remove_work); > + unsigned long flags; > > + spin_lock_irqsave(&client->tgt_ism->lock, flags); > + client->tgt_ism->subs[client->id] = NULL; > + spin_unlock_irqrestore(&client->tgt_ism->lock, flags); > client->remove(client->tgt_ism); > atomic_dec(&client->tgt_ism->free_clients_cnt); > wake_up(&client->tgt_ism->waitq); I am not sure I like the new split. here you fix ism_dev_add_work_func() and ism_dev_remove_work_func(), that you remove in the next patch. But looks functionally ok to me. Reviewed-by: Alexandra Winter <wintera@xxxxxxxxxxxxx>