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

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


  • To: jeremy@xxxxxxxxxxxxx
  • From: Roel Kluin <roel.kluin@xxxxxxxxx>
  • Date: Mon, 11 May 2009 21:07:08 +0200
  • Cc: virtualization@xxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, lkml <linux-kernel@xxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 12 May 2009 12:20:19 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=SJkDuc0lVN/MOkCZ6lob5TNyXI1e1HTB5N8x1xHQrlvb3GL7aK9bDEnpDg+68nJ7rc JxIesE2yQtA61oEUvgFatejFsaTZPZr2v9J3Kl9uxhKRtyoPtGSkPblDrsWpeN//A3QR OIHdYWCZ/IsLqcGfLTkBZiwyIBb3A3D8OuF/U=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

To avoid direct access to the driver_data pointer in struct device, the
functions dev_get_drvdata() and dev_set_drvdata() should be used.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
index 928d2ed..b115726 100644
--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -114,7 +114,7 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev,
                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 xenbus_device *dev,
 
 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_device *dev)
 
 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(struct xenkbd_info 
*info)
 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) {

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


 


Rackspace

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