aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-05-25 02:38:26 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-05-25 02:38:26 -0400
commitb1e50ebcf24668e57f058deb48b0704b5391ed0f (patch)
tree17e1b69b249d0738317b732186340c9dd053f1a1 /drivers/base/platform.c
parent0c2a2ae32793e3500a15a449612485f5d17dd431 (diff)
parent7e125f7b9cbfce4101191b8076d606c517a73066 (diff)
Merge remote branch 'origin' into secretlab/next-spi
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r--drivers/base/platform.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 4b4b565c835f..4d99c8bdfedc 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(platform_device_alloc);
187 * released. 187 * released.
188 */ 188 */
189int platform_device_add_resources(struct platform_device *pdev, 189int platform_device_add_resources(struct platform_device *pdev,
190 struct resource *res, unsigned int num) 190 const struct resource *res, unsigned int num)
191{ 191{
192 struct resource *r; 192 struct resource *r;
193 193
@@ -367,7 +367,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister);
367 */ 367 */
368struct platform_device *platform_device_register_simple(const char *name, 368struct platform_device *platform_device_register_simple(const char *name,
369 int id, 369 int id,
370 struct resource *res, 370 const struct resource *res,
371 unsigned int num) 371 unsigned int num)
372{ 372{
373 struct platform_device *pdev; 373 struct platform_device *pdev;
@@ -735,7 +735,7 @@ static void platform_pm_complete(struct device *dev)
735 735
736#ifdef CONFIG_SUSPEND 736#ifdef CONFIG_SUSPEND
737 737
738static int platform_pm_suspend(struct device *dev) 738int __weak platform_pm_suspend(struct device *dev)
739{ 739{
740 struct device_driver *drv = dev->driver; 740 struct device_driver *drv = dev->driver;
741 int ret = 0; 741 int ret = 0;
@@ -753,7 +753,7 @@ static int platform_pm_suspend(struct device *dev)
753 return ret; 753 return ret;
754} 754}
755 755
756static int platform_pm_suspend_noirq(struct device *dev) 756int __weak platform_pm_suspend_noirq(struct device *dev)
757{ 757{
758 struct device_driver *drv = dev->driver; 758 struct device_driver *drv = dev->driver;
759 int ret = 0; 759 int ret = 0;
@@ -769,7 +769,7 @@ static int platform_pm_suspend_noirq(struct device *dev)
769 return ret; 769 return ret;
770} 770}
771 771
772static int platform_pm_resume(struct device *dev) 772int __weak platform_pm_resume(struct device *dev)
773{ 773{
774 struct device_driver *drv = dev->driver; 774 struct device_driver *drv = dev->driver;
775 int ret = 0; 775 int ret = 0;
@@ -787,7 +787,7 @@ static int platform_pm_resume(struct device *dev)
787 return ret; 787 return ret;
788} 788}
789 789
790static int platform_pm_resume_noirq(struct device *dev) 790int __weak platform_pm_resume_noirq(struct device *dev)
791{ 791{
792 struct device_driver *drv = dev->driver; 792 struct device_driver *drv = dev->driver;
793 int ret = 0; 793 int ret = 0;
@@ -967,17 +967,17 @@ static int platform_pm_restore_noirq(struct device *dev)
967 967
968int __weak platform_pm_runtime_suspend(struct device *dev) 968int __weak platform_pm_runtime_suspend(struct device *dev)
969{ 969{
970 return -ENOSYS; 970 return pm_generic_runtime_suspend(dev);
971}; 971};
972 972
973int __weak platform_pm_runtime_resume(struct device *dev) 973int __weak platform_pm_runtime_resume(struct device *dev)
974{ 974{
975 return -ENOSYS; 975 return pm_generic_runtime_resume(dev);
976}; 976};
977 977
978int __weak platform_pm_runtime_idle(struct device *dev) 978int __weak platform_pm_runtime_idle(struct device *dev)
979{ 979{
980 return -ENOSYS; 980 return pm_generic_runtime_idle(dev);
981}; 981};
982 982
983#else /* !CONFIG_PM_RUNTIME */ 983#else /* !CONFIG_PM_RUNTIME */
@@ -1254,6 +1254,26 @@ static int __init early_platform_driver_probe_id(char *class_str,
1254 } 1254 }
1255 1255
1256 if (match) { 1256 if (match) {
1257 /*
1258 * Set up a sensible init_name to enable
1259 * dev_name() and others to be used before the
1260 * rest of the driver core is initialized.
1261 */
1262 if (!match->dev.init_name && slab_is_available()) {
1263 if (match->id != -1)
1264 match->dev.init_name =
1265 kasprintf(GFP_KERNEL, "%s.%d",
1266 match->name,
1267 match->id);
1268 else
1269 match->dev.init_name =
1270 kasprintf(GFP_KERNEL, "%s",
1271 match->name);
1272
1273 if (!match->dev.init_name)
1274 return -ENOMEM;
1275 }
1276
1257 if (epdrv->pdrv->probe(match)) 1277 if (epdrv->pdrv->probe(match))
1258 pr_warning("%s: unable to probe %s early.\n", 1278 pr_warning("%s: unable to probe %s early.\n",
1259 class_str, match->name); 1279 class_str, match->name);