summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-10-28 15:00:48 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-03-03 14:34:13 +0100
commitb1a88c713a81705fd2a86d8d8404399f8acc76ba (patch)
tree84b260f9e194e87ebb8db5cc602e3dc3288a5703 /drivers
parent[media] lbdt3306a: rework at printk macros (diff)
downloadlinux-b1a88c713a81705fd2a86d8d8404399f8acc76ba.tar.xz
linux-b1a88c713a81705fd2a86d8d8404399f8acc76ba.zip
[media] lbdt3306a: simplify the lock status check
The logic there is too complex and it looks like an inifite loop. So, simplify the logic and implement it as a for loop. This gets rid of the following checkpatch.pl warnings: WARNING: else is not generally useful after a break or return + return LG3306_UNLOCK; + } else { WARNING: else is not generally useful after a break or return + return LG3306_UNLOCK; + } else { Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb-frontends/lgdt3306a.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c
index 85fc9c63e3ca..0356810da444 100644
--- a/drivers/media/dvb-frontends/lgdt3306a.c
+++ b/drivers/media/dvb-frontends/lgdt3306a.c
@@ -1461,64 +1461,52 @@ static enum lgdt3306a_lock_status lgdt3306a_vsb_lock_poll(struct lgdt3306a_state
u8 packet_error;
u32 snr;
- while (1) {
+ for (cnt = 0; cnt < 10; cnt++) {
if (lgdt3306a_sync_lock_poll(state) == LG3306_UNLOCK) {
dbg_info("no sync lock!\n");
return LG3306_UNLOCK;
- } else {
- msleep(20);
- ret = lgdt3306a_pre_monitoring(state);
- if (ret)
- return LG3306_UNLOCK;
+ }
- packet_error = lgdt3306a_get_packet_error(state);
- snr = lgdt3306a_calculate_snr_x100(state);
- dbg_info("cnt=%d errors=%d snr=%d\n",
- cnt, packet_error, snr);
+ msleep(20);
+ ret = lgdt3306a_pre_monitoring(state);
+ if (ret)
+ break;
- if ((snr < 1500) || (packet_error >= 0xff))
- cnt++;
- else
- return LG3306_LOCK;
+ packet_error = lgdt3306a_get_packet_error(state);
+ snr = lgdt3306a_calculate_snr_x100(state);
+ dbg_info("cnt=%d errors=%d snr=%d\n", cnt, packet_error, snr);
- if (cnt >= 10) {
- dbg_info("not locked!\n");
- return LG3306_UNLOCK;
- }
- }
+ if ((snr >= 1500) && (packet_error < 0xff))
+ return LG3306_LOCK;
}
+
+ dbg_info("not locked!\n");
return LG3306_UNLOCK;
}
static enum lgdt3306a_lock_status lgdt3306a_qam_lock_poll(struct lgdt3306a_state *state)
{
- u8 cnt = 0;
+ u8 cnt;
u8 packet_error;
u32 snr;
- while (1) {
+ for (cnt = 0; cnt < 10; cnt++) {
if (lgdt3306a_fec_lock_poll(state) == LG3306_UNLOCK) {
dbg_info("no fec lock!\n");
return LG3306_UNLOCK;
- } else {
- msleep(20);
+ }
- packet_error = lgdt3306a_get_packet_error(state);
- snr = lgdt3306a_calculate_snr_x100(state);
- dbg_info("cnt=%d errors=%d snr=%d\n",
- cnt, packet_error, snr);
+ msleep(20);
- if ((snr < 1500) || (packet_error >= 0xff))
- cnt++;
- else
- return LG3306_LOCK;
+ packet_error = lgdt3306a_get_packet_error(state);
+ snr = lgdt3306a_calculate_snr_x100(state);
+ dbg_info("cnt=%d errors=%d snr=%d\n", cnt, packet_error, snr);
- if (cnt >= 10) {
- dbg_info("not locked!\n");
- return LG3306_UNLOCK;
- }
- }
+ if ((snr >= 1500) && (packet_error < 0xff))
+ return LG3306_LOCK;
}
+
+ dbg_info("not locked!\n");
return LG3306_UNLOCK;
}