提交 8691b97b 编写于 作者: G Greg Kroah-Hartman

uml: remove driver_data direct access of struct device

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: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 5888fd30
...@@ -360,7 +360,7 @@ static struct platform_driver uml_net_driver = { ...@@ -360,7 +360,7 @@ static struct platform_driver uml_net_driver = {
static void net_device_release(struct device *dev) static void net_device_release(struct device *dev)
{ {
struct uml_net *device = dev->driver_data; struct uml_net *device = dev_get_drvdata(dev);
struct net_device *netdev = device->dev; struct net_device *netdev = device->dev;
struct uml_net_private *lp = netdev_priv(netdev); struct uml_net_private *lp = netdev_priv(netdev);
...@@ -440,7 +440,7 @@ static void eth_configure(int n, void *init, char *mac, ...@@ -440,7 +440,7 @@ static void eth_configure(int n, void *init, char *mac,
device->pdev.id = n; device->pdev.id = n;
device->pdev.name = DRIVER_NAME; device->pdev.name = DRIVER_NAME;
device->pdev.dev.release = net_device_release; device->pdev.dev.release = net_device_release;
device->pdev.dev.driver_data = device; dev_set_drvdata(&device->pdev.dev, device);
if (platform_device_register(&device->pdev)) if (platform_device_register(&device->pdev))
goto out_free_netdev; goto out_free_netdev;
SET_NETDEV_DEV(dev,&device->pdev.dev); SET_NETDEV_DEV(dev,&device->pdev.dev);
......
...@@ -778,7 +778,7 @@ static int ubd_open_dev(struct ubd *ubd_dev) ...@@ -778,7 +778,7 @@ static int ubd_open_dev(struct ubd *ubd_dev)
static void ubd_device_release(struct device *dev) static void ubd_device_release(struct device *dev)
{ {
struct ubd *ubd_dev = dev->driver_data; struct ubd *ubd_dev = dev_get_drvdata(dev);
blk_cleanup_queue(ubd_dev->queue); blk_cleanup_queue(ubd_dev->queue);
*ubd_dev = ((struct ubd) DEFAULT_UBD); *ubd_dev = ((struct ubd) DEFAULT_UBD);
...@@ -807,7 +807,7 @@ static int ubd_disk_register(int major, u64 size, int unit, ...@@ -807,7 +807,7 @@ static int ubd_disk_register(int major, u64 size, int unit,
ubd_devs[unit].pdev.id = unit; ubd_devs[unit].pdev.id = unit;
ubd_devs[unit].pdev.name = DRIVER_NAME; ubd_devs[unit].pdev.name = DRIVER_NAME;
ubd_devs[unit].pdev.dev.release = ubd_device_release; ubd_devs[unit].pdev.dev.release = ubd_device_release;
ubd_devs[unit].pdev.dev.driver_data = &ubd_devs[unit]; dev_set_drvdata(&ubd_devs[unit].pdev.dev, &ubd_devs[unit]);
platform_device_register(&ubd_devs[unit].pdev); platform_device_register(&ubd_devs[unit].pdev);
disk->driverfs_dev = &ubd_devs[unit].pdev.dev; disk->driverfs_dev = &ubd_devs[unit].pdev.dev;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册