commit: d5d34ec3567ffcb11f761f06621499b0b9f16279 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> AuthorDate: Fri Jun 20 12:15:01 2025 +0000 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> CommitDate: Fri Jun 20 12:15:01 2025 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d5d34ec3
media: v4l: subdev: Move out subdev state lock macros outside CONFIG_MEDIA_CONTROLLER Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> 0000_README | 4 + ...-subdev-state-comfig-media-controller-fix.patch | 180 +++++++++++++++++++++ 2 files changed, 184 insertions(+) diff --git a/0000_README b/0000_README index 297e68f5..4b972bde 100644 --- a/0000_README +++ b/0000_README @@ -451,6 +451,10 @@ Patch: 2800_amdgpu-Adj-kmalloc-array-calls-for-new-Walloc-size.patch From: [email protected] Desc: amdgpu: Adjust kmalloc_array calls for new -Walloc-size +Patch: 2810_media-v4l-subdev-state-comfig-media-controller-fix.patch +From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=08e5c36410ca5cb14237e47e6dfe3fde02e0f275 +Desc: media: v4l: subdev: Move out subdev state lock macros outside CONFIG_MEDIA_CONTROLLER + Patch: 2910_bfp-mark-get-entry-ip-as--maybe-unused.patch From: https://www.spinics.net/lists/stable/msg604665.html Desc: bpf: mark get_entry_ip as __maybe_unused diff --git a/2810_media-v4l-subdev-state-comfig-media-controller-fix.patch b/2810_media-v4l-subdev-state-comfig-media-controller-fix.patch new file mode 100644 index 00000000..f9c03b13 --- /dev/null +++ b/2810_media-v4l-subdev-state-comfig-media-controller-fix.patch @@ -0,0 +1,180 @@ +--- a/include/media/v4l2-subdev.h 2025-06-20 08:05:39.760188537 -0400 ++++ b/include/media/v4l2-subdev.h 2025-06-20 08:10:39.163557126 -0400 +@@ -1397,88 +1397,6 @@ int __v4l2_subdev_init_finalize(struct v + */ + void v4l2_subdev_cleanup(struct v4l2_subdev *sd); + +-/** +- * v4l2_subdev_lock_state() - Locks the subdev state +- * @state: The subdevice state +- * +- * Locks the given subdev state. +- * +- * The state must be unlocked with v4l2_subdev_unlock_state() after use. +- */ +-static inline void v4l2_subdev_lock_state(struct v4l2_subdev_state *state) +-{ +- mutex_lock(state->lock); +-} +- +-/** +- * v4l2_subdev_unlock_state() - Unlocks the subdev state +- * @state: The subdevice state +- * +- * Unlocks the given subdev state. +- */ +-static inline void v4l2_subdev_unlock_state(struct v4l2_subdev_state *state) +-{ +- mutex_unlock(state->lock); +-} +- +-/** +- * v4l2_subdev_get_unlocked_active_state() - Checks that the active subdev state +- * is unlocked and returns it +- * @sd: The subdevice +- * +- * Returns the active state for the subdevice, or NULL if the subdev does not +- * support active state. If the state is not NULL, calls +- * lockdep_assert_not_held() to issue a warning if the state is locked. +- * +- * This function is to be used e.g. when getting the active state for the sole +- * purpose of passing it forward, without accessing the state fields. +- */ +-static inline struct v4l2_subdev_state * +-v4l2_subdev_get_unlocked_active_state(struct v4l2_subdev *sd) +-{ +- if (sd->active_state) +- lockdep_assert_not_held(sd->active_state->lock); +- return sd->active_state; +-} +- +-/** +- * v4l2_subdev_get_locked_active_state() - Checks that the active subdev state +- * is locked and returns it +- * +- * @sd: The subdevice +- * +- * Returns the active state for the subdevice, or NULL if the subdev does not +- * support active state. If the state is not NULL, calls lockdep_assert_held() +- * to issue a warning if the state is not locked. +- * +- * This function is to be used when the caller knows that the active state is +- * already locked. +- */ +-static inline struct v4l2_subdev_state * +-v4l2_subdev_get_locked_active_state(struct v4l2_subdev *sd) +-{ +- if (sd->active_state) +- lockdep_assert_held(sd->active_state->lock); +- return sd->active_state; +-} +- +-/** +- * v4l2_subdev_lock_and_get_active_state() - Locks and returns the active subdev +- * state for the subdevice +- * @sd: The subdevice +- * +- * Returns the locked active state for the subdevice, or NULL if the subdev +- * does not support active state. +- * +- * The state must be unlocked with v4l2_subdev_unlock_state() after use. +- */ +-static inline struct v4l2_subdev_state * +-v4l2_subdev_lock_and_get_active_state(struct v4l2_subdev *sd) +-{ +- if (sd->active_state) +- v4l2_subdev_lock_state(sd->active_state); +- return sd->active_state; +-} + + #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) + +@@ -1792,6 +1710,88 @@ int v4l2_subdev_s_stream_helper(struct v + #endif /* CONFIG_MEDIA_CONTROLLER */ + + /** ++ * v4l2_subdev_lock_state() - Locks the subdev state ++ * @state: The subdevice state ++ * ++ * Locks the given subdev state. ++ * ++ * The state must be unlocked with v4l2_subdev_unlock_state() after use. ++ */ ++static inline void v4l2_subdev_lock_state(struct v4l2_subdev_state *state) ++{ ++ mutex_lock(state->lock); ++} ++ ++/** ++ * v4l2_subdev_unlock_state() - Unlocks the subdev state ++ * @state: The subdevice state ++ * ++ * Unlocks the given subdev state. ++ */ ++static inline void v4l2_subdev_unlock_state(struct v4l2_subdev_state *state) ++{ ++ mutex_unlock(state->lock); ++} ++ ++/** ++ * v4l2_subdev_get_unlocked_active_state() - Checks that the active subdev state ++ * is unlocked and returns it ++ * @sd: The subdevice ++ * ++ * Returns the active state for the subdevice, or NULL if the subdev does not ++ * support active state. If the state is not NULL, calls ++ * lockdep_assert_not_held() to issue a warning if the state is locked. ++ * ++ * This function is to be used e.g. when getting the active state for the sole ++ * purpose of passing it forward, without accessing the state fields. ++ */ ++static inline struct v4l2_subdev_state * ++v4l2_subdev_get_unlocked_active_state(struct v4l2_subdev *sd) ++{ ++ if (sd->active_state) ++ lockdep_assert_not_held(sd->active_state->lock); ++ return sd->active_state; ++} ++ ++/** ++ * v4l2_subdev_get_locked_active_state() - Checks that the active subdev state ++ * is locked and returns it ++ * ++ * @sd: The subdevice ++ * ++ * Returns the active state for the subdevice, or NULL if the subdev does not ++ * support active state. If the state is not NULL, calls lockdep_assert_held() ++ * to issue a warning if the state is not locked. ++ * ++ * This function is to be used when the caller knows that the active state is ++ * already locked. ++ */ ++static inline struct v4l2_subdev_state * ++v4l2_subdev_get_locked_active_state(struct v4l2_subdev *sd) ++{ ++ if (sd->active_state) ++ lockdep_assert_held(sd->active_state->lock); ++ return sd->active_state; ++} ++ ++/** ++ * v4l2_subdev_lock_and_get_active_state() - Locks and returns the active subdev ++ * state for the subdevice ++ * @sd: The subdevice ++ * ++ * Returns the locked active state for the subdevice, or NULL if the subdev ++ * does not support active state. ++ * ++ * The state must be unlocked with v4l2_subdev_unlock_state() after use. ++ */ ++static inline struct v4l2_subdev_state * ++v4l2_subdev_lock_and_get_active_state(struct v4l2_subdev *sd) ++{ ++ if (sd->active_state) ++ v4l2_subdev_lock_state(sd->active_state); ++ return sd->active_state; ++} ++/** + * v4l2_subdev_init - initializes the sub-device struct + * + * @sd: pointer to the &struct v4l2_subdev to be initialized
