Skip to content

Commit 0d5e817

Browse files
committed
ata: pata_parport: Fix fit2 module code indentation and style
Fix the header, indentation and coding style in the fit2 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 8be3197 commit 0d5e817

1 file changed

Lines changed: 64 additions & 67 deletions

File tree

  • drivers/ata/pata_parport

drivers/ata/pata_parport/fit2.c

Lines changed: 64 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
/*
2-
fit2.c (c) 1998 Grant R. Guenther <grant@torque.net>
3-
Under the terms of the GNU General Public License.
4-
5-
fit2.c is a low-level protocol driver for the older version
6-
of the Fidelity International Technology parallel port adapter.
7-
This adapter is used in their TransDisk 2000 and older TransDisk
8-
3000 portable hard-drives. As far as I can tell, this device
9-
supports 4-bit mode _only_.
10-
11-
Newer models of the FIT products use an enhanced protocol.
12-
The "fit3" protocol module should support current drives.
13-
14-
*/
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* (c) 1998 Grant R. Guenther <grant@torque.net>
4+
*
5+
* fit2.c is a low-level protocol driver for the older version
6+
* of the Fidelity International Technology parallel port adapter.
7+
* This adapter is used in their TransDisk 2000 and older TransDisk
8+
* 3000 portable hard-drives. As far as I can tell, this device
9+
* supports 4-bit mode _only_.
10+
*
11+
* Newer models of the FIT products use an enhanced protocol.
12+
* The "fit3" protocol module should support current drives.
13+
*/
1514

1615
#include <linux/module.h>
1716
#include <linux/init.h>
@@ -22,99 +21,97 @@
2221
#include <asm/io.h>
2322
#include "pata_parport.h"
2423

25-
#define j44(a,b) (((a>>4)&0x0f)|(b&0xf0))
26-
27-
/* cont = 0 - access the IDE register file
28-
cont = 1 - access the IDE command set
24+
#define j44(a, b) (((a >> 4) & 0x0f) | (b & 0xf0))
2925

30-
NB: The FIT adapter does not appear to use the control registers.
31-
So, we map ALT_STATUS to STATUS and NO-OP writes to the device
32-
control register - this means that IDE reset will not work on these
33-
devices.
34-
35-
*/
26+
/*
27+
* cont = 0 - access the IDE register file
28+
* cont = 1 - access the IDE command set
29+
*
30+
* NB: The FIT adapter does not appear to use the control registers.
31+
* So, we map ALT_STATUS to STATUS and NO-OP writes to the device
32+
* control register - this means that IDE reset will not work on these
33+
* devices.
34+
*/
3635

3736
static void fit2_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
38-
39-
{ if (cont == 1) return;
37+
{
38+
if (cont == 1)
39+
return;
4040
w2(0xc); w0(regr); w2(4); w0(val); w2(5); w0(0); w2(4);
4141
}
4242

4343
static int fit2_read_regr(struct pi_adapter *pi, int cont, int regr)
44-
45-
{ int a, b, r;
44+
{
45+
int a, b, r;
4646

4747
if (cont) {
48-
if (regr != 6) return 0xff;
49-
r = 7;
50-
} else r = regr + 0x10;
48+
if (regr != 6)
49+
return 0xff;
50+
r = 7;
51+
} else {
52+
r = regr + 0x10;
53+
}
5154

52-
w2(0xc); w0(r); w2(4); w2(5);
53-
w0(0); a = r1();
54-
w0(1); b = r1();
55+
w2(0xc); w0(r); w2(4); w2(5);
56+
w0(0); a = r1();
57+
w0(1); b = r1();
5558
w2(4);
5659

57-
return j44(a,b);
58-
60+
return j44(a, b);
5961
}
6062

6163
static void fit2_read_block(struct pi_adapter *pi, char *buf, int count)
62-
63-
{ int k, a, b, c, d;
64+
{
65+
int k, a, b, c, d;
6466

6567
w2(0xc); w0(0x10);
6668

67-
for (k=0;k<count/4;k++) {
68-
69+
for (k = 0; k < count / 4; k++) {
6970
w2(4); w2(5);
7071
w0(0); a = r1(); w0(1); b = r1();
71-
w0(3); c = r1(); w0(2); d = r1();
72-
buf[4*k+0] = j44(a,b);
73-
buf[4*k+1] = j44(d,c);
74-
75-
w2(4); w2(5);
76-
a = r1(); w0(3); b = r1();
77-
w0(1); c = r1(); w0(0); d = r1();
78-
buf[4*k+2] = j44(d,c);
79-
buf[4*k+3] = j44(a,b);
72+
w0(3); c = r1(); w0(2); d = r1();
73+
buf[4 * k + 0] = j44(a, b);
74+
buf[4 * k + 1] = j44(d, c);
8075

76+
w2(4); w2(5);
77+
a = r1(); w0(3); b = r1();
78+
w0(1); c = r1(); w0(0); d = r1();
79+
buf[4 * k + 2] = j44(d, c);
80+
buf[4 * k + 3] = j44(a, b);
8181
}
8282

8383
w2(4);
84-
8584
}
8685

8786
static void fit2_write_block(struct pi_adapter *pi, char *buf, int count)
87+
{
88+
int k;
8889

89-
{ int k;
90-
91-
92-
w2(0xc); w0(0);
93-
for (k=0;k<count/2;k++) {
94-
w2(4); w0(buf[2*k]);
95-
w2(5); w0(buf[2*k+1]);
90+
w2(0xc); w0(0);
91+
for (k = 0; k < count / 2; k++) {
92+
w2(4); w0(buf[2 * k]);
93+
w2(5); w0(buf[2 * k + 1]);
9694
}
9795
w2(4);
9896
}
9997

10098
static void fit2_connect(struct pi_adapter *pi)
101-
102-
{ pi->saved_r0 = r0();
103-
pi->saved_r2 = r2();
104-
w2(0xcc);
99+
{
100+
pi->saved_r0 = r0();
101+
pi->saved_r2 = r2();
102+
w2(0xcc);
105103
}
106104

107105
static void fit2_disconnect(struct pi_adapter *pi)
108-
109-
{ w0(pi->saved_r0);
110-
w2(pi->saved_r2);
111-
}
106+
{
107+
w0(pi->saved_r0);
108+
w2(pi->saved_r2);
109+
}
112110

113111
static void fit2_log_adapter(struct pi_adapter *pi)
114-
115112
{
116113
dev_info(&pi->dev, "FIT 2000 adapter at 0x%x, delay %d\n",
117-
pi->port, pi->delay);
114+
pi->port, pi->delay);
118115

119116
}
120117

0 commit comments

Comments
 (0)