ata: Use dev_add_param_bool for probe parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
fff0e0f741
commit
f3b911c820
|
@ -325,28 +325,26 @@ on_error:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int ata_set_probe(struct device_d *class_dev, struct param_d *param,
|
||||
const char *val)
|
||||
static int ata_set_probe(struct param_d *param, void *priv)
|
||||
{
|
||||
struct ata_port *port = container_of(class_dev, struct ata_port, class_dev);
|
||||
int ret, probe;
|
||||
struct ata_port *port = priv;
|
||||
int ret;
|
||||
|
||||
if (!port->probe)
|
||||
return 0;
|
||||
|
||||
if (port->initialized) {
|
||||
dev_info(class_dev, "already initialized\n");
|
||||
dev_info(&port->class_dev, "already initialized\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
probe = !!simple_strtoul(val, NULL, 0);
|
||||
if (!probe)
|
||||
return 0;
|
||||
|
||||
ret = ata_port_init(port);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
port->initialized = 1;
|
||||
|
||||
return dev_param_set_generic(class_dev, param, "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -367,7 +365,8 @@ int ata_port_register(struct ata_port *port)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev_add_param(&port->class_dev, "probe", ata_set_probe, NULL, 0);
|
||||
dev_add_param_bool(&port->class_dev, "probe", ata_set_probe,
|
||||
NULL, &port->probe, port);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ struct ata_port {
|
|||
struct block_device blk;
|
||||
uint16_t *id;
|
||||
int initialized;
|
||||
int probe;
|
||||
};
|
||||
|
||||
int ide_port_register(struct device_d *, struct ata_ioports *);
|
||||
|
|
Loading…
Reference in New Issue