[asahilinux:bits/120-spmi 1/4] drivers/spmi/spmi-apple-controller.c:81 spmi_read_cmd() warn: inconsistent indenting

From: kernel test robot
Date: Sun Aug 07 2022 - 14:46:55 EST


tree: https://github.com/AsahiLinux/linux bits/120-spmi
head: 0324791a3cdc3e93df57f6293e2cfaaadc264aeb
commit: 69860806b247b72cc354ca35ea147c2d1538ea85 [1/4] spmi: add a first basic spmi driver for Apple SoC
config: xtensa-randconfig-m031-20220803 (https://download.01.org/0day-ci/archive/20220808/202208080200.DoRX2CoQ-lkp@xxxxxxxxx/config)
compiler: xtensa-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

New smatch warnings:
drivers/spmi/spmi-apple-controller.c:81 spmi_read_cmd() warn: inconsistent indenting
drivers/spmi/spmi-apple-controller.c:97 spmi_write_cmd() warn: inconsistent indenting

Old smatch warnings:
drivers/spmi/spmi-apple-controller.c:83 spmi_read_cmd() warn: inconsistent indenting
drivers/spmi/spmi-apple-controller.c:86 spmi_read_cmd() warn: inconsistent indenting
drivers/spmi/spmi-apple-controller.c:90 spmi_read_cmd() warn: inconsistent indenting

vim +81 drivers/spmi/spmi-apple-controller.c

47
48 static int spmi_read_cmd(struct spmi_controller *ctrl,
49 u8 opc, u8 slave_id, u16 slave_addr, u8 *__buf, size_t bc)
50 {
51 struct apple_spmi *spmi;
52 u32 spmi_cmd = opc|slave_id<<8|slave_addr<<16|(bc-1)|(1<<15);
53 u32 rsp;
54 volatile u32 status;
55 size_t len_to_read;
56 u8 i;
57
58 spmi = spmi_controller_get_drvdata(ctrl);
59
60 write_reg(spmi_cmd, spmi, SPMI_CMD_REG);
61
62 /* Wait for Rx FIFO to have something */
63 /* Quite ugly msleep, need to find a better way to do it */
64 i=0;
65 do {
66 status=read_reg(spmi, SPMI_STATUS_REG);
67 msleep(10);
68 i+=1;
69 } while ((status & SPMI_RX_FIFO_EMPTY) && i<5);
70
71 if(i>=5){
72 dev_err(&ctrl->dev,"spmi_read_cmd:took to long to get the status");
73 return -1;
74 }
75
76 /* Read SPMI reply status */
77 rsp=read_reg(spmi, SPMI_RSP_REG);
78
79 len_to_read = 0;
80 /* Read SPMI data reply */
> 81 while (!( status & SPMI_RX_FIFO_EMPTY ) && (len_to_read < bc )) {
82 rsp=read_reg(spmi, SPMI_RSP_REG);
83 i=0;
84 while ((len_to_read<bc)&&(i<4)) {
85 __buf[len_to_read++]=((0xff<<(8*i))&rsp)>>(8*i);
86 i+=1;
87 }
88 }
89
90 return 0;
91 }
92
93 static int spmi_write_cmd(struct spmi_controller *ctrl,
94 u8 opc, u8 slave_id, u16 slave_addr, const u8 *__buf, size_t bc)
95 {
96 struct apple_spmi *spmi;
> 97 u32 spmi_cmd = opc|slave_id<<8|slave_addr<<16|(bc-1)|(1<<15);
98 volatile u32 rsp;
99 size_t i=0,j;
100
101 spmi = spmi_controller_get_drvdata(ctrl);
102
103 write_reg(spmi_cmd, spmi, SPMI_CMD_REG);
104
105 while (i<bc) {
106 j=0;
107 spmi_cmd=0;
108 while ((j<4)&(i<bc)) {
109 spmi_cmd |= __buf[i++]<<(j++*8);
110 }
111 write_reg(spmi_cmd, spmi, SPMI_CMD_REG);
112 }
113
114 /* Read SPMI reply status */
115 /* do we need this while loop ?
116 if yes what for ? */
117 do {
118 rsp=read_reg(spmi, SPMI_RSP_REG);
119 } while (rsp==0);
120
121 return 0;
122 }
123

--
0-DAY CI Kernel Test Service
https://01.org/lkp