summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-05-26 15:06:53 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-05-30 12:18:27 +0200
commit73b0d228e5b00365e7289e9c258acb8de3f716b3 (patch)
treeb17c82b3a4f33d52fdd26c52086e1fa7eaac97a3 /drivers/misc
parent4a4f2f20b8873224983ab9b78173f9bc0564fa33 (diff)
downloadbarebox-73b0d228e5b00365e7289e9c258acb8de3f716b3.tar.gz
barebox-73b0d228e5b00365e7289e9c258acb8de3f716b3.tar.xz
driver: Attach info callback to device, not to driver
Since the info is device specific and not driver specific, attach the callback to the device. This makes it possible to have a info callback for a device which does not have a driver attached. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/jtag.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/misc/jtag.c b/drivers/misc/jtag.c
index d302237e37..310da81074 100644
--- a/drivers/misc/jtag.c
+++ b/drivers/misc/jtag.c
@@ -269,6 +269,25 @@ static struct file_operations jtag_operations = {
.ioctl = jtag_ioctl,
};
+static void jtag_info(struct device_d *pdev)
+{
+ int dn, ret;
+ struct jtag_rd_id jid;
+ struct jtag_info *info = pdev->priv;
+
+ printf(" JTAG:\n");
+ printf(" Devices found: %d\n", info->devices);
+ for (dn = 0; dn < info->devices; dn++) {
+ jid.device = dn;
+ ret = jtag_ioctl(&info->cdev, JTAG_GET_ID, &jid);
+ printf(" Device number: %d\n", dn);
+ if (ret == -1)
+ printf(" JTAG_GET_ID failed: %s\n", strerror(errno));
+ else
+ printf(" ID: 0x%lX\n", jid.id);
+ }
+}
+
static int jtag_probe(struct device_d *pdev)
{
int i, ret;
@@ -323,6 +342,7 @@ static int jtag_probe(struct device_d *pdev)
info->devices = i;
info->pdata = pdata;
pdev->priv = info;
+ pdev->info = jtag_info;
info->cdev.name = JTAG_NAME;
info->cdev.dev = pdev;
@@ -341,25 +361,6 @@ fail_devfs_create:
return ret;
}
-static void jtag_info(struct device_d *pdev)
-{
- int dn, ret;
- struct jtag_rd_id jid;
- struct jtag_info *info = pdev->priv;
-
- printf(" JTAG:\n");
- printf(" Devices found: %d\n", info->devices);
- for (dn = 0; dn < info->devices; dn++) {
- jid.device = dn;
- ret = jtag_ioctl(&info->cdev, JTAG_GET_ID, &jid);
- printf(" Device number: %d\n", dn);
- if (ret == -1)
- printf(" JTAG_GET_ID failed: %s\n", strerror(errno));
- else
- printf(" ID: 0x%lX\n", jid.id);
- }
-}
-
static void jtag_remove(struct device_d *pdev)
{
struct jtag_info *info = (struct jtag_info *) pdev->priv;
@@ -374,7 +375,6 @@ static struct driver_d jtag_driver = {
.name = JTAG_NAME,
.probe = jtag_probe,
.remove = jtag_remove,
- .info = jtag_info,
};
device_platform_driver(jtag_driver);