From patchwork Wed Nov 20 20:21:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 3215321 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DF6829F26C for ; Wed, 20 Nov 2013 20:24:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCBBA20270 for ; Wed, 20 Nov 2013 20:24:18 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 651522020E for ; Wed, 20 Nov 2013 20:24:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjEIl-00023t-Bu; Wed, 20 Nov 2013 20:23:08 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjEIX-0005RR-MK; Wed, 20 Nov 2013 20:22:53 +0000 Received: from mail-ee0-x22d.google.com ([2a00:1450:4013:c00::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjEI3-0005Js-EF for linux-arm-kernel@lists.infradead.org; Wed, 20 Nov 2013 20:22:25 +0000 Received: by mail-ee0-f45.google.com with SMTP id d49so4298482eek.32 for ; Wed, 20 Nov 2013 12:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/bLKB69lT3D13i9dWyof7NwUXTINxTkVLYj5hmXxHF4=; b=kSjZzMvZZtluYqrT/orCkDPl8SL9Kis48LbW8jQebC2+/rFSx5bfYin7m4zhQGRAO1 tSlThUSHwTdULtiYUCLkNvXBY8Dd3lZU+TUUzeQ517qfrY9WDbZm380b6pwpSwXbFJVd gVRRE84fIY4nJq6uGR0fTlBEZsEZgd9iFLZmjS/PhqJK2EpL/cCDGlopYCEAZ+0SccjF 0rJdF1zfep5Ot3+uZVBZDYc5R529ctleZh/KHMq2gnCiyykaV7wCywEwDP43j6EEQOes /zpMx3XuWulCnX2g8ihcU/wVrqm6ecZYibl0i5jzB5yBPDQdHD4dMwsjvNibiLwywQ6l p8Kg== X-Received: by 10.14.38.194 with SMTP id a42mr3416728eeb.12.1384978921525; Wed, 20 Nov 2013 12:22:01 -0800 (PST) Received: from topkick.lan (dslc-082-083-251-183.pools.arcor-ip.net. [82.83.251.183]) by mx.google.com with ESMTPSA id z1sm63377839eeo.14.2013.11.20.12.22.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Nov 2013 12:22:00 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH RFC v1 2/7] net: phy: provide phy_resume/phy_suspend helpers Date: Wed, 20 Nov 2013 21:21:48 +0100 Message-Id: <1384978913-8052-3-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1384978913-8052-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1384978913-8052-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131120_152223_692880_CA2FAD3B X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -2.0 (--) Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds helper functions to resume and suspend a given phy_device by calling the corresponding driver callbacks if available. Signed-off-by: Sebastian Hesselbarth Acked-by: Florian Fainelli --- Cc: David S. Miller Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/net/phy/phy_device.c | 19 +++++++++++++++++++ include/linux/phy.h | 2 ++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 74630e9..2442895 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -625,6 +625,25 @@ void phy_detach(struct phy_device *phydev) } EXPORT_SYMBOL(phy_detach); +int phy_suspend(struct phy_device *phydev) +{ + struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); + + if (phydrv->suspend) + return phydrv->suspend(phydev); + return 0; +} +EXPORT_SYMBOL(phy_suspend); + +int phy_resume(struct phy_device *phydev) +{ + struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); + + if (phydrv->resume) + return phydrv->resume(phydev); + return 0; +} +EXPORT_SYMBOL(phy_resume); /* Generic PHY support and helper functions */ diff --git a/include/linux/phy.h b/include/linux/phy.h index 64ab823..ed0d6d8 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -552,6 +552,8 @@ void phy_detach(struct phy_device *phydev); void phy_start(struct phy_device *phydev); void phy_stop(struct phy_device *phydev); int phy_start_aneg(struct phy_device *phydev); +int phy_suspend(struct phy_device *phydev); +int phy_resume(struct phy_device *phydev); int phy_stop_interrupts(struct phy_device *phydev);