Commit 65adb86d authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] budget-core: fix sparse warnings

Fixes these sparse warnings.

drivers/media/pci/ttpci/budget-core.c:250:17: warning: context imbalance in 'ttpci_budget_debiread' - different lock contexts for basic block
drivers/media/pci/ttpci/budget-core.c:289:17: warning: context imbalance in 'ttpci_budget_debiwrite' - different lock contexts for basic block

To be honest, the new code does look better than the old.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent e5b30145
...@@ -231,63 +231,59 @@ static void vpeirq(unsigned long data) ...@@ -231,63 +231,59 @@ static void vpeirq(unsigned long data)
} }
int ttpci_budget_debiread(struct budget *budget, u32 config, int addr, int count, static int ttpci_budget_debiread_nolock(struct budget *budget, u32 config,
int uselocks, int nobusyloop) int addr, int count, int nobusyloop)
{ {
struct saa7146_dev *saa = budget->dev; struct saa7146_dev *saa = budget->dev;
int result = 0; int result;
unsigned long flags = 0;
if (count > 4 || count <= 0)
return 0;
if (uselocks)
spin_lock_irqsave(&budget->debilock, flags);
if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) { result = saa7146_wait_for_debi_done(saa, nobusyloop);
if (uselocks) if (result < 0)
spin_unlock_irqrestore(&budget->debilock, flags);
return result; return result;
}
saa7146_write(saa, DEBI_COMMAND, (count << 17) | 0x10000 | (addr & 0xffff)); saa7146_write(saa, DEBI_COMMAND, (count << 17) | 0x10000 | (addr & 0xffff));
saa7146_write(saa, DEBI_CONFIG, config); saa7146_write(saa, DEBI_CONFIG, config);
saa7146_write(saa, DEBI_PAGE, 0); saa7146_write(saa, DEBI_PAGE, 0);
saa7146_write(saa, MC2, (2 << 16) | 2); saa7146_write(saa, MC2, (2 << 16) | 2);
if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) { result = saa7146_wait_for_debi_done(saa, nobusyloop);
if (uselocks) if (result < 0)
spin_unlock_irqrestore(&budget->debilock, flags);
return result; return result;
}
result = saa7146_read(saa, DEBI_AD); result = saa7146_read(saa, DEBI_AD);
result &= (0xffffffffUL >> ((4 - count) * 8)); result &= (0xffffffffUL >> ((4 - count) * 8));
if (uselocks)
spin_unlock_irqrestore(&budget->debilock, flags);
return result; return result;
} }
int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr, int ttpci_budget_debiread(struct budget *budget, u32 config, int addr, int count,
int count, u32 value, int uselocks, int nobusyloop) int uselocks, int nobusyloop)
{ {
struct saa7146_dev *saa = budget->dev;
unsigned long flags = 0;
int result;
if (count > 4 || count <= 0) if (count > 4 || count <= 0)
return 0; return 0;
if (uselocks) if (uselocks) {
spin_lock_irqsave(&budget->debilock, flags); unsigned long flags;
int result;
if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) { spin_lock_irqsave(&budget->debilock, flags);
if (uselocks) result = ttpci_budget_debiread_nolock(budget, config, addr,
count, nobusyloop);
spin_unlock_irqrestore(&budget->debilock, flags); spin_unlock_irqrestore(&budget->debilock, flags);
return result; return result;
} }
return ttpci_budget_debiread_nolock(budget, config, addr,
count, nobusyloop);
}
static int ttpci_budget_debiwrite_nolock(struct budget *budget, u32 config,
int addr, int count, u32 value, int nobusyloop)
{
struct saa7146_dev *saa = budget->dev;
int result;
result = saa7146_wait_for_debi_done(saa, nobusyloop);
if (result < 0)
return result;
saa7146_write(saa, DEBI_COMMAND, (count << 17) | 0x00000 | (addr & 0xffff)); saa7146_write(saa, DEBI_COMMAND, (count << 17) | 0x00000 | (addr & 0xffff));
saa7146_write(saa, DEBI_CONFIG, config); saa7146_write(saa, DEBI_CONFIG, config);
...@@ -295,15 +291,28 @@ int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr, ...@@ -295,15 +291,28 @@ int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr,
saa7146_write(saa, DEBI_AD, value); saa7146_write(saa, DEBI_AD, value);
saa7146_write(saa, MC2, (2 << 16) | 2); saa7146_write(saa, MC2, (2 << 16) | 2);
if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) { result = saa7146_wait_for_debi_done(saa, nobusyloop);
if (uselocks) return result < 0 ? result : 0;
}
int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr,
int count, u32 value, int uselocks, int nobusyloop)
{
if (count > 4 || count <= 0)
return 0;
if (uselocks) {
unsigned long flags;
int result;
spin_lock_irqsave(&budget->debilock, flags);
result = ttpci_budget_debiwrite_nolock(budget, config, addr,
count, value, nobusyloop);
spin_unlock_irqrestore(&budget->debilock, flags); spin_unlock_irqrestore(&budget->debilock, flags);
return result; return result;
} }
return ttpci_budget_debiwrite_nolock(budget, config, addr,
if (uselocks) count, value, nobusyloop);
spin_unlock_irqrestore(&budget->debilock, flags);
return 0;
} }
......
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