2021-04-05 03:40:05

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH 02/10] tty/sysrq: Fix issues of code indent should use tabs

Fix issues of code indent should use tabs, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <[email protected]>
---
drivers/tty/sysrq.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 0372ed7..1ece100 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -548,22 +548,22 @@ static int sysrq_key_table_key2index(int key)
*/
static const struct sysrq_key_op *__sysrq_get_key_op(int key)
{
- const struct sysrq_key_op *op_p = NULL;
- int i;
+ const struct sysrq_key_op *op_p = NULL;
+ int i;

i = sysrq_key_table_key2index(key);
if (i != -1)
- op_p = sysrq_key_table[i];
+ op_p = sysrq_key_table[i];

- return op_p;
+ return op_p;
}

static void __sysrq_put_key_op(int key, const struct sysrq_key_op *op_p)
{
- int i = sysrq_key_table_key2index(key);
+ int i = sysrq_key_table_key2index(key);

- if (i != -1)
- sysrq_key_table[i] = op_p;
+ if (i != -1)
+ sysrq_key_table[i] = op_p;
}

void __handle_sysrq(int key, bool check_mask)
@@ -587,8 +587,8 @@ void __handle_sysrq(int key, bool check_mask)
orig_log_level = console_loglevel;
console_loglevel = CONSOLE_LOGLEVEL_DEFAULT;

- op_p = __sysrq_get_key_op(key);
- if (op_p) {
+ op_p = __sysrq_get_key_op(key);
+ if (op_p) {
/*
* Should we check for enabled operations (/proc/sysrq-trigger
* should not) and is the invoked operation enabled?
@@ -637,13 +637,13 @@ static int sysrq_reset_downtime_ms;

/* Simple translation table for the SysRq keys */
static const unsigned char sysrq_xlate[KEY_CNT] =
- "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
- "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
- "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
- "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
- "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
- "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
- "\r\000/"; /* 0x60 - 0x6f */
+ "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
+ "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
+ "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
+ "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
+ "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
+ "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
+ "\r\000/"; /* 0x60 - 0x6f */

struct sysrq_state {
struct input_handle handle;
@@ -1108,7 +1108,7 @@ int sysrq_toggle_support(int enable_mask)
EXPORT_SYMBOL_GPL(sysrq_toggle_support);

static int __sysrq_swap_key_ops(int key, const struct sysrq_key_op *insert_op_p,
- const struct sysrq_key_op *remove_op_p)
+ const struct sysrq_key_op *remove_op_p)
{
int retval;

--
2.8.1


2021-04-05 08:24:34

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 02/10] tty/sysrq: Fix issues of code indent should use tabs

Hi Xiaofei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on v5.12-rc6 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Xiaofei-Tan/tty-Fix-some-coding-style-issues/20210405-113900
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: x86_64-randconfig-a004-20210405 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 2760a808b9916a2839513b7fd7314a464f52481e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/da18c35dce46cd938810b3ca12275fac9c97f64d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xiaofei-Tan/tty-Fix-some-coding-style-issues/20210405-113900
git checkout da18c35dce46cd938810b3ca12275fac9c97f64d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/tty/sysrq.c:558:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
return op_p;
^
drivers/tty/sysrq.c:555:2: note: previous statement is here
if (i != -1)
^
1 warning generated.


vim +/if +558 drivers/tty/sysrq.c

^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 545
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 546 /*
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 547 * get and put functions for the table, exposed to modules.
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 548 */
23cbedf812ff7c drivers/tty/sysrq.c Emil Velikov 2020-05-13 549 static const struct sysrq_key_op *__sysrq_get_key_op(int key)
bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 550 {
23cbedf812ff7c drivers/tty/sysrq.c Emil Velikov 2020-05-13 551 const struct sysrq_key_op *op_p = NULL;
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 552 int i;
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 553
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 554 i = sysrq_key_table_key2index(key);
bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 555 if (i != -1)
bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 556 op_p = sysrq_key_table[i];
97f5f0cd8cd0a0 drivers/char/sysrq.c Dmitry Torokhov 2010-03-21 557
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 @558 return op_p;
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 559 }
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 560

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (3.44 kB)
.config.gz (26.97 kB)
Download all attachments

2021-04-05 09:36:27

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 02/10] tty/sysrq: Fix issues of code indent should use tabs

Hi Xiaofei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on v5.12-rc6 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Xiaofei-Tan/tty-Fix-some-coding-style-issues/20210405-113900
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: s390-randconfig-r016-20210405 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/da18c35dce46cd938810b3ca12275fac9c97f64d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xiaofei-Tan/tty-Fix-some-coding-style-issues/20210405-113900
git checkout da18c35dce46cd938810b3ca12275fac9c97f64d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:10,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/tty/sysrq.c:18:
drivers/tty/sysrq.c: In function '__sysrq_get_key_op':
>> include/linux/compiler.h:56:23: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~
drivers/tty/sysrq.c:555:2: note: in expansion of macro 'if'
555 | if (i != -1)
| ^~
drivers/tty/sysrq.c:558:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
558 | return op_p;
| ^~~~~~


vim +/if +56 include/linux/compiler.h

2bcd521a684cc9 Steven Rostedt 2008-11-21 50
2bcd521a684cc9 Steven Rostedt 2008-11-21 51 #ifdef CONFIG_PROFILE_ALL_BRANCHES
2bcd521a684cc9 Steven Rostedt 2008-11-21 52 /*
2bcd521a684cc9 Steven Rostedt 2008-11-21 53 * "Define 'is'", Bill Clinton
2bcd521a684cc9 Steven Rostedt 2008-11-21 54 * "Define 'if'", Steven Rostedt
2bcd521a684cc9 Steven Rostedt 2008-11-21 55 */
a15fd609ad53a6 Linus Torvalds 2019-03-20 @56 #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
a15fd609ad53a6 Linus Torvalds 2019-03-20 57

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.95 kB)
.config.gz (15.88 kB)
Download all attachments

