diff mbox series

[v8,01/13] squash! max9286: Update the bound_sources mask on unbind

Message ID 20200409121202.11130-2-kieran.bingham+renesas@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series max9286 v8 - modifications | expand

Commit Message

Kieran Bingham April 9, 2020, 12:11 p.m. UTC
The bound_sources bit mask tracks sources which have been successfully
bound through the v4l2 async notifier system.

Ensure that the mask is updated accordingly when unbinding.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
 drivers/media/i2c/max9286.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jacopo Mondi April 9, 2020, 3:20 p.m. UTC | #1
Hi Kieran,

On Thu, Apr 09, 2020 at 01:11:50PM +0100, Kieran Bingham wrote:
> The bound_sources bit mask tracks sources which have been successfully
> bound through the v4l2 async notifier system.
>
> Ensure that the mask is updated accordingly when unbinding.
>

Indeed!

Acked-by: Jacopo Mondi <jacopo@jmondi.org>

Please squash in v8!

Thanks
  j

> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> ---
>  drivers/media/i2c/max9286.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
> index cb58782e5143..b84d2daa6561 100644
> --- a/drivers/media/i2c/max9286.c
> +++ b/drivers/media/i2c/max9286.c
> @@ -493,9 +493,12 @@ static void max9286_notify_unbind(struct v4l2_async_notifier *notifier,
>  				  struct v4l2_subdev *subdev,
>  				  struct v4l2_async_subdev *asd)
>  {
> +	struct max9286_priv *priv = sd_to_max9286(notifier->sd);
>  	struct max9286_source *source = asd_to_max9286_source(asd);
> +	unsigned int index = to_index(priv, source);
>
>  	source->sd = NULL;
> +	priv->bound_sources &= ~BIT(index);
>  }
>
>  static const struct v4l2_async_notifier_operations max9286_notify_ops = {
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index cb58782e5143..b84d2daa6561 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -493,9 +493,12 @@  static void max9286_notify_unbind(struct v4l2_async_notifier *notifier,
 				  struct v4l2_subdev *subdev,
 				  struct v4l2_async_subdev *asd)
 {
+	struct max9286_priv *priv = sd_to_max9286(notifier->sd);
 	struct max9286_source *source = asd_to_max9286_source(asd);
+	unsigned int index = to_index(priv, source);
 
 	source->sd = NULL;
+	priv->bound_sources &= ~BIT(index);
 }
 
 static const struct v4l2_async_notifier_operations max9286_notify_ops = {