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-devel

[Xen-devel] [PATCH] xen: remove driver_data direct access of struct devi

To: Chris Wright <chrisw@xxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] xen: remove driver_data direct access of struct device from more drivers
From: Greg Kroah-Hartman <gregkh@xxxxxxx>
Date: Mon, 4 May 2009 13:22:06 -0700
Cc: virtualization@xxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Greg KH <greg@xxxxxxxxx>
Delivery-date: Tue, 05 May 2009 08:43:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.19 (2009-01-05)
From: Greg Kroah-Hartman <gregkh@xxxxxxx>

In the near future, the driver core is going to not allow direct access
to the driver_data pointer in struct device.  Instead, the functions
dev_get_drvdata() and dev_set_drvdata() should be used.  These functions
have been around since the beginning, so are backwards compatible with
all older kernel versions.

Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Cc: virtualization@xxxxxxxxxxxxxx
Cc: Chris Wright <chrisw@xxxxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/input/xen-kbdfront.c |    8 ++++----
 drivers/net/xen-netfront.c   |   10 +++++-----
 drivers/video/xen-fbfront.c  |    8 ++++----
 3 files changed, 13 insertions(+), 13 deletions(-)

--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -114,7 +114,7 @@ static int __devinit xenkbd_probe(struct
                xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure");
                return -ENOMEM;
        }
-       dev->dev.driver_data = info;
+       dev_set_drvdata(&dev->dev, info);
        info->xbdev = dev;
        info->irq = -1;
        snprintf(info->phys, sizeof(info->phys), "xenbus/%s", dev->nodename);
@@ -186,7 +186,7 @@ static int __devinit xenkbd_probe(struct
 
 static int xenkbd_resume(struct xenbus_device *dev)
 {
-       struct xenkbd_info *info = dev->dev.driver_data;
+       struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
 
        xenkbd_disconnect_backend(info);
        memset(info->page, 0, PAGE_SIZE);
@@ -195,7 +195,7 @@ static int xenkbd_resume(struct xenbus_d
 
 static int xenkbd_remove(struct xenbus_device *dev)
 {
-       struct xenkbd_info *info = dev->dev.driver_data;
+       struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
 
        xenkbd_disconnect_backend(info);
        if (info->kbd)
@@ -266,7 +266,7 @@ static void xenkbd_disconnect_backend(st
 static void xenkbd_backend_changed(struct xenbus_device *dev,
                                   enum xenbus_state backend_state)
 {
-       struct xenkbd_info *info = dev->dev.driver_data;
+       struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
        int ret, val;
 
        switch (backend_state) {
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1212,7 +1212,7 @@ static int __devinit netfront_probe(stru
        }
 
        info = netdev_priv(netdev);
-       dev->dev.driver_data = info;
+       dev_set_drvdata(&dev->dev, info);
 
        err = register_netdev(info->netdev);
        if (err) {
@@ -1233,7 +1233,7 @@ static int __devinit netfront_probe(stru
 
  fail:
        free_netdev(netdev);
-       dev->dev.driver_data = NULL;
+       dev_set_drvdata(&dev->dev, NULL);
        return err;
 }
 
@@ -1275,7 +1275,7 @@ static void xennet_disconnect_backend(st
  */
 static int netfront_resume(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->dev.driver_data;
+       struct netfront_info *info = dev_get_drvdata(&dev->dev);
 
        dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
@@ -1600,7 +1600,7 @@ static int xennet_connect(struct net_dev
 static void backend_changed(struct xenbus_device *dev,
                            enum xenbus_state backend_state)
 {
-       struct netfront_info *np = dev->dev.driver_data;
+       struct netfront_info *np = dev_get_drvdata(&dev->dev);
        struct net_device *netdev = np->netdev;
 
        dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state));
@@ -1774,7 +1774,7 @@ static struct xenbus_device_id netfront_
 
 static int __devexit xennet_remove(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->dev.driver_data;
+       struct netfront_info *info = dev_get_drvdata(&dev->dev);
 
        dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -384,7 +384,7 @@ static int __devinit xenfb_probe(struct 
                fb_size = XENFB_DEFAULT_FB_LEN;
        }
 
-       dev->dev.driver_data = info;
+       dev_set_drvdata(&dev->dev, info);
        info->xbdev = dev;
        info->irq = -1;
        info->x1 = info->y1 = INT_MAX;
@@ -503,7 +503,7 @@ xenfb_make_preferred_console(void)
 
 static int xenfb_resume(struct xenbus_device *dev)
 {
-       struct xenfb_info *info = dev->dev.driver_data;
+       struct xenfb_info *info = dev_get_drvdata(&dev->dev);
 
        xenfb_disconnect_backend(info);
        xenfb_init_shared_page(info, info->fb_info);
@@ -512,7 +512,7 @@ static int xenfb_resume(struct xenbus_de
 
 static int xenfb_remove(struct xenbus_device *dev)
 {
-       struct xenfb_info *info = dev->dev.driver_data;
+       struct xenfb_info *info = dev_get_drvdata(&dev->dev);
 
        xenfb_disconnect_backend(info);
        if (info->fb_info) {
@@ -621,7 +621,7 @@ static void xenfb_disconnect_backend(str
 static void xenfb_backend_changed(struct xenbus_device *dev,
                                  enum xenbus_state backend_state)
 {
-       struct xenfb_info *info = dev->dev.driver_data;
+       struct xenfb_info *info = dev_get_drvdata(&dev->dev);
        int val;
 
        switch (backend_state) {

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

<Prev in Thread] Current Thread [Next in Thread>