From: Vinod Koul <vkoul@kernel.org>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.dev,
peter.ujfalusi@linux.intel.com, linux-sound@vger.kernel.org,
patches@opensource.cirrus.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] soundwire: bus: Don't unassign dev_num before unregistering device
Date: Sat, 3 Oct 2026 10:18:02 +0200 [thread overview]
Message-ID: <asC6OuTRgQg86jMk@parshuram> (raw)
In-Reply-To: <20260925154216.3520136-2-ckeepax@opensource.cirrus.com>
On 25-09-26, 16:42, Charles Keepax wrote:
> Don't mark dev_num as unassigned until after the driver remove has
> been called. The driver may want to communicate with the device
> as part of the driver remove operation, so the dev_num should
> remain assigned until that has completed. This requires moving from
> device_unregister() to manually calling device_del() and device_put()
> to ensure that the slave struct isn't freed too early.
>
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>
> Changes since v1:
> - Split device_unregister into device_del and put_device
>
> drivers/soundwire/bus.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index aeaae5a57c89d..1488b6540844c 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -175,8 +175,9 @@ static int sdw_delete_slave(struct device *dev, void *data)
>
> sdw_slave_debugfs_exit(slave);
>
> - mutex_lock(&bus->bus_lock);
> + device_del(dev);
>
> + mutex_lock(&bus->bus_lock);
> if (slave->dev_num) { /* clear dev_num if assigned */
> clear_bit(slave->dev_num, bus->assigned);
> if (bus->ops && bus->ops->put_device_num)
> @@ -185,7 +186,8 @@ static int sdw_delete_slave(struct device *dev, void *data)
> list_del_init(&slave->node);
> mutex_unlock(&bus->bus_lock);
>
> - device_unregister(dev);
> + put_device(dev);
if we are doing this I would add code comments on why we split. We
invoke device_register so the expectation is that we always call
device_unregister. I understand this is being done but this needs to be
well documented here
--
~Vinod
next prev parent reply other threads:[~2026-10-03 8:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 15:42 [PATCH v2 0/3] Allow SoundWire devices to communicate during remove Charles Keepax
2026-09-25 15:42 ` [PATCH v2 1/3] soundwire: bus: Don't unassign dev_num before unregistering device Charles Keepax
2026-10-03 8:18 ` Vinod Koul [this message]
2026-09-25 15:42 ` [PATCH v2 2/3] soundwire: bus: Expose a helper to remove devices from the bus Charles Keepax
2026-09-25 15:42 ` [PATCH v2 3/3] soundwire: intel_auxdevice: Don't disable IRQs before removing children Charles Keepax
2026-09-26 15:55 ` Pierre-Louis Bossart
2026-09-28 8:39 ` Charles Keepax
2026-09-29 8:34 ` Pierre-Louis Bossart
2026-09-29 12:40 ` Charles Keepax
2026-09-29 18:31 ` Pierre-Louis Bossart
2026-09-29 18:34 ` [PATCH v2 0/3] Allow SoundWire devices to communicate during remove Pierre-Louis Bossart
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=asC6OuTRgQg86jMk@parshuram \
--to=vkoul@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=yung-chuan.liao@linux.intel.com \
/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®