From patchwork Wed Apr 27 11:34:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Frias X-Patchwork-Id: 615573 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qvz1Y4pRWz9t3w for ; Wed, 27 Apr 2016 21:55:45 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=laposte.net header.i=@laposte.net header.b=d1ijfz+1; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752485AbcD0Lze (ORCPT ); Wed, 27 Apr 2016 07:55:34 -0400 Received: from smtpoutz300.laposte.net ([178.22.154.200]:54075 "EHLO smtp.laposte.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752473AbcD0LzY (ORCPT ); Wed, 27 Apr 2016 07:55:24 -0400 X-Greylist: delayed 1255 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Apr 2016 07:55:24 EDT Received: from smtp.laposte.net (localhost [127.0.0.1]) by lpn-prd-vrout012 (Postfix) with ESMTP id 6DB5A8C803 for ; Wed, 27 Apr 2016 13:34:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=laposte.net; s=mail1; t=1461756866; bh=YkGDYDovUUsQ4EKl/twieBUqd7mtqfk1VD4vIpn5hMU=; h=Date:From:To:CC:Subject; b=d1ijfz+1NwEVqD2445CSVTQFZEWtJsvUV6QvYkaFuF2sxJ6bMGugNbBb3wsOPGODt quiPTvL0VDfUsERTwIZh7Qspfqkki53NPIyMyZ4lzPuQ4MqYTHDNqEf1uJNfQiWg9A f5Axz1IPpvDk4Xi5V6fF9E/NPr8/ZpPmyEB02AvNXfoIUJ3JeEAxGgVEcW89+BkNgQ HwF4lDOqSraJcmrAj4BZF77egqP88f1uM17Go3OfEPblgyiQwa+lkmoKyJ08p1fo/F kbvoCZi1Xam3pZKp/+0s06TKHGhIBefqgQhffCF94IlZWGrvWyxQpnX9perbSmJfvq RX9q9p8v19VzQ== Received: from lpn-prd-vrin001 (lpn-prd-vrin001.prosodie [10.128.63.2]) by lpn-prd-vrout012 (Postfix) with ESMTP id 69AC78C678 for ; Wed, 27 Apr 2016 13:34:26 +0200 (CEST) Received: from lpn-prd-vrin001 (localhost [127.0.0.1]) by lpn-prd-vrin001 (Postfix) with ESMTP id 49C6236696A for ; Wed, 27 Apr 2016 13:34:26 +0200 (CEST) Received: from [172.27.0.214] (ovpn12414.celeste.fr [83.142.147.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lpn-prd-vrin001 (Postfix) with ESMTPSA id D7AE936688C; Wed, 27 Apr 2016 13:34:25 +0200 (CEST) Message-ID: <5720A3C1.2040401@laposte.net> Date: Wed, 27 Apr 2016 13:34:25 +0200 From: Sebastian Frias User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Daniel Mack , "David S. Miller" , netdev@vger.kernel.org CC: lkml , mason , Sergei Shtylyov Subject: [PATCH] net: phy: at803x: Register 'link_change_notify' only for AT8030 X-VR-SrcIP: 83.142.147.193 X-VR-FullState: 0 X-VR-Score: -100 X-VR-Cause-1: gggruggvucftvghtrhhoucdtuddrfeekkedrkedugdefhecutefuodetggdotefrodftvfcurfhrohhf X-VR-Cause-2: ihhlvgemucfntefrqffuvffgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhs X-VR-Cause-3: ucdlqddutddtmdenucfjughrpefkfffhfgggvffutgfgsehtjegrtddtfeejnecuhfhrohhmpefuvggs X-VR-Cause-4: rghsthhirghnucfhrhhirghsuceoshhfkeegsehlrghpohhsthgvrdhnvghtqeenucfkphepkeefrddu X-VR-Cause-5: gedvrddugeejrdduleefnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghloheplgdujedv X-VR-Cause-6: rddvjedrtddrvddugegnpdhinhgvthepkeefrddugedvrddugeejrdduleefpdhmrghilhhfrhhomhep X-VR-Cause-7: shhfkeegsehlrghpohhsthgvrdhnvghtpdhrtghpthhtohepuggrnhhivghlseiiohhnqhhuvgdrohhr X-VR-Cause-8: gh X-VR-AvState: No X-VR-State: 0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There is no need to register the callback introduced by commit 13a56b449325 ("net: phy: at803x: Add support for hardware reset") for non faulty PHYs. The check on the PHY ID is not necessary anymore and thus has been removed from the callback implementation as well. Fixes: 13a56b449325 ("net: phy: at803x: Add support for hardware reset") Signed-off-by: Sebastian Frias --- drivers/net/phy/at803x.c | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index b3ffaee..7fdc676 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -353,33 +353,32 @@ static void at803x_link_change_notify(struct phy_device *phydev) struct at803x_priv *priv = phydev->priv; /* - * Conduct a hardware reset for AT8030 every time a link loss is + * Conduct a hardware reset for AT8030 (this callback is only + * registered for AT8030 at the moment) every time a link loss is * signalled. This is necessary to circumvent a hardware bug that * occurs when the cable is unplugged while TX packets are pending * in the FIFO. In such cases, the FIFO enters an error mode it * cannot recover from by software. */ - if (phydev->drv->phy_id == ATH8030_PHY_ID) { - if (phydev->state == PHY_NOLINK) { - if (priv->gpiod_reset && !priv->phy_reset) { - struct at803x_context context; - - at803x_context_save(phydev, &context); - - gpiod_set_value(priv->gpiod_reset, 1); - msleep(1); - gpiod_set_value(priv->gpiod_reset, 0); - msleep(1); - - at803x_context_restore(phydev, &context); - - phydev_dbg(phydev, "%s(): phy was reset\n", - __func__); - priv->phy_reset = true; - } - } else { - priv->phy_reset = false; + if (phydev->state == PHY_NOLINK) { + if (priv->gpiod_reset && !priv->phy_reset) { + struct at803x_context context; + + at803x_context_save(phydev, &context); + + gpiod_set_value(priv->gpiod_reset, 1); + msleep(1); + gpiod_set_value(priv->gpiod_reset, 0); + msleep(1); + + at803x_context_restore(phydev, &context); + + phydev_dbg(phydev, "%s(): phy was reset\n", + __func__); + priv->phy_reset = true; } + } else { + priv->phy_reset = false; } } @@ -391,7 +390,6 @@ static struct phy_driver at803x_driver[] = { .phy_id_mask = 0xffffffef, .probe = at803x_probe, .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, .set_wol = at803x_set_wol, .get_wol = at803x_get_wol, .suspend = at803x_suspend, @@ -427,7 +425,6 @@ static struct phy_driver at803x_driver[] = { .phy_id_mask = 0xffffffef, .probe = at803x_probe, .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, .set_wol = at803x_set_wol, .get_wol = at803x_get_wol, .suspend = at803x_suspend,