diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-10 14:35:36 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-10 14:35:36 -0500 |
commit | 4ba24fef3eb3b142197135223b90ced2f319cd53 (patch) | |
tree | a20c125b27740ec7b4c761b11d801108e1b316b2 /drivers/base/platform.c | |
parent | 47c1ffb2b6b630894e9a16442611c056ab21c057 (diff) | |
parent | 98a4a59ee31a12105a2b84f5b8b515ac2cb208ef (diff) |
Merge branch 'next' into for-linus
Prepare first round of input updates for 3.20.
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index ab4f4ce02722..9421fed40905 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/pm_runtime.h> | 23 | #include <linux/pm_runtime.h> |
24 | #include <linux/pm_domain.h> | ||
24 | #include <linux/idr.h> | 25 | #include <linux/idr.h> |
25 | #include <linux/acpi.h> | 26 | #include <linux/acpi.h> |
26 | #include <linux/clk/clk-conf.h> | 27 | #include <linux/clk/clk-conf.h> |
@@ -506,11 +507,12 @@ static int platform_drv_probe(struct device *_dev) | |||
506 | if (ret < 0) | 507 | if (ret < 0) |
507 | return ret; | 508 | return ret; |
508 | 509 | ||
509 | acpi_dev_pm_attach(_dev, true); | 510 | ret = dev_pm_domain_attach(_dev, true); |
510 | 511 | if (ret != -EPROBE_DEFER) { | |
511 | ret = drv->probe(dev); | 512 | ret = drv->probe(dev); |
512 | if (ret) | 513 | if (ret) |
513 | acpi_dev_pm_detach(_dev, true); | 514 | dev_pm_domain_detach(_dev, true); |
515 | } | ||
514 | 516 | ||
515 | if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) { | 517 | if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) { |
516 | dev_warn(_dev, "probe deferral not supported\n"); | 518 | dev_warn(_dev, "probe deferral not supported\n"); |
@@ -532,7 +534,7 @@ static int platform_drv_remove(struct device *_dev) | |||
532 | int ret; | 534 | int ret; |
533 | 535 | ||
534 | ret = drv->remove(dev); | 536 | ret = drv->remove(dev); |
535 | acpi_dev_pm_detach(_dev, true); | 537 | dev_pm_domain_detach(_dev, true); |
536 | 538 | ||
537 | return ret; | 539 | return ret; |
538 | } | 540 | } |
@@ -543,7 +545,7 @@ static void platform_drv_shutdown(struct device *_dev) | |||
543 | struct platform_device *dev = to_platform_device(_dev); | 545 | struct platform_device *dev = to_platform_device(_dev); |
544 | 546 | ||
545 | drv->shutdown(dev); | 547 | drv->shutdown(dev); |
546 | acpi_dev_pm_detach(_dev, true); | 548 | dev_pm_domain_detach(_dev, true); |
547 | } | 549 | } |
548 | 550 | ||
549 | /** | 551 | /** |
@@ -578,9 +580,10 @@ void platform_driver_unregister(struct platform_driver *drv) | |||
578 | EXPORT_SYMBOL_GPL(platform_driver_unregister); | 580 | EXPORT_SYMBOL_GPL(platform_driver_unregister); |
579 | 581 | ||
580 | /** | 582 | /** |
581 | * platform_driver_probe - register driver for non-hotpluggable device | 583 | * __platform_driver_probe - register driver for non-hotpluggable device |
582 | * @drv: platform driver structure | 584 | * @drv: platform driver structure |
583 | * @probe: the driver probe routine, probably from an __init section | 585 | * @probe: the driver probe routine, probably from an __init section |
586 | * @module: module which will be the owner of the driver | ||
584 | * | 587 | * |
585 | * Use this instead of platform_driver_register() when you know the device | 588 | * Use this instead of platform_driver_register() when you know the device |
586 | * is not hotpluggable and has already been registered, and you want to | 589 | * is not hotpluggable and has already been registered, and you want to |
@@ -596,8 +599,8 @@ EXPORT_SYMBOL_GPL(platform_driver_unregister); | |||
596 | * Returns zero if the driver registered and bound to a device, else returns | 599 | * Returns zero if the driver registered and bound to a device, else returns |
597 | * a negative error code and with the driver not registered. | 600 | * a negative error code and with the driver not registered. |
598 | */ | 601 | */ |
599 | int __init_or_module platform_driver_probe(struct platform_driver *drv, | 602 | int __init_or_module __platform_driver_probe(struct platform_driver *drv, |
600 | int (*probe)(struct platform_device *)) | 603 | int (*probe)(struct platform_device *), struct module *module) |
601 | { | 604 | { |
602 | int retval, code; | 605 | int retval, code; |
603 | 606 | ||
@@ -612,7 +615,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, | |||
612 | 615 | ||
613 | /* temporary section violation during probe() */ | 616 | /* temporary section violation during probe() */ |
614 | drv->probe = probe; | 617 | drv->probe = probe; |
615 | retval = code = platform_driver_register(drv); | 618 | retval = code = __platform_driver_register(drv, module); |
616 | 619 | ||
617 | /* | 620 | /* |
618 | * Fixup that section violation, being paranoid about code scanning | 621 | * Fixup that section violation, being paranoid about code scanning |
@@ -631,27 +634,28 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, | |||
631 | platform_driver_unregister(drv); | 634 | platform_driver_unregister(drv); |
632 | return retval; | 635 | return retval; |
633 | } | 636 | } |
634 | EXPORT_SYMBOL_GPL(platform_driver_probe); | 637 | EXPORT_SYMBOL_GPL(__platform_driver_probe); |
635 | 638 | ||
636 | /** | 639 | /** |
637 | * platform_create_bundle - register driver and create corresponding device | 640 | * __platform_create_bundle - register driver and create corresponding device |
638 | * @driver: platform driver structure | 641 | * @driver: platform driver structure |
639 | * @probe: the driver probe routine, probably from an __init section | 642 | * @probe: the driver probe routine, probably from an __init section |
640 | * @res: set of resources that needs to be allocated for the device | 643 | * @res: set of resources that needs to be allocated for the device |
641 | * @n_res: number of resources | 644 | * @n_res: number of resources |
642 | * @data: platform specific data for this platform device | 645 | * @data: platform specific data for this platform device |
643 | * @size: size of platform specific data | 646 | * @size: size of platform specific data |
647 | * @module: module which will be the owner of the driver | ||
644 | * | 648 | * |
645 | * Use this in legacy-style modules that probe hardware directly and | 649 | * Use this in legacy-style modules that probe hardware directly and |
646 | * register a single platform device and corresponding platform driver. | 650 | * register a single platform device and corresponding platform driver. |
647 | * | 651 | * |
648 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. | 652 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. |
649 | */ | 653 | */ |
650 | struct platform_device * __init_or_module platform_create_bundle( | 654 | struct platform_device * __init_or_module __platform_create_bundle( |
651 | struct platform_driver *driver, | 655 | struct platform_driver *driver, |
652 | int (*probe)(struct platform_device *), | 656 | int (*probe)(struct platform_device *), |
653 | struct resource *res, unsigned int n_res, | 657 | struct resource *res, unsigned int n_res, |
654 | const void *data, size_t size) | 658 | const void *data, size_t size, struct module *module) |
655 | { | 659 | { |
656 | struct platform_device *pdev; | 660 | struct platform_device *pdev; |
657 | int error; | 661 | int error; |
@@ -674,7 +678,7 @@ struct platform_device * __init_or_module platform_create_bundle( | |||
674 | if (error) | 678 | if (error) |
675 | goto err_pdev_put; | 679 | goto err_pdev_put; |
676 | 680 | ||
677 | error = platform_driver_probe(driver, probe); | 681 | error = __platform_driver_probe(driver, probe, module); |
678 | if (error) | 682 | if (error) |
679 | goto err_pdev_del; | 683 | goto err_pdev_del; |
680 | 684 | ||
@@ -687,7 +691,7 @@ err_pdev_put: | |||
687 | err_out: | 691 | err_out: |
688 | return ERR_PTR(error); | 692 | return ERR_PTR(error); |
689 | } | 693 | } |
690 | EXPORT_SYMBOL_GPL(platform_create_bundle); | 694 | EXPORT_SYMBOL_GPL(__platform_create_bundle); |
691 | 695 | ||
692 | /* modalias support enables more hands-off userspace setup: | 696 | /* modalias support enables more hands-off userspace setup: |
693 | * (a) environment variable lets new-style hotplug events work once system is | 697 | * (a) environment variable lets new-style hotplug events work once system is |
@@ -1004,6 +1008,7 @@ int __init platform_bus_init(void) | |||
1004 | error = bus_register(&platform_bus_type); | 1008 | error = bus_register(&platform_bus_type); |
1005 | if (error) | 1009 | if (error) |
1006 | device_unregister(&platform_bus); | 1010 | device_unregister(&platform_bus); |
1011 | of_platform_register_reconfig_notifier(); | ||
1007 | return error; | 1012 | return error; |
1008 | } | 1013 | } |
1009 | 1014 | ||