diff mbox

[net-next,v1,18/21] net: phy: expose phy_aneg_done API for use by drivers

Message ID 20161103133046.3437.21618.stgit@tlendack-t1.amdoffice.net
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Tom Lendacky Nov. 3, 2016, 1:30 p.m. UTC
Make phy_aneg_done() available to drivers so that the result of the
auto-negotiation initiated by phy_start_aneg() can be determined.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/phy/phy.c |    3 ++-
 include/linux/phy.h   |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

kernel test robot Nov. 4, 2016, 2:13 a.m. UTC | #1
Hi Tom,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Tom-Lendacky/amd-xgbe-AMD-XGBE-driver-updates-2016-11-01/20161103-222344
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc 

All errors (new ones prefixed by >>):

>> drivers/net/ethernet/aeroflex/greth.c:1293:19: error: static declaration of 'phy_aneg_done' follows non-static declaration
    static inline int phy_aneg_done(struct phy_device *phydev)
                      ^~~~~~~~~~~~~
   In file included from include/net/dsa.h:19:0,
                    from include/linux/netdevice.h:44,
                    from drivers/net/ethernet/aeroflex/greth.c:29:
   include/linux/phy.h:789:5: note: previous declaration of 'phy_aneg_done' was here
    int phy_aneg_done(struct phy_device *phydev);
        ^~~~~~~~~~~~~

vim +/phy_aneg_done +1293 drivers/net/ethernet/aeroflex/greth.c

