public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: Romain Gantois <romain.gantois@bootlin.com>
To: Wolfram Sang <wsa@the-dreams.de>,
	Romain Gantois <romain.gantois@bootlin.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Jai Luthra <jai.luthra@ideasonboard.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Subject: Re: linux-next: manual merge of the v4l-dvb tree with the i2c tree
Date: Mon, 02 Jun 2025 18:17:24 +0200	[thread overview]
Message-ID: <3548813.44csPzL39Z@fw-rgant> (raw)
In-Reply-To: <aDmVftkqLvR0SV3p@shikoro>

Hi Wolfram,

On Friday, 30 May 2025 13:24:46 CEST Wolfram Sang wrote:
> > Below is the resolution I came up with.
> 
> Thank you for this...
> 
> > -       for (reg_idx = 0; reg_idx < ARRAY_SIZE(rxport->aliased_clients);
> > reg_idx++) {
> 
> ... but it was mangled, sadly. Can you resend it properly, please?

Sorry about that, here's a hopefully properly formatted version. Besides the 
issue that Linus found with the mutex_destroy(), I'd also missed a 
"s/client->addr/addr" in the previous version.

By the way, this is just the output of "git show" after resolving the merge, 
I'm not used to sending these "resolutions diffs" so please let me know
if you need it in some other form.

Thanks,

---

diff --cc drivers/media/i2c/ds90ub960.c
index ed9ace1a54766,94b20ba6cb86f..082fc62b0f5b9
--- a/drivers/media/i2c/ds90ub960.c
+++ b/drivers/media/i2c/ds90ub960.c
@@@ -1271,10 -1056,11 +1274,12 @@@ static int ub960_atr_attach_addr(struc
  	struct ub960_rxport *rxport = priv->rxports[chan_id];
  	struct device *dev = &priv->client->dev;
  	unsigned int reg_idx;
 +	int ret = 0;
  
- 	for (reg_idx = 0; reg_idx < ARRAY_SIZE(rxport->aliased_clients); reg_idx++) {
- 		if (!rxport->aliased_clients[reg_idx])
+ 	guard(mutex)(&rxport->aliased_addrs_lock);
+ 
+ 	for (reg_idx = 0; reg_idx < ARRAY_SIZE(rxport->aliased_addrs); reg_idx++) {
+ 		if (!rxport->aliased_addrs[reg_idx])
  			break;
  	}
  
@@@ -1283,18 -1069,15 +1288,18 @@@
  		return -EADDRNOTAVAIL;
  	}
  
- 	rxport->aliased_clients[reg_idx] = client;
+ 	rxport->aliased_addrs[reg_idx] = addr;
  
  	ub960_rxport_write(priv, chan_id, UB960_RR_SLAVE_ID(reg_idx),
- 			   client->addr << 1, &ret);
 -			   addr << 1);
++			   addr << 1, &ret);
  	ub960_rxport_write(priv, chan_id, UB960_RR_SLAVE_ALIAS(reg_idx),
 -			   alias << 1);
 +			   alias << 1, &ret);
 +
 +	if (ret)
 +		return ret;
  
  	dev_dbg(dev, "rx%u: client 0x%02x assigned alias 0x%02x at slot %u\n",
- 		rxport->nport, client->addr, alias, reg_idx);
+ 		rxport->nport, addr, alias, reg_idx);
  
  	return 0;
  }
@@@ -1306,10 -1089,11 +1311,12 @@@ static void ub960_atr_detach_addr(struc
  	struct ub960_rxport *rxport = priv->rxports[chan_id];
  	struct device *dev = &priv->client->dev;
  	unsigned int reg_idx;
 +	int ret;
  
- 	for (reg_idx = 0; reg_idx < ARRAY_SIZE(rxport->aliased_clients); reg_idx++) {
- 		if (rxport->aliased_clients[reg_idx] == client)
+ 	guard(mutex)(&rxport->aliased_addrs_lock);
+ 
+ 	for (reg_idx = 0; reg_idx < ARRAY_SIZE(rxport->aliased_addrs); reg_idx++) {
+ 		if (rxport->aliased_addrs[reg_idx] == addr)
  			break;
  	}
  
@@@ -1319,18 -1103,12 +1326,18 @@@
  		return;
  	}
  
- 	rxport->aliased_clients[reg_idx] = NULL;
+ 	rxport->aliased_addrs[reg_idx] = 0;
  
 -	ub960_rxport_write(priv, chan_id, UB960_RR_SLAVE_ALIAS(reg_idx), 0);
 +	ret = ub960_rxport_write(priv, chan_id, UB960_RR_SLAVE_ALIAS(reg_idx),
 +				 0, NULL);
 +	if (ret) {
 +		dev_err(dev, "rx%u: unable to fully unmap client 0x%02x: %d\n",
- 			rxport->nport, client->addr, ret);
++			rxport->nport, addr, ret);
 +		return;
 +	}
  
  	dev_dbg(dev, "rx%u: client 0x%02x released at slot %u\n", rxport->nport,
- 		client->addr, reg_idx);
+ 		addr, reg_idx);
  }
  
  static const struct i2c_atr_ops ub960_atr_ops = {
@@@ -4370,12 -3231,21 +4376,14 @@@ static void ub960_txport_free_ports(str
  
  static void ub960_rxport_free_ports(struct ub960_data *priv)
  {
 -	unsigned int nport;
 -
 -	for (nport = 0; nport < priv->hw_data->num_rxports; nport++) {
 -		struct ub960_rxport *rxport = priv->rxports[nport];
 -
 -		if (!rxport)
 -			continue;
 -
 -		fwnode_handle_put(rxport->source.ep_fwnode);
 -		fwnode_handle_put(rxport->ser.fwnode);
 +	for_each_active_rxport(priv, it) {
 +		fwnode_handle_put(it.rxport->source.ep_fwnode);
 +		fwnode_handle_put(it.rxport->ser.fwnode);
  
 -		mutex_destroy(&rxport->aliased_addrs_lock);
++		mutex_destroy(&it.rxport->aliased_addrs_lock);
+ 
 -		kfree(rxport);
 -		priv->rxports[nport] = NULL;
 +		kfree(it.rxport);
 +		priv->rxports[it.nport] = NULL;
  	}
  }
  





  reply	other threads:[~2025-06-02 16:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28  0:49 linux-next: manual merge of the v4l-dvb tree with the i2c tree Stephen Rothwell
2025-04-28  1:22 ` Stephen Rothwell
2025-04-28  1:30   ` Stephen Rothwell
2025-04-29 11:46     ` Tomi Valkeinen
2025-05-29  2:49     ` Stephen Rothwell
2025-05-30  8:13       ` Romain Gantois
2025-05-30 11:24         ` Wolfram Sang
2025-06-02 16:17           ` Romain Gantois [this message]
2025-05-31 12:05         ` Wolfram Sang
2025-06-02 15:57           ` Romain Gantois
  -- strict thread matches above, loose matches on Subject: below --
2013-04-03  1:12 Stephen Rothwell
2013-05-01  3:27 ` Stephen Rothwell

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=3548813.44csPzL39Z@fw-rgant \
    --to=romain.gantois@bootlin.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jai.luthra@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=wsa@the-dreams.de \
    /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