diff options
Diffstat (limited to 'drivers/xen/xenbus')
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 27 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.h | 4 |
2 files changed, 18 insertions, 13 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 7f24a98a446f..b2a03184a246 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -99,15 +99,15 @@ static int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /* device/<type>/<id> => <type>-<id> */ | 101 | /* device/<type>/<id> => <type>-<id> */ |
102 | static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) | 102 | static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) |
103 | { | 103 | { |
104 | nodename = strchr(nodename, '/'); | 104 | nodename = strchr(nodename, '/'); |
105 | if (!nodename || strlen(nodename + 1) >= BUS_ID_SIZE) { | 105 | if (!nodename || strlen(nodename + 1) >= XEN_BUS_ID_SIZE) { |
106 | printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename); | 106 | printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename); |
107 | return -EINVAL; | 107 | return -EINVAL; |
108 | } | 108 | } |
109 | 109 | ||
110 | strlcpy(bus_id, nodename + 1, BUS_ID_SIZE); | 110 | strlcpy(bus_id, nodename + 1, XEN_BUS_ID_SIZE); |
111 | if (!strchr(bus_id, '/')) { | 111 | if (!strchr(bus_id, '/')) { |
112 | printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id); | 112 | printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id); |
113 | return -EINVAL; | 113 | return -EINVAL; |
@@ -460,6 +460,7 @@ int xenbus_probe_node(struct xen_bus_type *bus, | |||
460 | const char *type, | 460 | const char *type, |
461 | const char *nodename) | 461 | const char *nodename) |
462 | { | 462 | { |
463 | char devname[XEN_BUS_ID_SIZE]; | ||
463 | int err; | 464 | int err; |
464 | struct xenbus_device *xendev; | 465 | struct xenbus_device *xendev; |
465 | size_t stringlen; | 466 | size_t stringlen; |
@@ -494,10 +495,12 @@ int xenbus_probe_node(struct xen_bus_type *bus, | |||
494 | xendev->dev.bus = &bus->bus; | 495 | xendev->dev.bus = &bus->bus; |
495 | xendev->dev.release = xenbus_dev_release; | 496 | xendev->dev.release = xenbus_dev_release; |
496 | 497 | ||
497 | err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename); | 498 | err = bus->get_bus_id(devname, xendev->nodename); |
498 | if (err) | 499 | if (err) |
499 | goto fail; | 500 | goto fail; |
500 | 501 | ||
502 | dev_set_name(&xendev->dev, devname); | ||
503 | |||
501 | /* Register with generic device framework. */ | 504 | /* Register with generic device framework. */ |
502 | err = device_register(&xendev->dev); | 505 | err = device_register(&xendev->dev); |
503 | if (err) | 506 | if (err) |
@@ -611,7 +614,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) | |||
611 | { | 614 | { |
612 | int exists, rootlen; | 615 | int exists, rootlen; |
613 | struct xenbus_device *dev; | 616 | struct xenbus_device *dev; |
614 | char type[BUS_ID_SIZE]; | 617 | char type[XEN_BUS_ID_SIZE]; |
615 | const char *p, *root; | 618 | const char *p, *root; |
616 | 619 | ||
617 | if (char_count(node, '/') < 2) | 620 | if (char_count(node, '/') < 2) |
@@ -625,8 +628,8 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) | |||
625 | 628 | ||
626 | /* backend/<type>/... or device/<type>/... */ | 629 | /* backend/<type>/... or device/<type>/... */ |
627 | p = strchr(node, '/') + 1; | 630 | p = strchr(node, '/') + 1; |
628 | snprintf(type, BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); | 631 | snprintf(type, XEN_BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); |
629 | type[BUS_ID_SIZE-1] = '\0'; | 632 | type[XEN_BUS_ID_SIZE-1] = '\0'; |
630 | 633 | ||
631 | rootlen = strsep_len(node, '/', bus->levels); | 634 | rootlen = strsep_len(node, '/', bus->levels); |
632 | if (rootlen < 0) | 635 | if (rootlen < 0) |
@@ -674,7 +677,7 @@ static int suspend_dev(struct device *dev, void *data) | |||
674 | err = drv->suspend(xdev); | 677 | err = drv->suspend(xdev); |
675 | if (err) | 678 | if (err) |
676 | printk(KERN_WARNING | 679 | printk(KERN_WARNING |
677 | "xenbus: suspend %s failed: %i\n", dev->bus_id, err); | 680 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); |
678 | return 0; | 681 | return 0; |
679 | } | 682 | } |
680 | 683 | ||
@@ -695,7 +698,7 @@ static int suspend_cancel_dev(struct device *dev, void *data) | |||
695 | if (err) | 698 | if (err) |
696 | printk(KERN_WARNING | 699 | printk(KERN_WARNING |
697 | "xenbus: suspend_cancel %s failed: %i\n", | 700 | "xenbus: suspend_cancel %s failed: %i\n", |
698 | dev->bus_id, err); | 701 | dev_name(dev), err); |
699 | return 0; | 702 | return 0; |
700 | } | 703 | } |
701 | 704 | ||
@@ -717,7 +720,7 @@ static int resume_dev(struct device *dev, void *data) | |||
717 | if (err) { | 720 | if (err) { |
718 | printk(KERN_WARNING | 721 | printk(KERN_WARNING |
719 | "xenbus: resume (talk_to_otherend) %s failed: %i\n", | 722 | "xenbus: resume (talk_to_otherend) %s failed: %i\n", |
720 | dev->bus_id, err); | 723 | dev_name(dev), err); |
721 | return err; | 724 | return err; |
722 | } | 725 | } |
723 | 726 | ||
@@ -728,7 +731,7 @@ static int resume_dev(struct device *dev, void *data) | |||
728 | if (err) { | 731 | if (err) { |
729 | printk(KERN_WARNING | 732 | printk(KERN_WARNING |
730 | "xenbus: resume %s failed: %i\n", | 733 | "xenbus: resume %s failed: %i\n", |
731 | dev->bus_id, err); | 734 | dev_name(dev), err); |
732 | return err; | 735 | return err; |
733 | } | 736 | } |
734 | } | 737 | } |
@@ -737,7 +740,7 @@ static int resume_dev(struct device *dev, void *data) | |||
737 | if (err) { | 740 | if (err) { |
738 | printk(KERN_WARNING | 741 | printk(KERN_WARNING |
739 | "xenbus_probe: resume (watch_otherend) %s failed: " | 742 | "xenbus_probe: resume (watch_otherend) %s failed: " |
740 | "%d.\n", dev->bus_id, err); | 743 | "%d.\n", dev_name(dev), err); |
741 | return err; | 744 | return err; |
742 | } | 745 | } |
743 | 746 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h index e09b19415a40..6c5e3185a6a2 100644 --- a/drivers/xen/xenbus/xenbus_probe.h +++ b/drivers/xen/xenbus/xenbus_probe.h | |||
@@ -34,6 +34,8 @@ | |||
34 | #ifndef _XENBUS_PROBE_H | 34 | #ifndef _XENBUS_PROBE_H |
35 | #define _XENBUS_PROBE_H | 35 | #define _XENBUS_PROBE_H |
36 | 36 | ||
37 | #define XEN_BUS_ID_SIZE 20 | ||
38 | |||
37 | #ifdef CONFIG_XEN_BACKEND | 39 | #ifdef CONFIG_XEN_BACKEND |
38 | extern void xenbus_backend_suspend(int (*fn)(struct device *, void *)); | 40 | extern void xenbus_backend_suspend(int (*fn)(struct device *, void *)); |
39 | extern void xenbus_backend_resume(int (*fn)(struct device *, void *)); | 41 | extern void xenbus_backend_resume(int (*fn)(struct device *, void *)); |
@@ -52,7 +54,7 @@ struct xen_bus_type | |||
52 | { | 54 | { |
53 | char *root; | 55 | char *root; |
54 | unsigned int levels; | 56 | unsigned int levels; |
55 | int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename); | 57 | int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); |
56 | int (*probe)(const char *type, const char *dir); | 58 | int (*probe)(const char *type, const char *dir); |
57 | struct bus_type bus; | 59 | struct bus_type bus; |
58 | }; | 60 | }; |