aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-05-30 13:45:12 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-08-21 13:15:37 -0400
commitc906a48adc74fc455378137ac5124b13e7030a15 (patch)
treebcbbebf937f74e0e123517dd9d2c1742d61dd3fc /drivers/base
parent3b98aeaf3a75f544dc945694f4fcf6e1c4bab89d (diff)
driver core: add init_name to struct device
This gives us a way to handle both the bus_id and init_name values being used for a while during the transition period. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 40041319657d..d021c98605b3 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -844,13 +844,19 @@ int device_add(struct device *dev)
844{ 844{
845 struct device *parent = NULL; 845 struct device *parent = NULL;
846 struct class_interface *class_intf; 846 struct class_interface *class_intf;
847 int error; 847 int error = -EINVAL;
848 848
849 dev = get_device(dev); 849 dev = get_device(dev);
850 if (!dev || !strlen(dev->bus_id)) { 850 if (!dev)
851 error = -EINVAL; 851 goto done;
852 goto Done; 852
853 } 853 /* Temporarily support init_name if it is set.
854 * It will override bus_id for now */
855 if (dev->init_name)
856 dev_set_name(dev, "%s", dev->init_name);
857
858 if (!strlen(dev->bus_id))
859 goto done;
854 860
855 pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 861 pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
856 862
@@ -919,7 +925,7 @@ int device_add(struct device *dev)
919 class_intf->add_dev(dev, class_intf); 925 class_intf->add_dev(dev, class_intf);
920 mutex_unlock(&dev->class->p->class_mutex); 926 mutex_unlock(&dev->class->p->class_mutex);
921 } 927 }
922 Done: 928done:
923 put_device(dev); 929 put_device(dev);
924 return error; 930 return error;
925 DPMError: 931 DPMError:
@@ -946,7 +952,7 @@ int device_add(struct device *dev)
946 cleanup_device_parent(dev); 952 cleanup_device_parent(dev);
947 if (parent) 953 if (parent)
948 put_device(parent); 954 put_device(parent);
949 goto Done; 955 goto done;
950} 956}
951 957
952/** 958/**