[media] drx-j: replace the ugly CHK_ERROR() macro

Using return and goto inside macros is ugly and makes harder to
understand the code and the labels. Remove those macros, and add
a proper error debug message, when something bad happens.

This was generated using the following coccinelle script:

@@
@@
-DUMMY_READ();
+do {
+	u16 dummy;
+	RR16(demod->my_i2c_dev_addr, SCU_RAM_VERSION_HI__A, &dummy);
+} while (0);

@@
expression dev, addr, val;
@@
-WR16(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.write_reg16func(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-RR16(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.read_reg16func(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-WR32(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.write_reg32func(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-RR32(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.read_reg32func(dev, addr, val, 0))

@@
expression dev, addr, val, block;
@@
-WRB(dev, addr, val, block)
+CHK_ERROR(DRXJ_DAP.write_block_func(dev, addr, val, block, 0))

@@
expression dev, addr, val, block;
@@
-RRB(dev, addr, val, block)
+CHK_ERROR(DRXJ_DAP.read_block_func(dev, addr, val, block, 0))

@@
expression dev, addr, val;
@@
-BCWR16(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.write_reg16func(dev, addr, val, DRXDAP_FASI_BROADCAST))

@@
expression dev, addr, val;
@@
-ARR32(dev, addr, val)
+CHK_ERROR(drxj_dap_atomic_read_reg32(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-SARR16(dev, addr, val)
+CHK_ERROR(drxj_dap_scu_atomic_read_reg16(dev, addr, val, 0))

@@
expression x;
@@
-CHK_ERROR(x);
+rc = x;
+if (rc != DRX_STS_OK) {
+	pr_err("error %d\n", rc);
+	goto rw_error;
+}

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
Mauro Carvalho Chehab 2014-01-16 19:41:13 -03:00
Родитель b1d0a59649
Коммит 068e94ea17
1 изменённых файлов: 6722 добавлений и 1694 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу