@@ -542,8 +542,7 @@ static const u16 phy2speed[] = {
542542};
543543
544544static struct platform_device * dpaa_eth_add_device (int fman_id ,
545- struct mac_device * mac_dev ,
546- struct device_node * node )
545+ struct mac_device * mac_dev )
547546{
548547 struct platform_device * pdev ;
549548 struct dpaa_eth_data data ;
@@ -556,10 +555,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id,
556555 data .mac_dev = mac_dev ;
557556 data .mac_hw_id = priv -> cell_index ;
558557 data .fman_hw_id = fman_id ;
559- data .mac_node = node ;
560558
561559 mutex_lock (& eth_lock );
562-
563560 pdev = platform_device_alloc ("dpaa-ethernet" , dpaa_eth_dev_cnt );
564561 if (!pdev ) {
565562 ret = - ENOMEM ;
@@ -648,9 +645,6 @@ static int mac_probe(struct platform_device *_of_dev)
648645 goto _return ;
649646 }
650647
651- /* Register mac_dev */
652- dev_set_drvdata (dev , mac_dev );
653-
654648 INIT_LIST_HEAD (& priv -> mc_addr_list );
655649
656650 /* Get the FM node */
@@ -659,7 +653,7 @@ static int mac_probe(struct platform_device *_of_dev)
659653 dev_err (dev , "of_get_parent(%pOF) failed\n" ,
660654 mac_node );
661655 err = - EINVAL ;
662- goto _return_dev_set_drvdata ;
656+ goto _return_of_get_parent ;
663657 }
664658
665659 of_dev = of_find_device_by_node (dev_node );
@@ -693,7 +687,7 @@ static int mac_probe(struct platform_device *_of_dev)
693687 if (err < 0 ) {
694688 dev_err (dev , "of_address_to_resource(%pOF) = %d\n" ,
695689 mac_node , err );
696- goto _return_dev_set_drvdata ;
690+ goto _return_of_get_parent ;
697691 }
698692
699693 mac_dev -> res = __devm_request_region (dev ,
@@ -703,15 +697,15 @@ static int mac_probe(struct platform_device *_of_dev)
703697 if (!mac_dev -> res ) {
704698 dev_err (dev , "__devm_request_mem_region(mac) failed\n" );
705699 err = - EBUSY ;
706- goto _return_dev_set_drvdata ;
700+ goto _return_of_get_parent ;
707701 }
708702
709703 priv -> vaddr = devm_ioremap (dev , mac_dev -> res -> start ,
710704 mac_dev -> res -> end + 1 - mac_dev -> res -> start );
711705 if (!priv -> vaddr ) {
712706 dev_err (dev , "devm_ioremap() failed\n" );
713707 err = - EIO ;
714- goto _return_dev_set_drvdata ;
708+ goto _return_of_get_parent ;
715709 }
716710
717711 if (!of_device_is_available (mac_node )) {
@@ -728,7 +722,7 @@ static int mac_probe(struct platform_device *_of_dev)
728722 if (err ) {
729723 dev_err (dev , "failed to read cell-index for %pOF\n" , mac_node );
730724 err = - EINVAL ;
731- goto _return_dev_set_drvdata ;
725+ goto _return_of_get_parent ;
732726 }
733727 priv -> cell_index = (u8 )val ;
734728
@@ -737,7 +731,7 @@ static int mac_probe(struct platform_device *_of_dev)
737731 if (!mac_addr ) {
738732 dev_err (dev , "of_get_mac_address(%pOF) failed\n" , mac_node );
739733 err = - EINVAL ;
740- goto _return_dev_set_drvdata ;
734+ goto _return_of_get_parent ;
741735 }
742736 memcpy (mac_dev -> addr , mac_addr , sizeof (mac_dev -> addr ));
743737
@@ -747,14 +741,14 @@ static int mac_probe(struct platform_device *_of_dev)
747741 dev_err (dev , "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n" ,
748742 mac_node );
749743 err = nph ;
750- goto _return_dev_set_drvdata ;
744+ goto _return_of_get_parent ;
751745 }
752746
753747 if (nph != ARRAY_SIZE (mac_dev -> port )) {
754748 dev_err (dev , "Not supported number of fman-ports handles of mac node %pOF from device tree\n" ,
755749 mac_node );
756750 err = - EINVAL ;
757- goto _return_dev_set_drvdata ;
751+ goto _return_of_get_parent ;
758752 }
759753
760754 for (i = 0 ; i < ARRAY_SIZE (mac_dev -> port ); i ++ ) {
@@ -818,20 +812,20 @@ static int mac_probe(struct platform_device *_of_dev)
818812
819813 err = of_phy_register_fixed_link (mac_node );
820814 if (err )
821- goto _return_dev_set_drvdata ;
815+ goto _return_of_get_parent ;
822816
823817 priv -> fixed_link = kzalloc (sizeof (* priv -> fixed_link ),
824818 GFP_KERNEL );
825819 if (!priv -> fixed_link ) {
826820 err = - ENOMEM ;
827- goto _return_dev_set_drvdata ;
821+ goto _return_of_get_parent ;
828822 }
829823
830824 mac_dev -> phy_node = of_node_get (mac_node );
831825 phy = of_phy_find_device (mac_dev -> phy_node );
832826 if (!phy ) {
833827 err = - EINVAL ;
834- goto _return_dev_set_drvdata ;
828+ goto _return_of_get_parent ;
835829 }
836830
837831 priv -> fixed_link -> link = phy -> link ;
@@ -847,7 +841,7 @@ static int mac_probe(struct platform_device *_of_dev)
847841 if (err < 0 ) {
848842 dev_err (dev , "mac_dev->init() = %d\n" , err );
849843 of_node_put (mac_dev -> phy_node );
850- goto _return_dev_set_drvdata ;
844+ goto _return_of_get_parent ;
851845 }
852846
853847 /* pause frame autonegotiation enabled */
@@ -868,7 +862,7 @@ static int mac_probe(struct platform_device *_of_dev)
868862 mac_dev -> addr [0 ], mac_dev -> addr [1 ], mac_dev -> addr [2 ],
869863 mac_dev -> addr [3 ], mac_dev -> addr [4 ], mac_dev -> addr [5 ]);
870864
871- priv -> eth_dev = dpaa_eth_add_device (fman_id , mac_dev , mac_node );
865+ priv -> eth_dev = dpaa_eth_add_device (fman_id , mac_dev );
872866 if (IS_ERR (priv -> eth_dev )) {
873867 dev_err (dev , "failed to add Ethernet platform device for MAC %d\n" ,
874868 priv -> cell_index );
@@ -879,9 +873,8 @@ static int mac_probe(struct platform_device *_of_dev)
879873
880874_return_of_node_put :
881875 of_node_put (dev_node );
882- _return_dev_set_drvdata :
876+ _return_of_get_parent :
883877 kfree (priv -> fixed_link );
884- dev_set_drvdata (dev , NULL );
885878_return :
886879 return err ;
887880}
0 commit comments