staging: iio: Documentation: rewrite the right hand side of an assignment
authorAya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Thu, 26 Feb 2015 09:45:26 +0000 (11:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Feb 2015 23:24:16 +0000 (15:24 -0800)
This patch rewrites the right hand side of an assignment for
expressions of the form:
a = (a <op> b);
to be:
a <op>= b;
where <op> = << | >>.

This issue was detected and resolved using the following
coccinelle script:

@@
identifier i;
expression e;
@@

-i = (i >> e);
+i >>= e;

@@
identifier i;
expression e;
@@

-i = (i << e);
+i <<= e;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/Documentation/generic_buffer.c

index de4647e2495e9a645da8c96fb34718926422e803..59b250545d4c849dc1b112e0730446e98c5b4ccb 100644 (file)
@@ -72,7 +72,7 @@ void print2byte(int input, struct iio_channel_info *info)
         * Shift before conversion to avoid sign extension
         * of left aligned data
         */
-       input = input >> info->shift;
+       input >>= info->shift;
        if (info->is_signed) {
                int16_t val = input;