From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/6] ata: implement detect
Date: Thu, 6 Jun 2013 16:22:36 +0200 [thread overview]
Message-ID: <1370528559-15694-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1370528559-15694-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/ata/disk_ata_drive.c | 24 +++++++++++++++++++-----
include/ata_drive.h | 1 +
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index 034233d..7669539 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -281,14 +281,10 @@ on_error:
return rc;
}
-static int ata_set_probe(struct param_d *param, void *priv)
+int ata_port_detect(struct ata_port *port)
{
- struct ata_port *port = priv;
int ret;
- if (!port->probe)
- return 0;
-
if (port->initialized) {
dev_info(&port->class_dev, "already initialized\n");
return 0;
@@ -303,6 +299,23 @@ static int ata_set_probe(struct param_d *param, void *priv)
return 0;
}
+static int ata_set_probe(struct param_d *param, void *priv)
+{
+ struct ata_port *port = priv;
+
+ if (!port->probe)
+ return 0;
+
+ return ata_port_detect(port);
+}
+
+static int ata_detect(struct device_d *dev)
+{
+ struct ata_port *port = container_of(dev, struct ata_port, class_dev);
+
+ return ata_port_detect(port);
+}
+
/**
* Register an ATA drive behind an IDE like interface
* @param dev The interface device
@@ -316,6 +329,7 @@ int ata_port_register(struct ata_port *port)
port->class_dev.id = DEVICE_ID_DYNAMIC;
strcpy(port->class_dev.name, "ata");
port->class_dev.parent = port->dev;
+ port->class_dev.detect = ata_detect;
ret = register_device(&port->class_dev);
if (ret)
diff --git a/include/ata_drive.h b/include/ata_drive.h
index abbafb9..9961aea 100644
--- a/include/ata_drive.h
+++ b/include/ata_drive.h
@@ -144,6 +144,7 @@ struct ata_port {
int ide_port_register(struct device_d *, struct ata_ioports *);
int ata_port_register(struct ata_port *port);
+int ata_port_detect(struct ata_port *port);
struct device_d;
--
1.8.2.rc2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-06-06 14:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 14:22 [PATCH 1/6] ata: move ATA_ID_ fields and functions to include/ Sascha Hauer
2013-06-06 14:22 ` [PATCH 2/6] ata: ahci: only use lba48 on drives which support it Sascha Hauer
2013-06-06 14:22 ` Sascha Hauer [this message]
2013-06-06 14:22 ` [PATCH 4/6] ata: ahci: Allow 'detect' on hardware device Sascha Hauer
2013-06-06 14:22 ` [PATCH 5/6] ata: i.MX sata: Add devicetree probe support Sascha Hauer
2013-06-06 14:22 ` [PATCH 6/6] ARM: i.MX6: Add sata device to devicetree Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370528559-15694-3-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox