[PATCH] media/atomisp: Use lockdep instead of *mutex_is_locked()
From: Peter Zijlstra
Date: Wed Jul 14 2021 - 06:07:37 EST
On Wed, Jul 14, 2021 at 11:54:58AM +0200, Peter Zijlstra wrote:
> @@ -67,17 +71,6 @@ do { \
> #define DEFINE_RT_MUTEX(mutexname) \
> struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
>
> -/**
> - * rt_mutex_is_locked - is the mutex locked
> - * @lock: the mutex to be queried
> - *
> - * Returns 1 if the mutex is locked, 0 if unlocked.
> - */
> -static inline int rt_mutex_is_locked(struct rt_mutex *lock)
> -{
> - return lock->owner != NULL;
> -}
> -
---
Subject: media/atomisp: Use lockdep instead of *mutex_is_locked()
The only user of rt_mutex_is_locked() is an anti-pattern, remove it.
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 6f5fe5092154..c8a625667e81 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -1904,8 +1904,8 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
dev_dbg(isp->dev, "Stop stream on pad %d for asd%d\n",
atomisp_subdev_source_pad(vdev), asd->index);
- BUG_ON(!rt_mutex_is_locked(&isp->mutex));
- BUG_ON(!mutex_is_locked(&isp->streamoff_mutex));
+ lockdep_assert_held(&isp->mutex);
+ lockdep_assert_held(&isp->streamoff_mutex);
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
dev_dbg(isp->dev, "unsupported v4l2 buf type\n");