X-Git-Url: https://git.kernel.dk/?p=linux-2.6-block.git;a=blobdiff_plain;f=drivers%2Fbase%2Fplatform.c;h=765bcf0df3bbaf2a22635990f85294a70167d900;hp=4b4b565c835f9c1c6da550fdb7d69ae27396fbf0;hb=7c7cbaf5b82c418cd3b1dcf718f71d0e6057e639;hpb=2fed94c032316d89422d4abfca2a882897489b94 diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 4b4b565c835f..765bcf0df3bb 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(platform_device_alloc); * released. */ int platform_device_add_resources(struct platform_device *pdev, - struct resource *res, unsigned int num) + const struct resource *res, unsigned int num) { struct resource *r; @@ -367,7 +367,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister); */ struct platform_device *platform_device_register_simple(const char *name, int id, - struct resource *res, + const struct resource *res, unsigned int num) { struct platform_device *pdev; @@ -1254,6 +1254,26 @@ static int __init early_platform_driver_probe_id(char *class_str, } if (match) { + /* + * Set up a sensible init_name to enable + * dev_name() and others to be used before the + * rest of the driver core is initialized. + */ + if (!match->dev.init_name && slab_is_available()) { + if (match->id != -1) + match->dev.init_name = + kasprintf(GFP_KERNEL, "%s.%d", + match->name, + match->id); + else + match->dev.init_name = + kasprintf(GFP_KERNEL, "%s", + match->name); + + if (!match->dev.init_name) + return -ENOMEM; + } + if (epdrv->pdrv->probe(match)) pr_warning("%s: unable to probe %s early.\n", class_str, match->name);