diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-01-06 13:44:34 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-06 13:44:34 -0500 |
commit | 2a678cc53977c97aaf666c338f6312b7bbd3406d (patch) | |
tree | c8308543a71f7468792de28d48680e4793ddd8b3 /drivers/xen/xenbus/xenbus_probe.c | |
parent | 035da16fb529c0383ac27c712a5bbade5c11cafe (diff) |
xen: struct device - replace bus_id with dev_name(), dev_set_name()
CC: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/xen/xenbus/xenbus_probe.c')
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 27 |
1 files changed, 15 insertions, 12 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 | ||