WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Do not use device_find: crashes for some reason

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Do not use device_find: crashes for some reason
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Jul 2005 20:26:17 -0400
Delivery-date: Wed, 27 Jul 2005 00:27:44 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID aa8776c44b6548a9d9c0363879e04bf127f0d7ae
# Parent  c20ccb474166983e5fb308f4254366514b0a0d04
Do not use device_find: crashes for some reason
Signed-off-by: Rusty Russel <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r c20ccb474166 -r aa8776c44b65 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Tue Jul 26 
17:15:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Tue Jul 26 
17:16:55 2005
@@ -113,6 +113,33 @@
        driver_unregister(&drv->driver);
 }
 
+struct xb_find_info
+{
+       struct xenbus_device *dev;
+       const char *busid;
+};
+
+static int cmp_dev(struct device *dev, void *data)
+{
+       struct xb_find_info *info = data;
+
+       if (streq(dev->bus_id, info->busid)) {
+               info->dev = container_of(get_device(dev),
+                                        struct xenbus_device, dev);
+               return 1;
+       }
+       return 0;
+}
+
+/* FIXME: device_find seems to be broken. --RR */
+struct xenbus_device *xenbus_device_find(const char *busid)
+{
+       struct xb_find_info info = { .dev = NULL, .busid = busid };
+
+       bus_for_each_dev(&xenbus_type, NULL, &info, cmp_dev);
+       return info.dev;
+}
+
 /* devices/<typename>/<name> */
 static int xenbus_probe_device(const char *dirpath, const char *devicetype,
                               const char *name)
@@ -200,7 +227,7 @@
        char busid[BUS_ID_SIZE];
        unsigned int typelen, idlen;
        int exists;
-       struct device *dev;
+       struct xenbus_device *dev;
        char *type;
 
        /* Node is of form device/<type>/<identifier>[/...] */
@@ -225,17 +252,19 @@
        exists = xenbus_exists("device", busid);
        busid[typelen] = '-';
 
-       dev = device_find(busid, &xenbus_type);
+       dev = xenbus_device_find(busid);
        if (dev && !exists) {
                printk("xenbus: Unregistering device %s\n", busid);
                /* FIXME: free? */
-               device_unregister(dev);
+               device_unregister(&dev->dev);
        }
        if (!dev && exists) {
                printk("xenbus: Adding device %s\n", busid);
                busid[typelen] = '\0';
                xenbus_probe_device("device", busid, busid+typelen+1);
        }
+       if (dev)
+               put_device(&dev->dev);
 }
 
 /* We watch for devices appearing and vanishing. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Do not use device_find: crashes for some reason, Xen patchbot -unstable <=