2021-04-05 15:52:18

by Xiaofei Tan

[permalink] [raw]
Subject: Re: [PATCH 02/10] tty/sysrq: Fix issues of code indent should use tabs



On 2021/4/5 11:34, Xiaofei Tan wrote:
> Fix issues of code indent should use tabs, reported by checkpatch.pl.
>
> Signed-off-by: Xiaofei Tan <[email protected]>
> ---
> drivers/tty/sysrq.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index 0372ed7..1ece100 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -548,22 +548,22 @@ static int sysrq_key_table_key2index(int key)
> */
> static const struct sysrq_key_op *__sysrq_get_key_op(int key)
> {
> - const struct sysrq_key_op *op_p = NULL;
> - int i;
> + const struct sysrq_key_op *op_p = NULL;
> + int i;
>
> i = sysrq_key_table_key2index(key);
> if (i != -1)
> - op_p = sysrq_key_table[i];
> + op_p = sysrq_key_table[i];
>
> - return op_p;
> + return op_p;

Wow, one redundant tab here.

> }
>
> static void __sysrq_put_key_op(int key, const struct sysrq_key_op *op_p)
> {
> - int i = sysrq_key_table_key2index(key);
> + int i = sysrq_key_table_key2index(key);
>
> - if (i != -1)
> - sysrq_key_table[i] = op_p;
> + if (i != -1)
> + sysrq_key_table[i] = op_p;
> }
>
> void __handle_sysrq(int key, bool check_mask)
> @@ -587,8 +587,8 @@ void __handle_sysrq(int key, bool check_mask)
> orig_log_level = console_loglevel;
> console_loglevel = CONSOLE_LOGLEVEL_DEFAULT;
>
> - op_p = __sysrq_get_key_op(key);
> - if (op_p) {
> + op_p = __sysrq_get_key_op(key);
> + if (op_p) {
> /*
> * Should we check for enabled operations (/proc/sysrq-trigger
> * should not) and is the invoked operation enabled?
> @@ -637,13 +637,13 @@ static int sysrq_reset_downtime_ms;
>
> /* Simple translation table for the SysRq keys */
> static const unsigned char sysrq_xlate[KEY_CNT] =
> - "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
> - "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
> - "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
> - "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
> - "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
> - "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
> - "\r\000/"; /* 0x60 - 0x6f */
> + "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
> + "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
> + "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
> + "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
> + "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
> + "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
> + "\r\000/"; /* 0x60 - 0x6f */
>
> struct sysrq_state {
> struct input_handle handle;
> @@ -1108,7 +1108,7 @@ int sysrq_toggle_support(int enable_mask)
> EXPORT_SYMBOL_GPL(sysrq_toggle_support);
>
> static int __sysrq_swap_key_ops(int key, const struct sysrq_key_op *insert_op_p,
> - const struct sysrq_key_op *remove_op_p)
> + const struct sysrq_key_op *remove_op_p)
> {
> int retval;
>
>

2021-04-09 08:41:04

by Dan Carpenter

[permalink] [raw]