diff options
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 1ba9d617d241..d2d4926c5c4c 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -1239,6 +1239,25 @@ static int __init early_platform_driver_probe_id(char *class_str, | |||
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | if (match) { | 1241 | if (match) { |
1242 | /* | ||
1243 | * Set up a sensible init_name to enable | ||
1244 | * dev_name() and others to be used before the | ||
1245 | * rest of the driver core is initialized. | ||
1246 | */ | ||
1247 | if (!match->dev.init_name) { | ||
1248 | char buf[32]; | ||
1249 | |||
1250 | if (match->id != -1) | ||
1251 | snprintf(buf, sizeof(buf), "%s.%d", | ||
1252 | match->name, match->id); | ||
1253 | else | ||
1254 | snprintf(buf, sizeof(buf), "%s", | ||
1255 | match->name); | ||
1256 | |||
1257 | match->dev.init_name = kstrdup(buf, GFP_KERNEL); | ||
1258 | if (!match->dev.init_name) | ||
1259 | return -ENOMEM; | ||
1260 | } | ||
1242 | if (epdrv->pdrv->probe(match)) | 1261 | if (epdrv->pdrv->probe(match)) |
1243 | pr_warning("%s: unable to probe %s early.\n", | 1262 | pr_warning("%s: unable to probe %s early.\n", |
1244 | class_str, match->name); | 1263 | class_str, match->name); |