]> git.baikalelectronics.ru Git - kernel.git/commit
[media] drxd: Don't use a macro for CHK_ERROR with a break inside
authorMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 25 Mar 2011 14:45:29 +0000 (11:45 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 20 May 2011 10:26:26 +0000 (07:26 -0300)
commita771c7be688d2bf2e3e2db8e4c25bb9d3509cbe7
tree6c061a242bd99df311ee36a19d1cec10e073d316
parente96455454307ce0d76fdf3cbf16e36dd28113197
[media] drxd: Don't use a macro for CHK_ERROR with a break inside

The macro is defined as:
#define CHK_ERROR(s) if( (status = s)<0 ) break

This sucks, as makes harder to debug if something got wrong and
there are more than one level of loops. Also, violates CodingStyle.

Fixed by this simple perl script:

while (<>) { $f.=$_; };

$f=~ s,\n\#define CHK_ERROR[^\n]+\n,\n,;

$f=~ s=(CHK_ERROR\(.*\,)\n\s+=\1 =g;
$f=~ s=(CHK_ERROR\(.*\,)\n\s+=\1 =g;
$f=~ s=(CHK_ERROR\(.*\,)\n\s+=\1 =g;
$f=~ s=(CHK_ERROR\(.*)\s+(\,)\n\s+=\1\2 =g;
$f=~ s=(CHK_ERROR\(.*)\s+(\,)\n\s+=\1\2 =g;
$f=~ s=(CHK_ERROR\(.*)\s+(\,)\n\s+=\1\2 =g;

$f=~ s,\n(\t+)CHK_ERROR\((.*)\)\;,\n\1status = \2;\n\1if (status < 0)\n\1\tbreak;,g;

print $f;

Plus a few manual adjustments

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/drxd_hard.c