Commit b42251a8 authored by Ondrej Zary's avatar Ondrej Zary Committed by Damien Le Moal

ata: pata_parport: remove scratch parameter from test_proto()

Don't pass around a pointer to scratch buffer. Use local buffers in
protocols that need it.
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: default avatarOndrej Zary <linux@zary.sk>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
parent 8d7494a0
...@@ -274,7 +274,7 @@ static void bpck_force_spp(struct pi_adapter *pi) ...@@ -274,7 +274,7 @@ static void bpck_force_spp(struct pi_adapter *pi)
#define TEST_LEN 16 #define TEST_LEN 16
static int bpck_test_proto(struct pi_adapter *pi, char *scratch) static int bpck_test_proto(struct pi_adapter *pi)
{ int i, e, l, h, om; { int i, e, l, h, om;
char buf[TEST_LEN]; char buf[TEST_LEN];
......
...@@ -246,10 +246,11 @@ static void epat_disconnect(struct pi_adapter *pi) ...@@ -246,10 +246,11 @@ static void epat_disconnect(struct pi_adapter *pi)
w2(pi->saved_r2); w2(pi->saved_r2);
} }
static int epat_test_proto(struct pi_adapter *pi, char *scratch) static int epat_test_proto(struct pi_adapter *pi)
{ int k, j, f, cc; { int k, j, f, cc;
int e[2] = {0,0}; int e[2] = {0,0};
char scratch[512];
epat_connect(pi); epat_connect(pi);
cc = RR(0xd); cc = RR(0xd);
......
...@@ -232,10 +232,11 @@ static void epia_write_block(struct pi_adapter *pi, char *buf, int count) ...@@ -232,10 +232,11 @@ static void epia_write_block(struct pi_adapter *pi, char *buf, int count)
} }
static int epia_test_proto(struct pi_adapter *pi, char *scratch) static int epia_test_proto(struct pi_adapter *pi)
{ int j, k, f; { int j, k, f;
int e[2] = {0,0}; int e[2] = {0,0};
char scratch[512];
epia_connect(pi); epia_connect(pi);
for (j=0;j<2;j++) { for (j=0;j<2;j++) {
......
...@@ -178,10 +178,11 @@ static void friq_disconnect(struct pi_adapter *pi) ...@@ -178,10 +178,11 @@ static void friq_disconnect(struct pi_adapter *pi)
w2(pi->saved_r2); w2(pi->saved_r2);
} }
static int friq_test_proto(struct pi_adapter *pi, char *scratch) static int friq_test_proto(struct pi_adapter *pi)
{ int j, k, r; { int j, k, r;
int e[2] = {0,0}; int e[2] = {0,0};
char scratch[512];
pi->saved_r0 = r0(); pi->saved_r0 = r0();
w0(0xff); udelay(20); CMD(0x3d); /* turn the power on */ w0(0xff); udelay(20); CMD(0x3d); /* turn the power on */
......
...@@ -219,10 +219,11 @@ static int frpw_test_pnp(struct pi_adapter *pi) ...@@ -219,10 +219,11 @@ static int frpw_test_pnp(struct pi_adapter *pi)
a hack :-( a hack :-(
*/ */
static int frpw_test_proto(struct pi_adapter *pi, char *scratch) static int frpw_test_proto(struct pi_adapter *pi)
{ int j, k, r; { int j, k, r;
int e[2] = {0,0}; int e[2] = {0,0};
char scratch[512];
if ((pi->private>>1) != pi->port) if ((pi->private>>1) != pi->port)
pi->private = frpw_test_pnp(pi) + 2*pi->port; pi->private = frpw_test_pnp(pi) + 2*pi->port;
......
...@@ -276,7 +276,7 @@ static void pi_release(struct pi_adapter *pi) ...@@ -276,7 +276,7 @@ static void pi_release(struct pi_adapter *pi)
module_put(pi->proto->owner); module_put(pi->proto->owner);
} }
static int default_test_proto(struct pi_adapter *pi, char *scratch) static int default_test_proto(struct pi_adapter *pi)
{ {
int j, k; int j, k;
int e[2] = { 0, 0 }; int e[2] = { 0, 0 };
...@@ -300,21 +300,21 @@ static int default_test_proto(struct pi_adapter *pi, char *scratch) ...@@ -300,21 +300,21 @@ static int default_test_proto(struct pi_adapter *pi, char *scratch)
return e[0] && e[1]; /* not here if both > 0 */ return e[0] && e[1]; /* not here if both > 0 */
} }
static int pi_test_proto(struct pi_adapter *pi, char *scratch) static int pi_test_proto(struct pi_adapter *pi)
{ {
int res; int res;
parport_claim_or_block(pi->pardev); parport_claim_or_block(pi->pardev);
if (pi->proto->test_proto) if (pi->proto->test_proto)
res = pi->proto->test_proto(pi, scratch); res = pi->proto->test_proto(pi);
else else
res = default_test_proto(pi, scratch); res = default_test_proto(pi);
parport_release(pi->pardev); parport_release(pi->pardev);
return res; return res;
} }
static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch) static bool pi_probe_mode(struct pi_adapter *pi, int max)
{ {
int best, range; int best, range;
...@@ -326,7 +326,7 @@ static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch) ...@@ -326,7 +326,7 @@ static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch)
range = 8; range = 8;
if (range == 8 && pi->port % 8) if (range == 8 && pi->port % 8)
return false; return false;
return !pi_test_proto(pi, scratch); return !pi_test_proto(pi);
} }
best = -1; best = -1;
for (pi->mode = 0; pi->mode < max; pi->mode++) { for (pi->mode = 0; pi->mode < max; pi->mode++) {
...@@ -335,14 +335,14 @@ static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch) ...@@ -335,14 +335,14 @@ static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch)
range = 8; range = 8;
if (range == 8 && pi->port % 8) if (range == 8 && pi->port % 8)
break; break;
if (!pi_test_proto(pi, scratch)) if (!pi_test_proto(pi))
best = pi->mode; best = pi->mode;
} }
pi->mode = best; pi->mode = best;
return best > -1; return best > -1;
} }
static bool pi_probe_unit(struct pi_adapter *pi, int unit, char *scratch) static bool pi_probe_unit(struct pi_adapter *pi, int unit)
{ {
int max, s, e; int max, s, e;
...@@ -367,14 +367,14 @@ static bool pi_probe_unit(struct pi_adapter *pi, int unit, char *scratch) ...@@ -367,14 +367,14 @@ static bool pi_probe_unit(struct pi_adapter *pi, int unit, char *scratch)
for (pi->unit = s; pi->unit < e; pi->unit++) { for (pi->unit = s; pi->unit < e; pi->unit++) {
if (pi->proto->probe_unit(pi)) { if (pi->proto->probe_unit(pi)) {
parport_release(pi->pardev); parport_release(pi->pardev);
return pi_probe_mode(pi, max, scratch); return pi_probe_mode(pi, max);
} }
} }
parport_release(pi->pardev); parport_release(pi->pardev);
return false; return false;
} }
return pi_probe_mode(pi, max, scratch); return pi_probe_mode(pi, max);
} }
static void pata_parport_dev_release(struct device *dev) static void pata_parport_dev_release(struct device *dev)
...@@ -420,7 +420,6 @@ static struct pi_adapter *pi_init_one(struct parport *parport, ...@@ -420,7 +420,6 @@ static struct pi_adapter *pi_init_one(struct parport *parport,
struct pi_protocol *pr, int mode, int unit, int delay) struct pi_protocol *pr, int mode, int unit, int delay)
{ {
struct pardev_cb par_cb = { }; struct pardev_cb par_cb = { };
char scratch[512];
const struct ata_port_info *ppi[] = { &pata_parport_port_info }; const struct ata_port_info *ppi[] = { &pata_parport_port_info };
struct ata_host *host; struct ata_host *host;
struct pi_adapter *pi; struct pi_adapter *pi;
...@@ -473,7 +472,7 @@ static struct pi_adapter *pi_init_one(struct parport *parport, ...@@ -473,7 +472,7 @@ static struct pi_adapter *pi_init_one(struct parport *parport,
if (!pi->pardev) if (!pi->pardev)
goto out_module_put; goto out_module_put;
if (!pi_probe_unit(pi, unit, scratch)) { if (!pi_probe_unit(pi, unit)) {
dev_info(&pi->dev, "Adapter not found\n"); dev_info(&pi->dev, "Adapter not found\n");
goto out_unreg_parport; goto out_unreg_parport;
} }
......
...@@ -67,7 +67,7 @@ struct pi_protocol { ...@@ -67,7 +67,7 @@ struct pi_protocol {
int (*test_port)(struct pi_adapter *pi); int (*test_port)(struct pi_adapter *pi);
int (*probe_unit)(struct pi_adapter *pi); int (*probe_unit)(struct pi_adapter *pi);
int (*test_proto)(struct pi_adapter *pi, char *scratch); int (*test_proto)(struct pi_adapter *pi);
void (*log_adapter)(struct pi_adapter *pi); void (*log_adapter)(struct pi_adapter *pi);
int (*init_proto)(struct pi_adapter *pi); int (*init_proto)(struct pi_adapter *pi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment