aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/Kconfig2
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c12
-rw-r--r--drivers/xen/xenbus/xenbus_probe.h6
-rw-r--r--drivers/xen/xenbus/xenbus_probe_backend.c41
-rw-r--r--drivers/xen/xenbus/xenbus_probe_frontend.c28
5 files changed, 40 insertions, 49 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index 84bf17bbb1cd..554ed573c028 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -72,7 +72,7 @@ config XEN_SYS_HYPERVISOR
72 72
73config XEN_XENBUS_FRONTEND 73config XEN_XENBUS_FRONTEND
74 tristate 74 tristate
75 75
76config XEN_PLATFORM_PCI 76config XEN_PLATFORM_PCI
77 tristate "xen platform pci device driver" 77 tristate "xen platform pci device driver"
78 depends on XEN_PVHVM 78 depends on XEN_PVHVM
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 811923451218..baa65e7fbbc7 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -126,9 +126,11 @@ static int talk_to_otherend(struct xenbus_device *dev)
126 126
127static int watch_otherend(struct xenbus_device *dev) 127static int watch_otherend(struct xenbus_device *dev)
128{ 128{
129 struct xen_bus_type *bus = container_of(dev->dev.bus, struct xen_bus_type, bus); 129 struct xen_bus_type *bus =
130 container_of(dev->dev.bus, struct xen_bus_type, bus);
130 131
131 return xenbus_watch_pathfmt(dev, &dev->otherend_watch, bus->otherend_changed, 132 return xenbus_watch_pathfmt(dev, &dev->otherend_watch,
133 bus->otherend_changed,
132 "%s/%s", dev->otherend, "state"); 134 "%s/%s", dev->otherend, "state");
133} 135}
134 136
@@ -579,7 +581,8 @@ int xenbus_dev_suspend(struct device *dev, pm_message_t state)
579{ 581{
580 int err = 0; 582 int err = 0;
581 struct xenbus_driver *drv; 583 struct xenbus_driver *drv;
582 struct xenbus_device *xdev = container_of(dev, struct xenbus_device, dev); 584 struct xenbus_device *xdev
585 = container_of(dev, struct xenbus_device, dev);
583 586
584 DPRINTK("%s", xdev->nodename); 587 DPRINTK("%s", xdev->nodename);
585 588
@@ -599,7 +602,8 @@ int xenbus_dev_resume(struct device *dev)
599{ 602{
600 int err; 603 int err;
601 struct xenbus_driver *drv; 604 struct xenbus_driver *drv;
602 struct xenbus_device *xdev = container_of(dev, struct xenbus_device, dev); 605 struct xenbus_device *xdev
606 = container_of(dev, struct xenbus_device, dev);
603 607
604 DPRINTK("%s", xdev->nodename); 608 DPRINTK("%s", xdev->nodename);
605 609
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
index 0e5fc4c63eb2..24665812316a 100644
--- a/drivers/xen/xenbus/xenbus_probe.h
+++ b/drivers/xen/xenbus/xenbus_probe.h
@@ -41,8 +41,10 @@ struct xen_bus_type
41 char *root; 41 char *root;
42 unsigned int levels; 42 unsigned int levels;
43 int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); 43 int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename);
44 int (*probe)(struct xen_bus_type *bus, const char *type, const char *dir); 44 int (*probe)(struct xen_bus_type *bus, const char *type,
45 void (*otherend_changed)(struct xenbus_watch *watch, const char **vec, unsigned int len); 45 const char *dir);
46 void (*otherend_changed)(struct xenbus_watch *watch, const char **vec,
47 unsigned int len);
46 struct bus_type bus; 48 struct bus_type bus;
47}; 49};
48 50
diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
index 9b9dd36bb1c4..6cf467bf63ec 100644
--- a/drivers/xen/xenbus/xenbus_probe_backend.c
+++ b/drivers/xen/xenbus/xenbus_probe_backend.c
@@ -84,8 +84,8 @@ static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)
84 if (err) 84 if (err)
85 return err; 85 return err;
86 86
87 if (snprintf(bus_id, XEN_BUS_ID_SIZE, 87 if (snprintf(bus_id, XEN_BUS_ID_SIZE, "%.*s-%i-%s",
88 "%.*s-%i-%s", typelen, type, domid, devid) >= XEN_BUS_ID_SIZE) 88 typelen, type, domid, devid) >= XEN_BUS_ID_SIZE)
89 return -ENOSPC; 89 return -ENOSPC;
90 return 0; 90 return 0;
91} 91}
@@ -147,7 +147,8 @@ static int xenbus_probe_backend_unit(struct xen_bus_type *bus,
147} 147}
148 148
149/* backend/<typename>/<frontend-domid> */ 149/* backend/<typename>/<frontend-domid> */
150static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type, const char *domid) 150static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type,
151 const char *domid)
151{ 152{
152 char *nodename; 153 char *nodename;
153 int err = 0; 154 int err = 0;
@@ -188,18 +189,18 @@ static struct device_attribute xenbus_backend_dev_attrs[] = {
188 189
189static struct xen_bus_type xenbus_backend = { 190static struct xen_bus_type xenbus_backend = {
190 .root = "backend", 191 .root = "backend",
191 .levels = 3, /* backend/type/<frontend>/<id> */ 192 .levels = 3, /* backend/type/<frontend>/<id> */
192 .get_bus_id = backend_bus_id, 193 .get_bus_id = backend_bus_id,
193 .probe = xenbus_probe_backend, 194 .probe = xenbus_probe_backend,
194 .otherend_changed = frontend_changed, 195 .otherend_changed = frontend_changed,
195 .bus = { 196 .bus = {
196 .name = "xen-backend", 197 .name = "xen-backend",
197 .match = xenbus_match, 198 .match = xenbus_match,
198 .uevent = xenbus_uevent_backend, 199 .uevent = xenbus_uevent_backend,
199 .probe = xenbus_dev_probe, 200 .probe = xenbus_dev_probe,
200 .remove = xenbus_dev_remove, 201 .remove = xenbus_dev_remove,
201 .shutdown = xenbus_dev_shutdown, 202 .shutdown = xenbus_dev_shutdown,
202 .dev_attrs = xenbus_backend_dev_attrs, 203 .dev_attrs = xenbus_backend_dev_attrs,
203 }, 204 },
204}; 205};
205 206
@@ -221,24 +222,6 @@ static int read_frontend_details(struct xenbus_device *xendev)
221 return xenbus_read_otherend_details(xendev, "frontend-id", "frontend"); 222 return xenbus_read_otherend_details(xendev, "frontend-id", "frontend");
222} 223}
223 224
224//void xenbus_backend_suspend(int (*fn)(struct device *, void *))
225//{
226// DPRINTK("");
227// bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, fn);
228//}
229
230//void xenbus_backend_resume(int (*fn)(struct device *, void *))
231//{
232// DPRINTK("");
233// bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, fn);
234//}
235
236//int xenbus_for_each_backend(void *arg, int (*fn)(struct device *, void *))
237//{
238// return bus_for_each_dev(&xenbus_backend.bus, NULL, arg, fn);
239//}
240//EXPORT_SYMBOL_GPL(xenbus_for_each_backend);
241
242int xenbus_dev_is_online(struct xenbus_device *dev) 225int xenbus_dev_is_online(struct xenbus_device *dev)
243{ 226{
244 int rc, val; 227 int rc, val;
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 60c311ab3190..5bcc2d6cf129 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -46,7 +46,8 @@ static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)
46} 46}
47 47
48/* device/<typename>/<name> */ 48/* device/<typename>/<name> */
49static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type, const char *name) 49static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type,
50 const char *name)
50{ 51{
51 char *nodename; 52 char *nodename;
52 int err; 53 int err;
@@ -62,7 +63,8 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type, con
62 return err; 63 return err;
63} 64}
64 65
65static int xenbus_uevent_frontend(struct device *_dev, struct kobj_uevent_env *env) 66static int xenbus_uevent_frontend(struct device *_dev,
67 struct kobj_uevent_env *env)
66{ 68{
67 struct xenbus_device *dev = to_xenbus_device(_dev); 69 struct xenbus_device *dev = to_xenbus_device(_dev);
68 70
@@ -85,21 +87,21 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = {
85 87
86static struct xen_bus_type xenbus_frontend = { 88static struct xen_bus_type xenbus_frontend = {
87 .root = "device", 89 .root = "device",
88 .levels = 2, /* device/type/<id> */ 90 .levels = 2, /* device/type/<id> */
89 .get_bus_id = frontend_bus_id, 91 .get_bus_id = frontend_bus_id,
90 .probe = xenbus_probe_frontend, 92 .probe = xenbus_probe_frontend,
91 .otherend_changed = backend_changed, 93 .otherend_changed = backend_changed,
92 .bus = { 94 .bus = {
93 .name = "xen", 95 .name = "xen",
94 .match = xenbus_match, 96 .match = xenbus_match,
95 .uevent = xenbus_uevent_frontend, 97 .uevent = xenbus_uevent_frontend,
96 .probe = xenbus_dev_probe, 98 .probe = xenbus_dev_probe,
97 .remove = xenbus_dev_remove, 99 .remove = xenbus_dev_remove,
98 .shutdown = xenbus_dev_shutdown, 100 .shutdown = xenbus_dev_shutdown,
99 .dev_attrs= xenbus_frontend_dev_attrs, 101 .dev_attrs = xenbus_frontend_dev_attrs,
100 102
101 .suspend = xenbus_dev_suspend, 103 .suspend = xenbus_dev_suspend,
102 .resume = xenbus_dev_resume, 104 .resume = xenbus_dev_resume,
103 }, 105 },
104}; 106};
105 107