lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240917-scoped-state-v1-0-b8ba3fbe5952@ideasonboard.com>
Date: Tue, 17 Sep 2024 17:09:28 +0300
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>, 
 Niklas Söderlund <niklas.soderlund@...natech.se>, 
 Hans Verkuil <hverkuil-cisco@...all.nl>, 
 Sakari Ailus <sakari.ailus@...ux.intel.com>, 
 Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org, 
 linux-renesas-soc@...r.kernel.org, 
 Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
Subject: [PATCH 0/4] media: v4l2-subdev: Add cleanup macros for active
 state

Add cleanup macros for the subdev active state. While we could add more
macros to handle state locking in different situations, I believe the
two macros introduced here are the ones most often needed.

A few drivers are changed to use the macros, as an example.

A few thoughts:

The scoped_v4l2_subdev_lock_and_get_active_state() macro will define an
implicitly named 'state' variable inside the scope. This is a bit
similar to scoped_guard(), which defined an implicitly named 'scope'
variable. However, adding the name of the variable as a parameter to the
macro is an easy addition, if needed. Then the usage would be:

    scoped_v4l2_subdev_lock_and_get_active_state(subdev, state) {
    }

Using the CLASS() version does take the name of the variable. The two
macros also look quite different, so I wonder if we should make a helper
macro to hide the CLASS() usage (I don't know what to call it...):

    #define init_v4l2_subdev_lock_and_get_active_state(sd) \
         CLASS(v4l2_subdev_lock_and_get_active_state, state)(sd)

The macro names are quite long, but so is the function name of
'v4l2_subdev_lock_and_get_active_state', which these macros often
replace.

 Tomi

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
---
Tomi Valkeinen (4):
      media: v4l2-subdev: Add cleanup macros for active state
      media: v4l2-subdev: Use state cleanup macros
      media: renesas: Use state cleanup macros
      media: i2c: ds90ub9xx: Use state cleanup macros

 drivers/media/i2c/ds90ub913.c                      | 11 +++------
 drivers/media/i2c/ds90ub953.c                      | 11 +++------
 drivers/media/i2c/ds90ub960.c                      | 27 +++++++---------------
 drivers/media/platform/renesas/rcar-csi2.c         | 14 ++++-------
 .../media/platform/renesas/rzg2l-cru/rzg2l-csi2.c  |  9 ++++----
 .../media/platform/renesas/rzg2l-cru/rzg2l-ip.c    |  9 ++------
 drivers/media/v4l2-core/v4l2-subdev.c              | 14 +++--------
 include/media/v4l2-subdev.h                        | 10 ++++++++
 8 files changed, 37 insertions(+), 68 deletions(-)
---
base-commit: 98f7e32f20d28ec452afb208f9cffc08448a2652
change-id: 20240917-scoped-state-a995cc0dba33

Best regards,
-- 
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