Skip to content

Commit

Permalink
media: apple: isp: Use a mutex instead of a spinlock for channels
Browse files Browse the repository at this point in the history
Fixes lockdep splats because we do surface stuff with this held, which
takes a mutex.

Signed-off-by: Hector Martin <marcan@marcan.st>
  • Loading branch information
marcan authored and jannau committed Nov 19, 2024
1 parent 6c1725b commit 8b69a4b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/media/platform/apple/isp/isp-drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct isp_channel {
void *virt;
u32 doorbell;
u32 cursor;
spinlock_t lock;
struct mutex lock;
struct isp_message req;
struct isp_message rsp;
const struct isp_chan_ops *ops;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/platform/apple/isp/isp-fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ static int isp_fill_channel_info(struct apple_isp *isp)
chan->virt =
apple_isp_ipc_translate(isp, desc.iova, chan->size);
chan->cursor = 0;
spin_lock_init(&chan->lock);
mutex_init(&chan->lock);

if (!chan->virt) {
dev_err(isp->dev, "Failed to find channel buffer\n");
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/platform/apple/isp/isp-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int ipc_chan_handle(struct apple_isp *isp, struct isp_channel *chan)
{
int err = 0;

spin_lock(&chan->lock);
mutex_lock(&chan->lock);
while (1) {
chan_read_msg(isp, chan, &chan->req);
if (chan_rx_done(isp, chan)) {
Expand All @@ -150,7 +150,7 @@ int ipc_chan_handle(struct apple_isp *isp, struct isp_channel *chan)
break;
}
}
spin_unlock(&chan->lock);
mutex_unlock(&chan->lock);

return err;
}
Expand Down

0 comments on commit 8b69a4b

Please sign in to comment.