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: 292855 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 B71FF2C008F for ; Thu, 21 Nov 2013 07:23:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755241Ab3KTUWQ (ORCPT ); Wed, 20 Nov 2013 15:22:16 -0500 Received: from mail-ee0-f45.google.com ([74.125.83.45]:37159 "EHLO mail-ee0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755103Ab3KTUWD (ORCPT ); Wed, 20 Nov 2013 15:22:03 -0500 Received: by mail-ee0-f45.google.com with SMTP id d49so4304970eek.18 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 Cc: Sebastian Hesselbarth , "David S. Miller" , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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);