From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kristoffer Glembo Subject: Re: phy_connect_direct problem Date: Tue, 27 Oct 2009 14:10:54 +0100 Message-ID: <4AE6F15E.6080806@gaisler.com> References: <4AE6CB6A.5050600@gaisler.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: netdev@vger.kernel.org Return-path: Received: from mail175c2.megamailservers.com ([69.49.111.75]:42129 "EHLO mail175c2.megamailservers.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754530AbZJ0NN3 (ORCPT ); Tue, 27 Oct 2009 09:13:29 -0400 Received: from [192.168.0.35] (c-10a5e155.260-1-64736c10.cust.bredbandsbolaget.se [85.225.165.16]) (authenticated bits=0) by mail175c2.megamailservers.com (8.13.6/8.13.1) with ESMTP id n9RDDVtR014817 for ; Tue, 27 Oct 2009 09:13:33 -0400 In-Reply-To: <4AE6CB6A.5050600@gaisler.com> Sender: netdev-owner@vger.kernel.org List-ID: Hi again, Please forget about this. I'm obviously blind as I can't see the difference between adjust_state and adjust_link ... Best regards, Kristoffer Glembo Kristoffer Glembo wrote: > Hi, > > I'm in the process of converting an ethernet driver to using the PHY > layer, but ran into a problem where my adjust_state handler was never > called and the link did not go up ... > > I use phy_connect to connect the PHY device with my ethernet driver. In > phy_connect_direct I found the following code: > > phy_prepare_link(phydev, handler); > phy_start_machine(phydev, NULL); > > So first the adjust_state is set to handler by phy_prepare_link and then > it is overwritten with the NULL parameter passed to phy_start_machine. > > Maybe I'm abusing the PHY layer somehow since there are plenty of other > drivers using this interface. However the patch below solved the issue > for me. > > Best regards, > Kristoffer Glembo > > > --- > drivers/net/phy/phy_device.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > index b10fedd..d27ca80 100644 > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c > @@ -311,8 +311,7 @@ int phy_connect_direct(struct net_device *dev, > struct phy_device *phydev, > if (rc) > return rc; > > - phy_prepare_link(phydev, handler); > - phy_start_machine(phydev, NULL); > + phy_start_machine(phydev, handler); > if (phydev->irq > 0) > phy_start_interrupts(phydev); >