aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-08-10 12:52:16 -0400
committerVinod Koul <vinod.koul@intel.com>2013-08-14 04:25:15 -0400
commit638a542cc450e5dca52c82437d746548c0bcbd8b (patch)
treec77d879345998f76165543e5bd8f7546127e1e9d /drivers/dma
parent8b298ded902a96cf434738d2a1d83f4a768362ea (diff)
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>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/mmp_pdma.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index b061e2696728..3c2ad72a1621 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -220,7 +220,7 @@ static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
220{ 220{
221 int prio, i; 221 int prio, i;
222 struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device); 222 struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
223 struct mmp_pdma_phy *phy; 223 struct mmp_pdma_phy *phy, *found = NULL;
224 unsigned long flags; 224 unsigned long flags;
225 225
226 /* 226 /*
@@ -239,14 +239,15 @@ static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
239 phy = &pdev->phy[i]; 239 phy = &pdev->phy[i];
240 if (!phy->vchan) { 240 if (!phy->vchan) {
241 phy->vchan = pchan; 241 phy->vchan = pchan;
242 spin_unlock_irqrestore(&pdev->phy_lock, flags); 242 found = phy;
243 return phy; 243 goto out_unlock;
244 } 244 }
245 } 245 }
246 } 246 }
247 247
248out_unlock:
248 spin_unlock_irqrestore(&pdev->phy_lock, flags); 249 spin_unlock_irqrestore(&pdev->phy_lock, flags);
249 return NULL; 250 return found;
250} 251}
251 252
252static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan) 253static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)