Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] ASoC: sprd: Switch to use list_entry_is_head() helper
@ 2020-12-08 11:18 Andy Shevchenko
  2020-12-28 16:03 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-12-08 11:18 UTC (permalink / raw)
  To: Orson Zhai, Baolin Wang, Chunyan Zhang, alsa-devel, Mark Brown,
	Liam Girdwood
  Cc: Andy Shevchenko

Since we got list_entry_is_head() helper in the generic header,
we may switch driver to use it. This eliminates the need
in additional variable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 sound/soc/sprd/sprd-mcdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sprd/sprd-mcdt.c b/sound/soc/sprd/sprd-mcdt.c
index f439e5503a3c..34b2ce733b54 100644
--- a/sound/soc/sprd/sprd-mcdt.c
+++ b/sound/soc/sprd/sprd-mcdt.c
@@ -866,23 +866,23 @@ EXPORT_SYMBOL_GPL(sprd_mcdt_chan_dma_disable);
 struct sprd_mcdt_chan *sprd_mcdt_request_chan(u8 channel,
 					      enum sprd_mcdt_channel_type type)
 {
-	struct sprd_mcdt_chan *temp, *chan = NULL;
+	struct sprd_mcdt_chan *temp;
 
 	mutex_lock(&sprd_mcdt_list_mutex);
 
 	list_for_each_entry(temp, &sprd_mcdt_chan_list, list) {
 		if (temp->type == type && temp->id == channel) {
-			chan = temp;
+			list_del_init(&temp->list);
 			break;
 		}
 	}
 
-	if (chan)
-		list_del(&chan->list);
+	if (list_entry_is_head(temp, &sprd_mcdt_chan_list, list))
+		temp = NULL;
 
 	mutex_unlock(&sprd_mcdt_list_mutex);
 
-	return chan;
+	return temp;
 }
 EXPORT_SYMBOL_GPL(sprd_mcdt_request_chan);
 
-- 
2.29.2


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

* Re: [PATCH v1] ASoC: sprd: Switch to use list_entry_is_head() helper
  2020-12-08 11:18 [PATCH v1] ASoC: sprd: Switch to use list_entry_is_head() helper Andy Shevchenko
@ 2020-12-28 16:03 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-12-28 16:03 UTC (permalink / raw)
  To: Liam Girdwood, Baolin Wang, Andy Shevchenko, Chunyan Zhang,
	Orson Zhai, alsa-devel

On Tue, 8 Dec 2020 13:18:05 +0200, Andy Shevchenko wrote:
> Since we got list_entry_is_head() helper in the generic header,
> we may switch driver to use it. This eliminates the need
> in additional variable.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: sprd: Switch to use list_entry_is_head() helper
      commit: 57fc2bbc62ef9d505e8732acbae0d6b5c59836cd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2020-12-28 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-08 11:18 [PATCH v1] ASoC: sprd: Switch to use list_entry_is_head() helper Andy Shevchenko
2020-12-28 16:03 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox