linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: i2c: max9286: Remove unneeded mutex for get_fmt and set_fmt
@ 2021-07-08  9:55 Niklas Söderlund
  2021-07-19 12:10 ` Jacopo Mondi
  0 siblings, 1 reply; 5+ messages in thread
From: Niklas Söderlund @ 2021-07-08  9:55 UTC (permalink / raw)
  To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart, linux-media
  Cc: linux-renesas-soc, Niklas Söderlund

There is no need to protect 'cfg_fmt' in get_fmt() and set_fmt() as the
core protects these callbacks. As this is the only usage of the mutex it
can be removed.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/i2c/max9286.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 1aa2c58fd38c5d2b..b1d11a50d6e53ecc 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -18,7 +18,6 @@
 #include <linux/i2c.h>
 #include <linux/i2c-mux.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
 #include <linux/of_graph.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
@@ -173,9 +172,6 @@ struct max9286_priv {
 
 	struct v4l2_mbus_framefmt fmt[MAX9286_N_SINKS];
 
-	/* Protects controls and fmt structures */
-	struct mutex mutex;
-
 	unsigned int nsources;
 	unsigned int source_mask;
 	unsigned int route_mask;
@@ -768,9 +764,7 @@ static int max9286_set_fmt(struct v4l2_subdev *sd,
 	if (!cfg_fmt)
 		return -EINVAL;
 
-	mutex_lock(&priv->mutex);
 	*cfg_fmt = format->format;
-	mutex_unlock(&priv->mutex);
 
 	return 0;
 }
@@ -796,9 +790,7 @@ static int max9286_get_fmt(struct v4l2_subdev *sd,
 	if (!cfg_fmt)
 		return -EINVAL;
 
-	mutex_lock(&priv->mutex);
 	format->format = *cfg_fmt;
-	mutex_unlock(&priv->mutex);
 
 	return 0;
 }
@@ -1259,8 +1251,6 @@ static int max9286_probe(struct i2c_client *client)
 	if (!priv)
 		return -ENOMEM;
 
-	mutex_init(&priv->mutex);
-
 	priv->client = client;
 	i2c_set_clientdata(client, priv);
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-19 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08  9:55 [PATCH] media: i2c: max9286: Remove unneeded mutex for get_fmt and set_fmt Niklas Söderlund
2021-07-19 12:10 ` Jacopo Mondi
2021-07-19 12:26   ` Niklas Söderlund
2021-07-19 13:15     ` Laurent Pinchart
2021-07-19 13:50       ` Niklas Söderlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).