Skip to content

Commit 6b42711

Browse files
committed
ata: pata_parport: Fix fit3 module code indentation and style
Fix the header, indentation and coding style in the fit3 pata parport protocol module to suppress warnings from smatch and other static code analyzers. No functional changes. Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
1 parent 0d5e817 commit 6b42711

1 file changed

Lines changed: 104 additions & 102 deletions

File tree

  • drivers/ata/pata_parport

drivers/ata/pata_parport/fit3.c

Lines changed: 104 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
/*
2-
fit3.c (c) 1998 Grant R. Guenther <grant@torque.net>
3-
Under the terms of the GNU General Public License.
4-
5-
fit3.c is a low-level protocol driver for newer models
6-
of the Fidelity International Technology parallel port adapter.
7-
This adapter is used in their TransDisk 3000 portable
8-
hard-drives, as well as CD-ROM, PD-CD and other devices.
9-
10-
The TD-2000 and certain older devices use a different protocol.
11-
Try the fit2 protocol module with them.
12-
13-
NB: The FIT adapters do not appear to support the control
14-
registers. So, we map ALT_STATUS to STATUS and NO-OP writes
15-
to the device control register - this means that IDE reset
16-
will not work on these devices.
17-
18-
*/
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* (c) 1998 Grant R. Guenther <grant@torque.net>
4+
*
5+
* fit3.c is a low-level protocol driver for newer models
6+
* of the Fidelity International Technology parallel port adapter.
7+
* This adapter is used in their TransDisk 3000 portable
8+
* hard-drives, as well as CD-ROM, PD-CD and other devices.
9+
*
10+
* The TD-2000 and certain older devices use a different protocol.
11+
* Try the fit2 protocol module with them.
12+
*
13+
* NB: The FIT adapters do not appear to support the control
14+
* registers. So, we map ALT_STATUS to STATUS and NO-OP writes
15+
* to the device control register - this means that IDE reset
16+
* will not work on these devices.
17+
*/
1918

2019
#include <linux/module.h>
2120
#include <linux/init.h>
@@ -26,152 +25,155 @@
2625
#include <asm/io.h>
2726
#include "pata_parport.h"
2827

29-
#define j44(a,b) (((a>>3)&0x0f)|((b<<1)&0xf0))
30-
31-
#define w7(byte) {out_p(7,byte);}
32-
#define r7() (in_p(7) & 0xff)
28+
#define j44(a, b) (((a >> 3) & 0x0f) | ((b << 1) & 0xf0))
3329

34-
/* cont = 0 - access the IDE register file
35-
cont = 1 - access the IDE command set
30+
#define w7(byte) out_p(7, byte)
31+
#define r7() (in_p(7) & 0xff)
3632

37-
*/
33+
/*
34+
* cont = 0 - access the IDE register file
35+
* cont = 1 - access the IDE command set
36+
*/
3837

