]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fec: Place the phy regulator in the private structure
authorFabio Estevam <fabio.estevam@freescale.com>
Mon, 27 May 2013 03:48:29 +0000 (03:48 +0000)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:54:19 +0000 (09:54 +0800)
Instead of using a local reg_phy structure, let's put it inside the private
structure, so that we are able to have access to the regulator structure even
when we are outside fec_probe().

This is in preparation for controlling the FEC PHY regulator in the suspend and
resume functions.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec.h
drivers/net/ethernet/freescale/fec_main.c

index 9ce5b7185fda196f521d439a143b3021b56ff5c3..b11cdbcc04ff5d6d518b9b5dc735d99626022554 100644 (file)
@@ -272,6 +272,7 @@ struct fec_enet_private {
        int hwts_tx_en;
        struct timer_list time_keep;
        struct fec_enet_delayed_work delay_work;
+       struct regulator *reg_phy;
 };
 
 void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev);
index a14b1380c00fc2f91f4e20fd2ce7b461da164043..e44f203eafca01967d555d58f085e9f27d150b1e 100644 (file)
@@ -1864,7 +1864,6 @@ fec_probe(struct platform_device *pdev)
        struct resource *r;
        const struct of_device_id *of_id;
        static int dev_id;
-       struct regulator *reg_phy;
 
        of_id = of_match_device(fec_dt_ids, &pdev->dev);
        if (of_id)
@@ -1945,9 +1944,9 @@ fec_probe(struct platform_device *pdev)
        clk_prepare_enable(fep->clk_enet_out);
        clk_prepare_enable(fep->clk_ptp);
 
-       reg_phy = devm_regulator_get(&pdev->dev, "phy");
-       if (!IS_ERR(reg_phy)) {
-               ret = regulator_enable(reg_phy);
+       fep->reg_phy = devm_regulator_get(&pdev->dev, "phy");
+       if (!IS_ERR(fep->reg_phy)) {
+               ret = regulator_enable(fep->reg_phy);
                if (ret) {
                        dev_err(&pdev->dev,
                                "Failed to enable phy regulator: %d\n", ret);