diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2015-03-05 15:35:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-06 00:18:20 -0500 |
commit | f1a26a062f03b27fa52f62487897fe205303fa7f (patch) | |
tree | 971ed79d0d42a376dbb4b9dd7182310f4a5a2aad /net/dsa | |
parent | 496127290f298d839918a14728b653b43ef02708 (diff) |
net: dsa: update dsa_of_{probe, remove} to use a device pointer
In preparation for allowing a different mechanism to register DSA switch
devices and driver, update dsa_of_probe and dsa_of_remove to take a
struct device pointer since neither of these two functions uses the
struct platform_device pointer.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index a1d1f0775bea..d804364150bd 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -563,9 +563,9 @@ static void dsa_of_free_platform_data(struct dsa_platform_data *pd) | |||
563 | kfree(pd->chip); | 563 | kfree(pd->chip); |
564 | } | 564 | } |
565 | 565 | ||
566 | static int dsa_of_probe(struct platform_device *pdev) | 566 | static int dsa_of_probe(struct device *dev) |
567 | { | 567 | { |
568 | struct device_node *np = pdev->dev.of_node; | 568 | struct device_node *np = dev->of_node; |
569 | struct device_node *child, *mdio, *ethernet, *port, *link; | 569 | struct device_node *child, *mdio, *ethernet, *port, *link; |
570 | struct mii_bus *mdio_bus; | 570 | struct mii_bus *mdio_bus; |
571 | struct platform_device *ethernet_dev; | 571 | struct platform_device *ethernet_dev; |
@@ -597,7 +597,7 @@ static int dsa_of_probe(struct platform_device *pdev) | |||
597 | if (!pd) | 597 | if (!pd) |
598 | return -ENOMEM; | 598 | return -ENOMEM; |
599 | 599 | ||
600 | pdev->dev.platform_data = pd; | 600 | dev->platform_data = pd; |
601 | pd->netdev = ðernet_dev->dev; | 601 | pd->netdev = ðernet_dev->dev; |
602 | pd->nr_chips = of_get_available_child_count(np); | 602 | pd->nr_chips = of_get_available_child_count(np); |
603 | if (pd->nr_chips > DSA_MAX_SWITCHES) | 603 | if (pd->nr_chips > DSA_MAX_SWITCHES) |
@@ -670,27 +670,27 @@ out_free_chip: | |||
670 | dsa_of_free_platform_data(pd); | 670 | dsa_of_free_platform_data(pd); |
671 | out_free: | 671 | out_free: |
672 | kfree(pd); | 672 | kfree(pd); |
673 | pdev->dev.platform_data = NULL; | 673 | dev->platform_data = NULL; |
674 | return ret; | 674 | return ret; |
675 | } | 675 | } |
676 | 676 | ||
677 | static void dsa_of_remove(struct platform_device *pdev) | 677 | static void dsa_of_remove(struct device *dev) |
678 | { | 678 | { |
679 | struct dsa_platform_data *pd = pdev->dev.platform_data; | 679 | struct dsa_platform_data *pd = dev->platform_data; |
680 | 680 | ||
681 | if (!pdev->dev.of_node) | 681 | if (!dev->of_node) |
682 | return; | 682 | return; |
683 | 683 | ||
684 | dsa_of_free_platform_data(pd); | 684 | dsa_of_free_platform_data(pd); |
685 | kfree(pd); | 685 | kfree(pd); |
686 | } | 686 | } |
687 | #else | 687 | #else |
688 | static inline int dsa_of_probe(struct platform_device *pdev) | 688 | static inline int dsa_of_probe(struct device *dev) |
689 | { | 689 | { |
690 | return 0; | 690 | return 0; |
691 | } | 691 | } |
692 | 692 | ||
693 | static inline void dsa_of_remove(struct platform_device *pdev) | 693 | static inline void dsa_of_remove(struct device *dev) |
694 | { | 694 | { |
695 | } | 695 | } |
696 | #endif | 696 | #endif |
@@ -706,7 +706,7 @@ static int dsa_probe(struct platform_device *pdev) | |||
706 | dsa_driver_version); | 706 | dsa_driver_version); |
707 | 707 | ||
708 | if (pdev->dev.of_node) { | 708 | if (pdev->dev.of_node) { |
709 | ret = dsa_of_probe(pdev); | 709 | ret = dsa_of_probe(&pdev->dev); |
710 | if (ret) | 710 | if (ret) |
711 | return ret; | 711 | return ret; |
712 | 712 | ||
@@ -777,7 +777,7 @@ static int dsa_probe(struct platform_device *pdev) | |||
777 | return 0; | 777 | return 0; |
778 | 778 | ||
779 | out: | 779 | out: |
780 | dsa_of_remove(pdev); | 780 | dsa_of_remove(&pdev->dev); |
781 | 781 | ||
782 | return ret; | 782 | return ret; |
783 | } | 783 | } |
@@ -799,7 +799,7 @@ static int dsa_remove(struct platform_device *pdev) | |||
799 | dsa_switch_destroy(ds); | 799 | dsa_switch_destroy(ds); |
800 | } | 800 | } |
801 | 801 | ||
802 | dsa_of_remove(pdev); | 802 | dsa_of_remove(&pdev->dev); |
803 | 803 | ||
804 | return 0; | 804 | return 0; |
805 | } | 805 | } |