3938
static void fit3_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
40-
41-
{ if (cont == 1) return;
39+
{
40+
if (cont == 1)
41+
return;
4242

4343
switch (pi->mode) {
44-
4544
case 0:
46-
case 1: w2(0xc); w0(regr); w2(0x8); w2(0xc);
47-
w0(val); w2(0xd);
45+
case 1:
46+
w2(0xc); w0(regr); w2(0x8); w2(0xc);
47+
w0(val); w2(0xd);
4848
w0(0); w2(0xc);
4949
break;
50-
51-
case 2: w2(0xc); w0(regr); w2(0x8); w2(0xc);
50+
case 2:
51+
w2(0xc); w0(regr); w2(0x8); w2(0xc);
5252
w4(val); w4(0);
5353
w2(0xc);
5454
break;
55-
5655
}
5756
}
5857

5958
static int fit3_read_regr(struct pi_adapter *pi, int cont, int regr)
60-
61-
{ int a, b;
59+
{
60+
int a, b;
6261

6362
if (cont) {
64-
if (regr != 6) return 0xff;
65-
regr = 7;
66-
}
63+
if (regr != 6)
64+
return 0xff;
65+
regr = 7;
66+
}
6767

6868
switch (pi->mode) {
69-
70-
case 0: w2(0xc); w0(regr + 0x10); w2(0x8); w2(0xc);
69+
case 0:
70+
w2(0xc); w0(regr + 0x10); w2(0x8); w2(0xc);
7171
w2(0xd); a = r1();
72-
w2(0xf); b = r1();
72+
w2(0xf); b = r1();
7373
w2(0xc);
74-
return j44(a,b);
75-
76-
case 1: w2(0xc); w0(regr + 0x90); w2(0x8); w2(0xc);
77-
w2(0xec); w2(0xee); w2(0xef); a = r0();
74+
return j44(a, b);
75+
case 1:
76+
w2(0xc); w0(regr + 0x90); w2(0x8); w2(0xc);
77+
w2(0xec); w2(0xee); w2(0xef); a = r0();
7878
w2(0xc);
7979
return a;
80-
81-
case 2: w2(0xc); w0(regr + 0x90); w2(0x8); w2(0xc);
82-
w2(0xec);
83-
a = r4(); b = r4();
80+
case 2:
81+
w2(0xc); w0(regr + 0x90); w2(0x8); w2(0xc);
82+
w2(0xec);
83+
a = r4(); b = r4();
8484
w2(0xc);
8585
return a;
86-
8786
}
88-
return -1;
8987

88+
return -1;
9089
}
9190

9291
static void fit3_read_block(struct pi_adapter *pi, char *buf, int count)
93-
94-
{ int k, a, b, c, d;
92+
{
93+
int k, a, b, c, d;
9594

9695
switch (pi->mode) {
97-
98-
case 0: w2(0xc); w0(0x10); w2(0x8); w2(0xc);
99-
for (k=0;k<count/2;k++) {
100-
w2(0xd); a = r1();
101-
w2(0xf); b = r1();
102-
w2(0xc); c = r1();
103-
w2(0xe); d = r1();
104-
buf[2*k ] = j44(a,b);
105-
buf[2*k+1] = j44(c,d);
96+
case 0:
97+
w2(0xc); w0(0x10); w2(0x8); w2(0xc);
98+
for (k = 0; k < count / 2; k++) {
99+
w2(0xd); a = r1();
100+
w2(0xf); b = r1();
101+
w2(0xc); c = r1();
102+
w2(0xe); d = r1();
103+
buf[2 * k] = j44(a, b);
104+
buf[2 * k + 1] = j44(c, d);
106105
}
107106
w2(0xc);
108107
break;
109-
110-
case 1: w2(0xc); w0(0x90); w2(0x8); w2(0xc);
108+
case 1:
109+
w2(0xc); w0(0x90); w2(0x8); w2(0xc);
111110
w2(0xec); w2(0xee);
112-
for (k=0;k<count/2;k++) {
113-
w2(0xef); a = r0();
114-
w2(0xee); b = r0();
115-
buf[2*k ] = a;
116-
buf[2*k+1] = b;
111+
for (k = 0; k < count / 2; k++) {
112+
w2(0xef); a = r0();
113+
w2(0xee); b = r0();
114+
buf[2 * k] = a;
115+
buf[2 * k + 1] = b;
117116
}
118-
w2(0xec);
117+
w2(0xec);
119118
w2(0xc);
120119
break;
121-
122-
case 2: w2(0xc); w0(0x90); w2(0x8); w2(0xc);
123-
w2(0xec);
124-
for (k=0;k<count;k++) buf[k] = r4();
125-
w2(0xc);
120+
case 2:
121+
w2(0xc); w0(0x90); w2(0x8); w2(0xc);
122+
w2(0xec);
123+
for (k = 0; k < count; k++)
124+
buf[k] = r4();
125+
w2(0xc);
126126
break;
127-
128127
}
129128
}
130129

131130
static void fit3_write_block(struct pi_adapter *pi, char *buf, int count)
131+
{
132+
int k;
132133

133-
{ int k;
134-
135-
switch (pi->mode) {
136-
134+
switch (pi->mode) {
137135
case 0:
138-
case 1: w2(0xc); w0(0); w2(0x8); w2(0xc);
139-
for (k=0;k<count/2;k++) {
140-
w0(buf[2*k ]); w2(0xd);
141-
w0(buf[2*k+1]); w2(0xc);
136+
case 1:
137+
w2(0xc); w0(0); w2(0x8); w2(0xc);
138+
for (k = 0; k < count / 2; k++) {
139+
w0(buf[2 * k]); w2(0xd);
140+
w0(buf[2 * k + 1]); w2(0xc);
142141
}
143142
break;
144-
145-
case 2: w2(0xc); w0(0); w2(0x8); w2(0xc);
146-
for (k=0;k<count;k++) w4(buf[k]);
147-
w2(0xc);
143+
case 2:
144+
w2(0xc); w0(0); w2(0x8); w2(0xc);
145+
for (k = 0; k < count; k++)
146+
w4(buf[k]);
147+
w2(0xc);
148148
break;
149149
}
150150
}
151151

152152
static void fit3_connect(struct pi_adapter *pi)
153-
154-
{ pi->saved_r0 = r0();
155-
pi->saved_r2 = r2();
153+
{
154+
pi->saved_r0 = r0();
155+
pi->saved_r2 = r2();
156156
w2(0xc); w0(0); w2(0xa);
157-
if (pi->mode == 2) {
158-
w2(0xc); w0(0x9); w2(0x8); w2(0xc);
159-
}
157+
if (pi->mode == 2) {
158+
w2(0xc); w0(0x9);
159+
w2(0x8); w2(0xc);
160+
}
160161
}
161162

162163
static void fit3_disconnect(struct pi_adapter *pi)
163-
164-
{ w2(0xc); w0(0xa); w2(0x8); w2(0xc);
164+
{
165+
w2(0xc); w0(0xa); w2(0x8); w2(0xc);
165166
w0(pi->saved_r0);
166-
w2(pi->saved_r2);
167-
}
167+
w2(pi->saved_r2);
168+
}
168169

169170
static void fit3_log_adapter(struct pi_adapter *pi)
171+
{
172+
char *mode_string[3] = { "4-bit", "8-bit", "EPP"};
170173

171-
{ char *mode_string[3] = {"4-bit","8-bit","EPP"};
172-
173-
dev_info(&pi->dev, "FIT 3000 adapter at 0x%x, mode %d (%s), delay %d\n",
174-
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
174+
dev_info(&pi->dev,
175+
"FIT 3000 adapter at 0x%x, mode %d (%s), delay %d\n",
176+
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
175177
}
176178

177179
static struct pi_protocol fit3 = {

0 commit comments

Comments
 (0)