Commit 57fc2bbc authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown

ASoC: sprd: Switch to use list_entry_is_head() helper

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20201208111805.6989-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6bdd75a1
...@@ -866,23 +866,23 @@ EXPORT_SYMBOL_GPL(sprd_mcdt_chan_dma_disable); ...@@ -866,23 +866,23 @@ EXPORT_SYMBOL_GPL(sprd_mcdt_chan_dma_disable);
struct sprd_mcdt_chan *sprd_mcdt_request_chan(u8 channel, struct sprd_mcdt_chan *sprd_mcdt_request_chan(u8 channel,
enum sprd_mcdt_channel_type type) enum sprd_mcdt_channel_type type)
{ {
struct sprd_mcdt_chan *temp, *chan = NULL; struct sprd_mcdt_chan *temp;
mutex_lock(&sprd_mcdt_list_mutex); mutex_lock(&sprd_mcdt_list_mutex);
list_for_each_entry(temp, &sprd_mcdt_chan_list, list) { list_for_each_entry(temp, &sprd_mcdt_chan_list, list) {
if (temp->type == type && temp->id == channel) { if (temp->type == type && temp->id == channel) {
chan = temp; list_del_init(&temp->list);
break; break;
} }
} }
if (chan) if (list_entry_is_head(temp, &sprd_mcdt_chan_list, list))
list_del(&chan->list); temp = NULL;
mutex_unlock(&sprd_mcdt_list_mutex); mutex_unlock(&sprd_mcdt_list_mutex);
return chan; return temp;
} }
EXPORT_SYMBOL_GPL(sprd_mcdt_request_chan); EXPORT_SYMBOL_GPL(sprd_mcdt_request_chan);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment