[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [LINUX][XENBUS] Drop (struct xenbus_device)->data, and simply use ->dev.driver_data



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 7cf4cbe7a3be88e7bde56c4093428749bf5320d7
# Parent  db8ec1e484149c51047cbb6938f84e25347e5b79
[LINUX][XENBUS] Drop (struct xenbus_device)->data, and simply use 
->dev.driver_data
instead, since that's what it is there for.  Similar to patch
in patchqueue started by Jeremy, and expanded by me to include all
relevant drivers in xen-unstable.

Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c      |   12 ++++++------
 linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c    |   12 ++++++------
 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c |   12 ++++++------
 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c    |   10 +++++-----
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |   12 ++++++------
 linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c    |    8 ++++----
 linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c   |   10 +++++-----
 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c    |    8 ++++----
 linux-2.6-xen-sparse/include/xen/xenbus.h            |    1 -
 9 files changed, 42 insertions(+), 43 deletions(-)

diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Fri Jun 09 14:20:09 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Fri Jun 09 14:23:50 
2006 +0100
@@ -331,7 +331,7 @@ static void backend_changed(struct xenbu
 static void backend_changed(struct xenbus_device *dev,
                            enum xenbus_state backend_state)
 {
-       struct tpm_private *tp = dev->data;
+       struct tpm_private *tp = dev->dev.driver_data;
        DPRINTK("\n");
 
        switch (backend_state) {
@@ -380,12 +380,12 @@ static int tpmfront_probe(struct xenbus_
        }
 
        tp->dev = dev;
-       dev->data = tp;
+       dev->dev.driver_data = tp;
 
        err = talk_to_backend(dev, tp);
        if (err) {
                tpm_private_put();
-               dev->data = NULL;
+               dev->dev.driver_data = NULL;
                return err;
        }
        return 0;
@@ -394,14 +394,14 @@ static int tpmfront_probe(struct xenbus_
 
 static int tpmfront_remove(struct xenbus_device *dev)
 {
-       struct tpm_private *tp = (struct tpm_private *)dev->data;
+       struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
        destroy_tpmring(tp);
        return 0;
 }
 
 static int tpmfront_suspend(struct xenbus_device *dev)
 {
-       struct tpm_private *tp = (struct tpm_private *)dev->data;
+       struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
        u32 ctr;
 
        /* lock, so no app can send */
@@ -431,7 +431,7 @@ static int tpmfront_suspend(struct xenbu
 
 static int tpmfront_resume(struct xenbus_device *dev)
 {
-       struct tpm_private *tp = (struct tpm_private *)dev->data;
+       struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
        destroy_tpmring(tp);
        return talk_to_backend(dev, tp);
 }
diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Fri Jun 09 14:20:09 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Fri Jun 09 14:23:50 
2006 +0100
@@ -77,7 +77,7 @@ static ssize_t show_physical_device(stru
                                    struct device_attribute *attr, char *buf)
 {
        struct xenbus_device *dev = to_xenbus_device(_dev);
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        return sprintf(buf, "%x:%x\n", be->major, be->minor);
 }
 DEVICE_ATTR(physical_device, S_IRUSR | S_IRGRP | S_IROTH,
@@ -88,7 +88,7 @@ static ssize_t show_mode(struct device *
                         char *buf)
 {
        struct xenbus_device *dev = to_xenbus_device(_dev);
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        return sprintf(buf, "%s\n", be->mode);
 }
 DEVICE_ATTR(mode, S_IRUSR | S_IRGRP | S_IROTH, show_mode, NULL);
@@ -96,7 +96,7 @@ DEVICE_ATTR(mode, S_IRUSR | S_IRGRP | S_
 
 static int blkback_remove(struct xenbus_device *dev)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        DPRINTK("");
 
@@ -116,7 +116,7 @@ static int blkback_remove(struct xenbus_
        device_remove_file(&dev->dev, &dev_attr_mode);
 
        kfree(be);
-       dev->data = NULL;
+       dev->dev.driver_data = NULL;
        return 0;
 }
 
@@ -138,7 +138,7 @@ static int blkback_probe(struct xenbus_d
                return -ENOMEM;
        }
        be->dev = dev;
-       dev->data = be;
+       dev->dev.driver_data = be;
 
        be->blkif = blkif_alloc(dev->otherend_id);
        if (IS_ERR(be->blkif)) {
@@ -249,7 +249,7 @@ static void frontend_changed(struct xenb
 static void frontend_changed(struct xenbus_device *dev,
                             enum xenbus_state frontend_state)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        int err;
 
        DPRINTK("");
diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Jun 09 
14:20:09 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Jun 09 
14:23:50 2006 +0100
@@ -107,12 +107,12 @@ static int blkfront_probe(struct xenbus_
 
        /* Front end dir is a number, which is used as the id. */
        info->handle = simple_strtoul(strrchr(dev->nodename,'/')+1, NULL, 0);
-       dev->data = info;
+       dev->dev.driver_data = info;
 
        err = talk_to_backend(dev, info);
        if (err) {
                kfree(info);
-               dev->data = NULL;
+               dev->dev.driver_data = NULL;
                return err;
        }
 
@@ -128,7 +128,7 @@ static int blkfront_probe(struct xenbus_
  */
 static int blkfront_resume(struct xenbus_device *dev)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
        int err;
 
        DPRINTK("blkfront_resume: %s\n", dev->nodename);
@@ -249,7 +249,7 @@ static void backend_changed(struct xenbu
 static void backend_changed(struct xenbus_device *dev,
                            enum xenbus_state backend_state)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
        struct block_device *bd;
 
        DPRINTK("blkfront:backend_changed.\n");
@@ -341,7 +341,7 @@ static void connect(struct blkfront_info
  */
 static void blkfront_closing(struct xenbus_device *dev)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
 
        DPRINTK("blkfront_closing: %s removed\n", dev->nodename);
 
@@ -353,7 +353,7 @@ static void blkfront_closing(struct xenb
 
 static int blkfront_remove(struct xenbus_device *dev)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
 
        DPRINTK("blkfront_remove: %s removed\n", dev->nodename);
 
diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Jun 09 14:20:09 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Jun 09 14:23:50 
2006 +0100
@@ -44,7 +44,7 @@ static void backend_changed(struct xenbu
 
 static int netback_remove(struct xenbus_device *dev)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        if (be->backend_watch.node) {
                unregister_xenbus_watch(&be->backend_watch);
@@ -56,7 +56,7 @@ static int netback_remove(struct xenbus_
                be->netif = NULL;
        }
        kfree(be);
-       dev->data = NULL;
+       dev->dev.driver_data = NULL;
        return 0;
 }
 
@@ -81,7 +81,7 @@ static int netback_probe(struct xenbus_d
        }
 
        be->dev = dev;
-       dev->data = be;
+       dev->dev.driver_data = be;
 
        err = xenbus_watch_path2(dev, dev->nodename, "handle",
                                 &be->backend_watch, backend_changed);
@@ -134,7 +134,7 @@ static int netback_uevent(struct xenbus_
 static int netback_uevent(struct xenbus_device *xdev, char **envp,
                          int num_envp, char *buffer, int buffer_size)
 {
-       struct backend_info *be = xdev->data;
+       struct backend_info *be = xdev->dev.driver_data;
        netif_t *netif = be->netif;
        int i = 0, length = 0;
        char *val;
@@ -213,7 +213,7 @@ static void frontend_changed(struct xenb
 static void frontend_changed(struct xenbus_device *dev,
                             enum xenbus_state frontend_state)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        DPRINTK("");
 
diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Jun 09 
14:20:09 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Jun 09 
14:23:50 2006 +0100
@@ -207,14 +207,14 @@ static int __devinit netfront_probe(stru
        }
 
        info = netdev_priv(netdev);
-       dev->data = info;
+       dev->dev.driver_data = info;
 
        err = talk_to_backend(dev, info);
        if (err) {
                xennet_sysfs_delif(info->netdev);
                unregister_netdev(netdev);
                free_netdev(netdev);
-               dev->data = NULL;
+               dev->dev.driver_data = NULL;
                return err;
        }
 
@@ -230,7 +230,7 @@ static int __devinit netfront_probe(stru
  */
 static int netfront_resume(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->data;
+       struct netfront_info *info = dev->dev.driver_data;
 
        DPRINTK("%s\n", dev->nodename);
 
@@ -394,7 +394,7 @@ static void backend_changed(struct xenbu
 static void backend_changed(struct xenbus_device *dev,
                            enum xenbus_state backend_state)
 {
-       struct netfront_info *np = dev->data;
+       struct netfront_info *np = dev->dev.driver_data;
        struct net_device *netdev = np->netdev;
 
        DPRINTK("\n");
@@ -1475,7 +1475,7 @@ inetdev_notify(struct notifier_block *th
  */
 static void netfront_closing(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->data;
+       struct netfront_info *info = dev->dev.driver_data;
 
        DPRINTK("netfront_closing: %s removed\n", dev->nodename);
 
@@ -1487,7 +1487,7 @@ static void netfront_closing(struct xenb
 
 static int __devexit netfront_remove(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->data;
+       struct netfront_info *info = dev->dev.driver_data;
 
        DPRINTK("%s\n", dev->nodename);
 
diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Fri Jun 09 14:20:09 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Fri Jun 09 14:23:50 
2006 +0100
@@ -23,7 +23,7 @@ static struct pciback_device *alloc_pdev
        dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev);
 
        pdev->xdev = xdev;
-       xdev->data = pdev;
+       xdev->dev.driver_data = pdev;
 
        spin_lock_init(&pdev->dev_lock);
 
@@ -61,7 +61,7 @@ static void free_pdev(struct pciback_dev
 
        pciback_release_devices(pdev);
 
-       pdev->xdev->data = NULL;
+       pdev->xdev->dev.driver_data = NULL;
        pdev->xdev = NULL;
 
        kfree(pdev);
@@ -168,7 +168,7 @@ static void pciback_frontend_changed(str
 static void pciback_frontend_changed(struct xenbus_device *xdev,
                                     enum xenbus_state fe_state)
 {
-       struct pciback_device *pdev = xdev->data;
+       struct pciback_device *pdev = xdev->dev.driver_data;
 
        dev_dbg(&xdev->dev, "fe state changed %d\n", fe_state);
 
@@ -421,7 +421,7 @@ static int pciback_xenbus_probe(struct x
 
 static int pciback_xenbus_remove(struct xenbus_device *dev)
 {
-       struct pciback_device *pdev = dev->data;
+       struct pciback_device *pdev = dev->dev.driver_data;
 
        if (pdev != NULL)
                free_pdev(pdev);
diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c        Fri Jun 09 
14:20:09 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c        Fri Jun 09 
14:23:50 2006 +0100
@@ -29,7 +29,7 @@ static struct pcifront_device *alloc_pde
        }
        pdev->sh_info->flags = 0;
 
-       xdev->data = pdev;
+       xdev->dev.driver_data = pdev;
        pdev->xdev = xdev;
 
        INIT_LIST_HEAD(&pdev->root_buses);
@@ -59,7 +59,7 @@ static void free_pdev(struct pcifront_de
                gnttab_end_foreign_access(pdev->gnt_ref, 0,
                                          (unsigned long)pdev->sh_info);
 
-       pdev->xdev->data = NULL;
+       pdev->xdev->dev.driver_data = NULL;
 
        kfree(pdev);
 }
@@ -216,7 +216,7 @@ static void pcifront_backend_changed(str
 static void pcifront_backend_changed(struct xenbus_device *xdev,
                                     enum xenbus_state be_state)
 {
-       struct pcifront_device *pdev = xdev->data;
+       struct pcifront_device *pdev = xdev->dev.driver_data;
 
        switch (be_state) {
        case XenbusStateClosing:
@@ -261,8 +261,8 @@ static int pcifront_xenbus_probe(struct 
 
 static int pcifront_xenbus_remove(struct xenbus_device *xdev)
 {
-       if (xdev->data)
-               free_pdev(xdev->data);
+       if (xdev->dev.driver_data)
+               free_pdev(xdev->dev.driver_data);
 
        return 0;
 }
diff -r db8ec1e48414 -r 7cf4cbe7a3be 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Fri Jun 09 14:20:09 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Fri Jun 09 14:23:50 
2006 +0100
@@ -47,7 +47,7 @@ static void frontend_changed(struct xenb
 
 static int tpmback_remove(struct xenbus_device *dev)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        if (!be) return 0;
 
@@ -62,7 +62,7 @@ static int tpmback_remove(struct xenbus_
                be->tpmif = NULL;
        }
        kfree(be);
-       dev->data = NULL;
+       dev->dev.driver_data = NULL;
        return 0;
 }
 
@@ -81,7 +81,7 @@ static int tpmback_probe(struct xenbus_d
 
        be->is_instance_set = 0;
        be->dev = dev;
-       dev->data = be;
+       dev->dev.driver_data = be;
 
        err = xenbus_watch_path2(dev, dev->nodename,
                                "instance", &be->backend_watch,
@@ -131,7 +131,7 @@ static void frontend_changed(struct xenb
 static void frontend_changed(struct xenbus_device *dev,
                              enum xenbus_state frontend_state)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        int err;
 
        be->frontend_state = frontend_state;
diff -r db8ec1e48414 -r 7cf4cbe7a3be linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Jun 09 14:20:09 2006 +0100
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Jun 09 14:23:50 2006 +0100
@@ -76,7 +76,6 @@ struct xenbus_device {
        struct xenbus_watch otherend_watch;
        struct device dev;
        enum xenbus_state state;
-       void *data;
 };
 
 static inline struct xenbus_device *to_xenbus_device(struct device *dev)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.