]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - drivers/base/platform.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux-2.6.git] / drivers / base / platform.c
index 4b4b565c835f9c1c6da550fdb7d69ae27396fbf0..ada6397c23a588c1955f1b2d66a7d97ea84d38bc 100644 (file)
@@ -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;
@@ -967,17 +967,17 @@ static int platform_pm_restore_noirq(struct device *dev)
 
 int __weak platform_pm_runtime_suspend(struct device *dev)
 {
-       return -ENOSYS;
+       return pm_generic_runtime_suspend(dev);
 };
 
 int __weak platform_pm_runtime_resume(struct device *dev)
 {
-       return -ENOSYS;
+       return pm_generic_runtime_resume(dev);
 };
 
 int __weak platform_pm_runtime_idle(struct device *dev)
 {
-       return -ENOSYS;
+       return pm_generic_runtime_idle(dev);
 };
 
 #else /* !CONFIG_PM_RUNTIME */
@@ -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);