direct-io.hg

changeset 10307:7cf4cbe7a3be

[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@xensource.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 09 14:23:50 2006 +0100 (2006-06-09)
parents db8ec1e48414
children 49f65e2b0f1c
files linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c linux-2.6-xen-sparse/include/xen/xenbus.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Fri Jun 09 14:20:09 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Fri Jun 09 14:23:50 2006 +0100
     1.3 @@ -331,7 +331,7 @@ out:
     1.4  static void backend_changed(struct xenbus_device *dev,
     1.5  			    enum xenbus_state backend_state)
     1.6  {
     1.7 -	struct tpm_private *tp = dev->data;
     1.8 +	struct tpm_private *tp = dev->dev.driver_data;
     1.9  	DPRINTK("\n");
    1.10  
    1.11  	switch (backend_state) {
    1.12 @@ -380,12 +380,12 @@ static int tpmfront_probe(struct xenbus_
    1.13  	}
    1.14  
    1.15  	tp->dev = dev;
    1.16 -	dev->data = tp;
    1.17 +	dev->dev.driver_data = tp;
    1.18  
    1.19  	err = talk_to_backend(dev, tp);
    1.20  	if (err) {
    1.21  		tpm_private_put();
    1.22 -		dev->data = NULL;
    1.23 +		dev->dev.driver_data = NULL;
    1.24  		return err;
    1.25  	}
    1.26  	return 0;
    1.27 @@ -394,14 +394,14 @@ static int tpmfront_probe(struct xenbus_
    1.28  
    1.29  static int tpmfront_remove(struct xenbus_device *dev)
    1.30  {
    1.31 -	struct tpm_private *tp = (struct tpm_private *)dev->data;
    1.32 +	struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
    1.33  	destroy_tpmring(tp);
    1.34  	return 0;
    1.35  }
    1.36  
    1.37  static int tpmfront_suspend(struct xenbus_device *dev)
    1.38  {
    1.39 -	struct tpm_private *tp = (struct tpm_private *)dev->data;
    1.40 +	struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
    1.41  	u32 ctr;
    1.42  
    1.43  	/* lock, so no app can send */
    1.44 @@ -431,7 +431,7 @@ static int tpmfront_suspend(struct xenbu
    1.45  
    1.46  static int tpmfront_resume(struct xenbus_device *dev)
    1.47  {
    1.48 -	struct tpm_private *tp = (struct tpm_private *)dev->data;
    1.49 +	struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
    1.50  	destroy_tpmring(tp);
    1.51  	return talk_to_backend(dev, tp);
    1.52  }
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Fri Jun 09 14:20:09 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Fri Jun 09 14:23:50 2006 +0100
     2.3 @@ -77,7 +77,7 @@ static ssize_t show_physical_device(stru
     2.4  				    struct device_attribute *attr, char *buf)
     2.5  {
     2.6  	struct xenbus_device *dev = to_xenbus_device(_dev);
     2.7 -	struct backend_info *be = dev->data;
     2.8 +	struct backend_info *be = dev->dev.driver_data;
     2.9  	return sprintf(buf, "%x:%x\n", be->major, be->minor);
    2.10  }
    2.11  DEVICE_ATTR(physical_device, S_IRUSR | S_IRGRP | S_IROTH,
    2.12 @@ -88,7 +88,7 @@ static ssize_t show_mode(struct device *
    2.13  			 char *buf)
    2.14  {
    2.15  	struct xenbus_device *dev = to_xenbus_device(_dev);
    2.16 -	struct backend_info *be = dev->data;
    2.17 +	struct backend_info *be = dev->dev.driver_data;
    2.18  	return sprintf(buf, "%s\n", be->mode);
    2.19  }
    2.20  DEVICE_ATTR(mode, S_IRUSR | S_IRGRP | S_IROTH, show_mode, NULL);
    2.21 @@ -96,7 +96,7 @@ DEVICE_ATTR(mode, S_IRUSR | S_IRGRP | S_
    2.22  
    2.23  static int blkback_remove(struct xenbus_device *dev)
    2.24  {
    2.25 -	struct backend_info *be = dev->data;
    2.26 +	struct backend_info *be = dev->dev.driver_data;
    2.27  
    2.28  	DPRINTK("");
    2.29  
    2.30 @@ -116,7 +116,7 @@ static int blkback_remove(struct xenbus_
    2.31  	device_remove_file(&dev->dev, &dev_attr_mode);
    2.32  
    2.33  	kfree(be);
    2.34 -	dev->data = NULL;
    2.35 +	dev->dev.driver_data = NULL;
    2.36  	return 0;
    2.37  }
    2.38  
    2.39 @@ -138,7 +138,7 @@ static int blkback_probe(struct xenbus_d
    2.40  		return -ENOMEM;
    2.41  	}
    2.42  	be->dev = dev;
    2.43 -	dev->data = be;
    2.44 +	dev->dev.driver_data = be;
    2.45  
    2.46  	be->blkif = blkif_alloc(dev->otherend_id);
    2.47  	if (IS_ERR(be->blkif)) {
    2.48 @@ -249,7 +249,7 @@ static void backend_changed(struct xenbu
    2.49  static void frontend_changed(struct xenbus_device *dev,
    2.50  			     enum xenbus_state frontend_state)
    2.51  {
    2.52 -	struct backend_info *be = dev->data;
    2.53 +	struct backend_info *be = dev->dev.driver_data;
    2.54  	int err;
    2.55  
    2.56  	DPRINTK("");
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Jun 09 14:20:09 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Jun 09 14:23:50 2006 +0100
     3.3 @@ -107,12 +107,12 @@ static int blkfront_probe(struct xenbus_
     3.4  
     3.5  	/* Front end dir is a number, which is used as the id. */
     3.6  	info->handle = simple_strtoul(strrchr(dev->nodename,'/')+1, NULL, 0);
     3.7 -	dev->data = info;
     3.8 +	dev->dev.driver_data = info;
     3.9  
    3.10  	err = talk_to_backend(dev, info);
    3.11  	if (err) {
    3.12  		kfree(info);
    3.13 -		dev->data = NULL;
    3.14 +		dev->dev.driver_data = NULL;
    3.15  		return err;
    3.16  	}
    3.17  
    3.18 @@ -128,7 +128,7 @@ static int blkfront_probe(struct xenbus_
    3.19   */
    3.20  static int blkfront_resume(struct xenbus_device *dev)
    3.21  {
    3.22 -	struct blkfront_info *info = dev->data;
    3.23 +	struct blkfront_info *info = dev->dev.driver_data;
    3.24  	int err;
    3.25  
    3.26  	DPRINTK("blkfront_resume: %s\n", dev->nodename);
    3.27 @@ -249,7 +249,7 @@ fail:
    3.28  static void backend_changed(struct xenbus_device *dev,
    3.29  			    enum xenbus_state backend_state)
    3.30  {
    3.31 -	struct blkfront_info *info = dev->data;
    3.32 +	struct blkfront_info *info = dev->dev.driver_data;
    3.33  	struct block_device *bd;
    3.34  
    3.35  	DPRINTK("blkfront:backend_changed.\n");
    3.36 @@ -341,7 +341,7 @@ static void connect(struct blkfront_info
    3.37   */
    3.38  static void blkfront_closing(struct xenbus_device *dev)
    3.39  {
    3.40 -	struct blkfront_info *info = dev->data;
    3.41 +	struct blkfront_info *info = dev->dev.driver_data;
    3.42  
    3.43  	DPRINTK("blkfront_closing: %s removed\n", dev->nodename);
    3.44  
    3.45 @@ -353,7 +353,7 @@ static void blkfront_closing(struct xenb
    3.46  
    3.47  static int blkfront_remove(struct xenbus_device *dev)
    3.48  {
    3.49 -	struct blkfront_info *info = dev->data;
    3.50 +	struct blkfront_info *info = dev->dev.driver_data;
    3.51  
    3.52  	DPRINTK("blkfront_remove: %s removed\n", dev->nodename);
    3.53  
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Fri Jun 09 14:20:09 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Fri Jun 09 14:23:50 2006 +0100
     4.3 @@ -44,7 +44,7 @@ static void backend_changed(struct xenbu
     4.4  
     4.5  static int netback_remove(struct xenbus_device *dev)
     4.6  {
     4.7 -	struct backend_info *be = dev->data;
     4.8 +	struct backend_info *be = dev->dev.driver_data;
     4.9  
    4.10  	if (be->backend_watch.node) {
    4.11  		unregister_xenbus_watch(&be->backend_watch);
    4.12 @@ -56,7 +56,7 @@ static int netback_remove(struct xenbus_
    4.13  		be->netif = NULL;
    4.14  	}
    4.15  	kfree(be);
    4.16 -	dev->data = NULL;
    4.17 +	dev->dev.driver_data = NULL;
    4.18  	return 0;
    4.19  }
    4.20  
    4.21 @@ -81,7 +81,7 @@ static int netback_probe(struct xenbus_d
    4.22  	}
    4.23  
    4.24  	be->dev = dev;
    4.25 -	dev->data = be;
    4.26 +	dev->dev.driver_data = be;
    4.27  
    4.28  	err = xenbus_watch_path2(dev, dev->nodename, "handle",
    4.29  				 &be->backend_watch, backend_changed);
    4.30 @@ -134,7 +134,7 @@ fail:
    4.31  static int netback_uevent(struct xenbus_device *xdev, char **envp,
    4.32  			  int num_envp, char *buffer, int buffer_size)
    4.33  {
    4.34 -	struct backend_info *be = xdev->data;
    4.35 +	struct backend_info *be = xdev->dev.driver_data;
    4.36  	netif_t *netif = be->netif;
    4.37  	int i = 0, length = 0;
    4.38  	char *val;
    4.39 @@ -213,7 +213,7 @@ static void backend_changed(struct xenbu
    4.40  static void frontend_changed(struct xenbus_device *dev,
    4.41  			     enum xenbus_state frontend_state)
    4.42  {
    4.43 -	struct backend_info *be = dev->data;
    4.44 +	struct backend_info *be = dev->dev.driver_data;
    4.45  
    4.46  	DPRINTK("");
    4.47  
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Jun 09 14:20:09 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Jun 09 14:23:50 2006 +0100
     5.3 @@ -207,14 +207,14 @@ static int __devinit netfront_probe(stru
     5.4  	}
     5.5  
     5.6  	info = netdev_priv(netdev);
     5.7 -	dev->data = info;
     5.8 +	dev->dev.driver_data = info;
     5.9  
    5.10  	err = talk_to_backend(dev, info);
    5.11  	if (err) {
    5.12  		xennet_sysfs_delif(info->netdev);
    5.13  		unregister_netdev(netdev);
    5.14  		free_netdev(netdev);
    5.15 -		dev->data = NULL;
    5.16 +		dev->dev.driver_data = NULL;
    5.17  		return err;
    5.18  	}
    5.19  
    5.20 @@ -230,7 +230,7 @@ static int __devinit netfront_probe(stru
    5.21   */
    5.22  static int netfront_resume(struct xenbus_device *dev)
    5.23  {
    5.24 -	struct netfront_info *info = dev->data;
    5.25 +	struct netfront_info *info = dev->dev.driver_data;
    5.26  
    5.27  	DPRINTK("%s\n", dev->nodename);
    5.28  
    5.29 @@ -394,7 +394,7 @@ static int setup_device(struct xenbus_de
    5.30  static void backend_changed(struct xenbus_device *dev,
    5.31  			    enum xenbus_state backend_state)
    5.32  {
    5.33 -	struct netfront_info *np = dev->data;
    5.34 +	struct netfront_info *np = dev->dev.driver_data;
    5.35  	struct net_device *netdev = np->netdev;
    5.36  
    5.37  	DPRINTK("\n");
    5.38 @@ -1475,7 +1475,7 @@ inetdev_notify(struct notifier_block *th
    5.39   */
    5.40  static void netfront_closing(struct xenbus_device *dev)
    5.41  {
    5.42 -	struct netfront_info *info = dev->data;
    5.43 +	struct netfront_info *info = dev->dev.driver_data;
    5.44  
    5.45  	DPRINTK("netfront_closing: %s removed\n", dev->nodename);
    5.46  
    5.47 @@ -1487,7 +1487,7 @@ static void netfront_closing(struct xenb
    5.48  
    5.49  static int __devexit netfront_remove(struct xenbus_device *dev)
    5.50  {
    5.51 -	struct netfront_info *info = dev->data;
    5.52 +	struct netfront_info *info = dev->dev.driver_data;
    5.53  
    5.54  	DPRINTK("%s\n", dev->nodename);
    5.55  
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c	Fri Jun 09 14:20:09 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c	Fri Jun 09 14:23:50 2006 +0100
     6.3 @@ -23,7 +23,7 @@ static struct pciback_device *alloc_pdev
     6.4  	dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev);
     6.5  
     6.6  	pdev->xdev = xdev;
     6.7 -	xdev->data = pdev;
     6.8 +	xdev->dev.driver_data = pdev;
     6.9  
    6.10  	spin_lock_init(&pdev->dev_lock);
    6.11  
    6.12 @@ -61,7 +61,7 @@ static void free_pdev(struct pciback_dev
    6.13  
    6.14  	pciback_release_devices(pdev);
    6.15  
    6.16 -	pdev->xdev->data = NULL;
    6.17 +	pdev->xdev->dev.driver_data = NULL;
    6.18  	pdev->xdev = NULL;
    6.19  
    6.20  	kfree(pdev);
    6.21 @@ -168,7 +168,7 @@ static int pciback_attach(struct pciback
    6.22  static void pciback_frontend_changed(struct xenbus_device *xdev,
    6.23  				     enum xenbus_state fe_state)
    6.24  {
    6.25 -	struct pciback_device *pdev = xdev->data;
    6.26 +	struct pciback_device *pdev = xdev->dev.driver_data;
    6.27  
    6.28  	dev_dbg(&xdev->dev, "fe state changed %d\n", fe_state);
    6.29  
    6.30 @@ -421,7 +421,7 @@ static int pciback_xenbus_probe(struct x
    6.31  
    6.32  static int pciback_xenbus_remove(struct xenbus_device *dev)
    6.33  {
    6.34 -	struct pciback_device *pdev = dev->data;
    6.35 +	struct pciback_device *pdev = dev->dev.driver_data;
    6.36  
    6.37  	if (pdev != NULL)
    6.38  		free_pdev(pdev);
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c	Fri Jun 09 14:20:09 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c	Fri Jun 09 14:23:50 2006 +0100
     7.3 @@ -29,7 +29,7 @@ static struct pcifront_device *alloc_pde
     7.4  	}
     7.5  	pdev->sh_info->flags = 0;
     7.6  
     7.7 -	xdev->data = pdev;
     7.8 +	xdev->dev.driver_data = pdev;
     7.9  	pdev->xdev = xdev;
    7.10  
    7.11  	INIT_LIST_HEAD(&pdev->root_buses);
    7.12 @@ -59,7 +59,7 @@ static void free_pdev(struct pcifront_de
    7.13  		gnttab_end_foreign_access(pdev->gnt_ref, 0,
    7.14  					  (unsigned long)pdev->sh_info);
    7.15  
    7.16 -	pdev->xdev->data = NULL;
    7.17 +	pdev->xdev->dev.driver_data = NULL;
    7.18  
    7.19  	kfree(pdev);
    7.20  }
    7.21 @@ -216,7 +216,7 @@ static int pcifront_try_disconnect(struc
    7.22  static void pcifront_backend_changed(struct xenbus_device *xdev,
    7.23  				     enum xenbus_state be_state)
    7.24  {
    7.25 -	struct pcifront_device *pdev = xdev->data;
    7.26 +	struct pcifront_device *pdev = xdev->dev.driver_data;
    7.27  
    7.28  	switch (be_state) {
    7.29  	case XenbusStateClosing:
    7.30 @@ -261,8 +261,8 @@ static int pcifront_xenbus_probe(struct 
    7.31  
    7.32  static int pcifront_xenbus_remove(struct xenbus_device *xdev)
    7.33  {
    7.34 -	if (xdev->data)
    7.35 -		free_pdev(xdev->data);
    7.36 +	if (xdev->dev.driver_data)
    7.37 +		free_pdev(xdev->dev.driver_data);
    7.38  
    7.39  	return 0;
    7.40  }
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Fri Jun 09 14:20:09 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Fri Jun 09 14:23:50 2006 +0100
     8.3 @@ -47,7 +47,7 @@ static void frontend_changed(struct xenb
     8.4  
     8.5  static int tpmback_remove(struct xenbus_device *dev)
     8.6  {
     8.7 -	struct backend_info *be = dev->data;
     8.8 +	struct backend_info *be = dev->dev.driver_data;
     8.9  
    8.10  	if (!be) return 0;
    8.11  
    8.12 @@ -62,7 +62,7 @@ static int tpmback_remove(struct xenbus_
    8.13  		be->tpmif = NULL;
    8.14  	}
    8.15  	kfree(be);
    8.16 -	dev->data = NULL;
    8.17 +	dev->dev.driver_data = NULL;
    8.18  	return 0;
    8.19  }
    8.20  
    8.21 @@ -81,7 +81,7 @@ static int tpmback_probe(struct xenbus_d
    8.22  
    8.23  	be->is_instance_set = 0;
    8.24  	be->dev = dev;
    8.25 -	dev->data = be;
    8.26 +	dev->dev.driver_data = be;
    8.27  
    8.28  	err = xenbus_watch_path2(dev, dev->nodename,
    8.29  	                        "instance", &be->backend_watch,
    8.30 @@ -131,7 +131,7 @@ static void backend_changed(struct xenbu
    8.31  static void frontend_changed(struct xenbus_device *dev,
    8.32                               enum xenbus_state frontend_state)
    8.33  {
    8.34 -	struct backend_info *be = dev->data;
    8.35 +	struct backend_info *be = dev->dev.driver_data;
    8.36  	int err;
    8.37  
    8.38  	be->frontend_state = frontend_state;
     9.1 --- a/linux-2.6-xen-sparse/include/xen/xenbus.h	Fri Jun 09 14:20:09 2006 +0100
     9.2 +++ b/linux-2.6-xen-sparse/include/xen/xenbus.h	Fri Jun 09 14:23:50 2006 +0100
     9.3 @@ -76,7 +76,6 @@ struct xenbus_device {
     9.4  	struct xenbus_watch otherend_watch;
     9.5  	struct device dev;
     9.6  	enum xenbus_state state;
     9.7 -	void *data;
     9.8  };
     9.9  
    9.10  static inline struct xenbus_device *to_xenbus_device(struct device *dev)