mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Tarang Raval <tarang.raval@siliconsignals.io>
Cc: "jai.luthra" <jai.luthra@ideasonboard.com>,
	Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>,
	Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Mehdi Djait <mehdi.djait@linux.intel.com>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 09/15] media: i2c: os05b10: Add H/V flip support
Date: Fri, 20 Nov 2026 10:11:33 +0200	[thread overview]
Message-ID: <awAAtT8qt9RwuCTb@kekkonen.localdomain> (raw)
In-Reply-To: <PN3P287MB18299C133C2D2A56237D85828B782@PN3P287MB1829.INDP287.PROD.OUTLOOK.COM>

Hi Tarang,

On Fri, Nov 20, 2026 at 07:47:58AM +0000, Tarang Raval wrote:
> Hi Sakari,
> 
> Apologies for the delayed reply. I was on leave during the Diwali holidays.
> 
> > On Fri, Oct 30, 2026 at 04:17:58PM +0530, Tarang Raval wrote:
> > > Add HFLIP and VFLIP controls, lock them while streaming, and update
> > > the reported Bayer format based on the flip state.
> > >
> > > Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
> > > ---
> 
> ...
> 
> > > +static u32 os05b10_get_format_code(struct os05b10 *os05b10)
> > > +{
> > > +     static const u32 codes[2][2] = {
> > > +             { MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_SGBRG10_1X10, },
> > > +             { MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SRGGB10_1X10, },
> > > +     };
> > > +
> > > +     return codes[os05b10->vflip->val][os05b10->hflip->val];
> >
> > Note that accessing the control values requires holding the handler's mutex
> > here. That's not the case when called from enum_mbus_code() I think.
> 
> I checked this, and the handler's mutex is held in all three callers.
> 
> The driver sets sd.state_lock = handler.lock before calling
> v4l2_subdev_init_finalize() (this has been there since the initial driver
> patch). With that set, __v4l2_subdev_state_alloc() makes every state
> (active and per-file-handle TRY) use the handler's mutex:
> 
>     if (sd->state_lock)
>             state->lock = sd->state_lock;
> 
> The callers then lock that state:
> 
>  - enum_mbus_code(): subdev_do_ioctl_lock() calls
>    v4l2_subdev_lock_state(state) before subdev_do_ioctl(), which calls
>    the op, and unlocks it afterwards.
>  - init_state(): __v4l2_subdev_state_alloc() calls
>    v4l2_subdev_lock_state(state) around ->init_state().
>  - set_ctrl(): called with the handler's mutex held by the control core.
> 
> So the control values are read under the handler's lock and no extra
> locking is needed in os05b10_get_format_code(). Please let me know if I
> missed a path where the state is not locked.

Ack, thanks for checking!

Can you post a fixup patch to the issue in the second-last patch that I can
squash to it? (I'd just print the frequency in Hz, there's no reason to use
MHz here.)

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2026-11-20  8:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 10:47 [PATCH v5 00/15] media: i2c: os05b10: Refactor driver and Add new features Tarang Raval
2026-10-30 10:47 ` [PATCH v5 01/15] media: i2c: os05b10: drop unused group-hold programming Tarang Raval
2026-10-30 10:47 ` [PATCH v5 02/15] media: i2c: os05b10: Rename vmax variable in VBLANK control Tarang Raval
2026-10-30 10:47 ` [PATCH v5 03/15] media: i2c: os05b10: Update active format before adjusting framing controls Tarang Raval
2026-10-30 10:47 ` [PATCH v5 04/15] media: i2c: os05b10: Enable runtime PM autosuspend Tarang Raval
2026-10-30 10:47 ` [PATCH v5 05/15] media: i2c: os05b10: add register definitions and use them in init table Tarang Raval
2026-10-30 10:47 ` [PATCH v5 06/15] media: i2c: os05b10: split common and mode-specific init registers Tarang Raval
2026-10-30 10:47 ` [PATCH v5 07/15] media: i2c: os05b10: remove unused control fields, simplify error handling Tarang Raval
2026-10-30 11:15   ` Sakari Ailus
2026-10-30 10:47 ` [PATCH v5 08/15] media: i2c: os05b10: add V4L2 digital gain control Tarang Raval
2026-10-30 10:47 ` [PATCH v5 09/15] media: i2c: os05b10: Add H/V flip support Tarang Raval
2026-11-02 12:33   ` Sakari Ailus
2026-11-20  7:47     ` Tarang Raval
2026-11-20  8:11       ` Sakari Ailus [this message]
2026-11-20  8:30         ` Tarang Raval
2026-10-30 10:47 ` [PATCH v5 10/15] media: i2c: os05b10: Add test pattern options Tarang Raval
2026-10-30 10:48 ` [PATCH v5 11/15] media: i2c: os05b10: add 12-bit RAW mode support Tarang Raval
2026-10-30 10:48 ` [PATCH v5 12/15] media: i2c: os05b10: Add 1080p and 2x2 binning 720p modes Tarang Raval
2026-10-30 10:48 ` [PATCH v5 13/15] media: i2c: os05b10: keep exposure default in sync with the active mode on VBLANK changes Tarang Raval
2026-10-30 10:48 ` [PATCH v5 14/15] media: i2c: os05b10: add 2-lane support Tarang Raval
2026-11-04 16:55   ` kernel test robot
2026-10-30 10:48 ` [PATCH v5 15/15] media: i2c: os05b10: fix horizontal blanking calculation Tarang Raval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awAAtT8qt9RwuCTb@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=elgin.perumbilly@siliconsignals.io \
    --cc=himanshu.bhavani@siliconsignals.io \
    --cc=hverkuil+cisco@kernel.org \
    --cc=jai.luthra@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=tarang.raval@siliconsignals.io \
    --cc=vladimir.zapolskiy@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®