diff options
author | Daniel Mack <zonque@gmail.com> | 2013-08-10 12:52:16 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-08-14 04:25:15 -0400 |
commit | 638a542cc450e5dca52c82437d746548c0bcbd8b (patch) | |
tree | c77d879345998f76165543e5bd8f7546127e1e9d /drivers/dma | |
parent | 8b298ded902a96cf434738d2a1d83f4a768362ea (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.c | 9 |
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 | ||
248 | out_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 | ||
252 | static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan) | 253 | static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan) |