mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
dma: mmp_pdma: refactor unlocking path in lookup_phy()
As suggested by Ezequiel García, release the spinlock at the end of the function only, and use a goto for the control flow. Just a minor cleanup. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
parent
8b298ded90
commit
638a542cc4
@ -220,7 +220,7 @@ static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
|
|||||||
{
|
{
|
||||||
int prio, i;
|
int prio, i;
|
||||||
struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
|
struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
|
||||||
struct mmp_pdma_phy *phy;
|
struct mmp_pdma_phy *phy, *found = NULL;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -239,14 +239,15 @@ static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
|
|||||||
phy = &pdev->phy[i];
|
phy = &pdev->phy[i];
|
||||||
if (!phy->vchan) {
|
if (!phy->vchan) {
|
||||||
phy->vchan = pchan;
|
phy->vchan = pchan;
|
||||||
spin_unlock_irqrestore(&pdev->phy_lock, flags);
|
found = phy;
|
||||||
return phy;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out_unlock:
|
||||||
spin_unlock_irqrestore(&pdev->phy_lock, flags);
|
spin_unlock_irqrestore(&pdev->phy_lock, flags);
|
||||||
return NULL;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)
|
static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user