diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/bus.c | 4 | ||||
-rw-r--r-- | drivers/base/core.c | 5 | ||||
-rw-r--r-- | drivers/base/driver.c | 4 | ||||
-rw-r--r-- | drivers/base/platform.c | 22 | ||||
-rw-r--r-- | drivers/base/power/main.c | 4 |
5 files changed, 18 insertions, 21 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index dc030f1f00f1..c6599618523e 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -700,8 +700,10 @@ int bus_add_driver(struct device_driver *drv) | |||
700 | } | 700 | } |
701 | 701 | ||
702 | kobject_uevent(&priv->kobj, KOBJ_ADD); | 702 | kobject_uevent(&priv->kobj, KOBJ_ADD); |
703 | return error; | 703 | return 0; |
704 | out_unregister: | 704 | out_unregister: |
705 | kfree(drv->p); | ||
706 | drv->p = NULL; | ||
705 | kobject_put(&priv->kobj); | 707 | kobject_put(&priv->kobj); |
706 | out_put_bus: | 708 | out_put_bus: |
707 | bus_put(bus); | 709 | bus_put(bus); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 4aa527b8a913..1977d4beb89e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -879,7 +879,7 @@ int device_add(struct device *dev) | |||
879 | } | 879 | } |
880 | 880 | ||
881 | if (!dev_name(dev)) | 881 | if (!dev_name(dev)) |
882 | goto done; | 882 | goto name_error; |
883 | 883 | ||
884 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); | 884 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); |
885 | 885 | ||
@@ -978,6 +978,9 @@ done: | |||
978 | cleanup_device_parent(dev); | 978 | cleanup_device_parent(dev); |
979 | if (parent) | 979 | if (parent) |
980 | put_device(parent); | 980 | put_device(parent); |
981 | name_error: | ||
982 | kfree(dev->p); | ||
983 | dev->p = NULL; | ||
981 | goto done; | 984 | goto done; |
982 | } | 985 | } |
983 | 986 | ||
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index c51f11bb29ae..8ae0f63602e0 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -257,6 +257,10 @@ EXPORT_SYMBOL_GPL(driver_register); | |||
257 | */ | 257 | */ |
258 | void driver_unregister(struct device_driver *drv) | 258 | void driver_unregister(struct device_driver *drv) |
259 | { | 259 | { |
260 | if (!drv || !drv->p) { | ||
261 | WARN(1, "Unexpected driver unregister!\n"); | ||
262 | return; | ||
263 | } | ||
260 | driver_remove_groups(drv, drv->groups); | 264 | driver_remove_groups(drv, drv->groups); |
261 | bus_remove_driver(drv); | 265 | bus_remove_driver(drv); |
262 | } | 266 | } |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index b5b6c973a2e0..8b4708e06244 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -217,7 +217,6 @@ int platform_device_add_data(struct platform_device *pdev, const void *data, | |||
217 | if (d) { | 217 | if (d) { |
218 | memcpy(d, data, size); | 218 | memcpy(d, data, size); |
219 | pdev->dev.platform_data = d; | 219 | pdev->dev.platform_data = d; |
220 | pdev->platform_data = d; | ||
221 | } | 220 | } |
222 | return d ? 0 : -ENOMEM; | 221 | return d ? 0 : -ENOMEM; |
223 | } | 222 | } |
@@ -247,21 +246,6 @@ int platform_device_add(struct platform_device *pdev) | |||
247 | else | 246 | else |
248 | dev_set_name(&pdev->dev, pdev->name); | 247 | dev_set_name(&pdev->dev, pdev->name); |
249 | 248 | ||
250 | /* We will remove platform_data field from struct device | ||
251 | * if all platform devices pass its platform specific data | ||
252 | * from platform_device. The conversion is going to be a | ||
253 | * long time, so we allow the two cases coexist to make | ||
254 | * this kind of fix more easily*/ | ||
255 | if (pdev->platform_data && pdev->dev.platform_data) { | ||
256 | printk(KERN_ERR | ||
257 | "%s: use which platform_data?\n", | ||
258 | dev_name(&pdev->dev)); | ||
259 | } else if (pdev->platform_data) { | ||
260 | pdev->dev.platform_data = pdev->platform_data; | ||
261 | } else if (pdev->dev.platform_data) { | ||
262 | pdev->platform_data = pdev->dev.platform_data; | ||
263 | } | ||
264 | |||
265 | for (i = 0; i < pdev->num_resources; i++) { | 249 | for (i = 0; i < pdev->num_resources; i++) { |
266 | struct resource *p, *r = &pdev->resource[i]; | 250 | struct resource *p, *r = &pdev->resource[i]; |
267 | 251 | ||
@@ -1028,7 +1012,7 @@ static __initdata LIST_HEAD(early_platform_device_list); | |||
1028 | 1012 | ||
1029 | /** | 1013 | /** |
1030 | * early_platform_driver_register | 1014 | * early_platform_driver_register |
1031 | * @edrv: early_platform driver structure | 1015 | * @epdrv: early_platform driver structure |
1032 | * @buf: string passed from early_param() | 1016 | * @buf: string passed from early_param() |
1033 | */ | 1017 | */ |
1034 | int __init early_platform_driver_register(struct early_platform_driver *epdrv, | 1018 | int __init early_platform_driver_register(struct early_platform_driver *epdrv, |
@@ -1112,7 +1096,7 @@ void __init early_platform_driver_register_all(char *class_str) | |||
1112 | 1096 | ||
1113 | /** | 1097 | /** |
1114 | * early_platform_match | 1098 | * early_platform_match |
1115 | * @edrv: early platform driver structure | 1099 | * @epdrv: early platform driver structure |
1116 | * @id: id to match against | 1100 | * @id: id to match against |
1117 | */ | 1101 | */ |
1118 | static __init struct platform_device * | 1102 | static __init struct platform_device * |
@@ -1130,7 +1114,7 @@ early_platform_match(struct early_platform_driver *epdrv, int id) | |||
1130 | 1114 | ||
1131 | /** | 1115 | /** |
1132 | * early_platform_left | 1116 | * early_platform_left |
1133 | * @edrv: early platform driver structure | 1117 | * @epdrv: early platform driver structure |
1134 | * @id: return true if id or above exists | 1118 | * @id: return true if id or above exists |
1135 | */ | 1119 | */ |
1136 | static __init int early_platform_left(struct early_platform_driver *epdrv, | 1120 | static __init int early_platform_left(struct early_platform_driver *epdrv, |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 69b4ddb7de3b..3e4bc699bc0f 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -357,6 +357,7 @@ static void dpm_power_up(pm_message_t state) | |||
357 | { | 357 | { |
358 | struct device *dev; | 358 | struct device *dev; |
359 | 359 | ||
360 | mutex_lock(&dpm_list_mtx); | ||
360 | list_for_each_entry(dev, &dpm_list, power.entry) | 361 | list_for_each_entry(dev, &dpm_list, power.entry) |
361 | if (dev->power.status > DPM_OFF) { | 362 | if (dev->power.status > DPM_OFF) { |
362 | int error; | 363 | int error; |
@@ -366,6 +367,7 @@ static void dpm_power_up(pm_message_t state) | |||
366 | if (error) | 367 | if (error) |
367 | pm_dev_err(dev, state, " early", error); | 368 | pm_dev_err(dev, state, " early", error); |
368 | } | 369 | } |
370 | mutex_unlock(&dpm_list_mtx); | ||
369 | } | 371 | } |
370 | 372 | ||
371 | /** | 373 | /** |
@@ -614,6 +616,7 @@ int device_power_down(pm_message_t state) | |||
614 | int error = 0; | 616 | int error = 0; |
615 | 617 | ||
616 | suspend_device_irqs(); | 618 | suspend_device_irqs(); |
619 | mutex_lock(&dpm_list_mtx); | ||
617 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { | 620 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { |
618 | error = suspend_device_noirq(dev, state); | 621 | error = suspend_device_noirq(dev, state); |
619 | if (error) { | 622 | if (error) { |
@@ -622,6 +625,7 @@ int device_power_down(pm_message_t state) | |||
622 | } | 625 | } |
623 | dev->power.status = DPM_OFF_IRQ; | 626 | dev->power.status = DPM_OFF_IRQ; |
624 | } | 627 | } |
628 | mutex_unlock(&dpm_list_mtx); | ||
625 | if (error) | 629 | if (error) |
626 | device_power_up(resume_event(state)); | 630 | device_power_up(resume_event(state)); |
627 | return error; | 631 | return error; |