d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1287  	greth->speed = 0;
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1288  	greth->duplex = -1;
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1289  
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1290  	return 0;
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1291  }
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1292  
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 @1293  static inline int phy_aneg_done(struct phy_device *phydev)
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1294  {
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1295  	int retval;
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1296  

:::::: The code at line 1293 was first introduced by commit
:::::: d4c41139df6e74c6fff0cbac43e51cab782133be net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver

:::::: TO: Kristoffer Glembo <kristoffer@gaisler.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Tom Lendacky Nov. 7, 2016, 3:01 p.m. UTC | #2
On 11/03/2016 09:13 PM, kbuild test robot wrote:
> Hi Tom,
> 
> [auto build test ERROR on net-next/master]
> 
> url:    https://github.com/0day-ci/linux/commits/Tom-Lendacky/amd-xgbe-AMD-XGBE-driver-updates-2016-11-01/20161103-222344
> config: sparc-allyesconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=sparc 
> 
> All errors (new ones prefixed by >>):
> 
>>> drivers/net/ethernet/aeroflex/greth.c:1293:19: error: static declaration of 'phy_aneg_done' follows non-static declaration
>     static inline int phy_aneg_done(struct phy_device *phydev)
>                       ^~~~~~~~~~~~~
>    In file included from include/net/dsa.h:19:0,
>                     from include/linux/netdevice.h:44,
>                     from drivers/net/ethernet/aeroflex/greth.c:29:
>    include/linux/phy.h:789:5: note: previous declaration of 'phy_aneg_done' was here
>     int phy_aneg_done(struct phy_device *phydev);
>         ^~~~~~~~~~~~~
> 
> vim +/phy_aneg_done +1293 drivers/net/ethernet/aeroflex/greth.c
> 

Hi Andreas/Kristoffer,

Kbuild generated an error for this driver when I exposed the phylib
phy_aneg_done() function in the first version of my patches.  For this
driver, I have two choices:

  - Remove the phy_aneg_done() function from the aeroflex driver and
    have it use the phylib version which is now exported

  - Rename the current phy_aneg_done() function in the aeroflex driver
    and have the driver continue to use its version.

I think the first option is the way to go, but I don't have a sparc
machine on which to test it. Let me know which you would prefer and
I will include that in the second version of the patch submission.

Thanks,
Tom

> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1287  	greth->speed = 0;
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1288  	greth->duplex = -1;
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1289  
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1290  	return 0;
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1291  }
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1292  
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 @1293  static inline int phy_aneg_done(struct phy_device *phydev)
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1294  {
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1295  	int retval;
> d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15  1296  
> 
> :::::: The code at line 1293 was first introduced by commit
> :::::: d4c41139df6e74c6fff0cbac43e51cab782133be net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver
> 
> :::::: TO: Kristoffer Glembo <kristoffer@gaisler.com>
> :::::: CC: David S. Miller <davem@davemloft.net>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>
Andreas Larsson Nov. 8, 2016, 10:17 a.m. UTC | #3
On 2016-11-07 16:01, Tom Lendacky wrote:
> On 11/03/2016 09:13 PM, kbuild test robot wrote:
>> Hi Tom,
>>
>> [auto build test ERROR on net-next/master]
>>
>> url:    https://github.com/0day-ci/linux/commits/Tom-Lendacky/amd-xgbe-AMD-XGBE-driver-updates-2016-11-01/20161103-222344
>> config: sparc-allyesconfig (attached as .config)
>> compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
>> reproduce:
>>          wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>>          chmod +x ~/bin/make.cross
>>          # save the attached .config to linux build tree
>>          make.cross ARCH=sparc
>>
>> All errors (new ones prefixed by >>):
>>
>>>> drivers/net/ethernet/aeroflex/greth.c:1293:19: error: static declaration of 'phy_aneg_done' follows non-static declaration
>>      static inline int phy_aneg_done(struct phy_device *phydev)
>>                        ^~~~~~~~~~~~~
>>     In file included from include/net/dsa.h:19:0,
>>                      from include/linux/netdevice.h:44,
>>                      from drivers/net/ethernet/aeroflex/greth.c:29:
>>     include/linux/phy.h:789:5: note: previous declaration of 'phy_aneg_done' was here
>>      int phy_aneg_done(struct phy_device *phydev);
>>          ^~~~~~~~~~~~~
>>
>> vim +/phy_aneg_done +1293 drivers/net/ethernet/aeroflex/greth.c
>>
>
> Hi Andreas/Kristoffer,
>
> Kbuild generated an error for this driver when I exposed the phylib
> phy_aneg_done() function in the first version of my patches.  For this
> driver, I have two choices:
>
>    - Remove the phy_aneg_done() function from the aeroflex driver and
>      have it use the phylib version which is now exported
>
>    - Rename the current phy_aneg_done() function in the aeroflex driver
>      and have the driver continue to use its version.
>
> I think the first option is the way to go, but I don't have a sparc
> machine on which to test it. Let me know which you would prefer and
> I will include that in the second version of the patch submission.

Hi Tom,

Yes, the first option is the way to go.

Best regards,
Andreas Larsson
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 2f94c60..e6dd222 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -143,13 +143,14 @@  static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
  * Returns > 0 on success or < 0 on error. 0 means that auto-negotiation
  * is still pending.
  */
-static inline int phy_aneg_done(struct phy_device *phydev)
+int phy_aneg_done(struct phy_device *phydev)
 {
 	if (phydev->drv->aneg_done)
 		return phydev->drv->aneg_done(phydev);
 
 	return genphy_aneg_done(phydev);
 }
+EXPORT_SYMBOL(phy_aneg_done);
 
 /* A structure for mapping a particular speed and duplex
  * combination to a particular SUPPORTED and ADVERTISED value
diff --git a/include/linux/phy.h b/include/linux/phy.h
index e7e1fd3..9880d73 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -786,6 +786,7 @@  struct phy_device *phy_connect(struct net_device *dev, const char *bus_id,
 void phy_start(struct phy_device *phydev);
 void phy_stop(struct phy_device *phydev);
 int phy_start_aneg(struct phy_device *phydev);
+int phy_aneg_done(struct phy_device *phydev);
 
 int phy_stop_interrupts(struct phy_device *phydev);