From patchwork Mon Jan 2 11:56:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9493405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1186A62AB4 for ; Mon, 2 Jan 2017 12:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2820266F3 for ; Mon, 2 Jan 2017 12:00:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2D091FF35; Mon, 2 Jan 2017 12:00:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.tuxfamily.net (mail.tuxfamily.net [212.85.158.8]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 79AF11FF35 for ; Mon, 2 Jan 2017 12:00:24 +0000 (UTC) Received: from listengine (helo=tuxfamily.org) by mx1.tuxfamily.net with local-bsmtp (Exim 4.84_2) (envelope-from ) id 1cO1Hr-0002H6-2k for patchwork-linux-oxnas@patchwork.kernel.org; Mon, 02 Jan 2017 13:00:23 +0100 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by mx1.tuxfamily.net with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cO1E8-0001vY-Su for linux-oxnas@lists.tuxfamily.org; Mon, 02 Jan 2017 12:56:32 +0100 Received: by mail-lf0-x241.google.com with SMTP id y21so39928289lfa.0 for ; Mon, 02 Jan 2017 03:56:32 -0800 (PST) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=atPcyFsL6ylI+uJ2SC46xe1vYsAfBAENBF0l7tdN15E=; b=I0WNduF/uCZqWcimA8pbvOgSyFHkkgj9kc5e7kZz484/LvwZtcWe2RXnFCA1fEmfp1 KKniR3NQiSXcZwCwKCGdJYtRwufFmU60++H0Ha9FUVeHjCKOHKzYcjb/9IBxPNyu3U9N 9OSZoRv4W3gjJjRab1yNAYYO/xkuOC7JQRiDul+zOxdbl8NIMbELUS0xiu/w1nbWMfMW SFLDlBeqmc8Lauq+tOA8TTy1wK9Jjrhk7v0LD6H0E7B9SIgFDPCqOnWOvLv6dC98Uduy xrYAhcW3nTM+xWaxIXYP/6TMX2yKJ3K8eMNZho1GxjUs2hBTzOdw/WAn71R1AHob2nTZ sYVA== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=atPcyFsL6ylI+uJ2SC46xe1vYsAfBAENBF0l7tdN15E=; b=gFtbRfUx9bQrmx61OdoNLiJY7d8DYWvwiBUUqXh8u1cRO3Le4EKRkGLeJkiVTx5LWD xkp/N5jZzGHL3wkTls4c2nRv9GXvMhH0CHU1PX7WNOnYrBsPfNmBiZby3tbxbLSrG546 UeSj+42LWY3VoYEKDStZqCPaDKlV/DDiZcAahlNqro9JQGmd8+EzzKoY5BjTlG9nQ4Bh go3DEGP1IMmqEuAC046rVsOF/x3Vh8NmuoqpO3U3VqeMusZWikBSpoVoI2J6JKod4Rnn UaxECvKKUc/TeacvY9YXAmSLqL97UUF106/0a17otSe/sqr2emHdraRucA23t4rrEJBQ z3JQ== X-GM-Message-State: AIkVDXLIvkuvd8RhiyC3ZD93oDBkvcqTTTlEJayzCq7ak0NRbIIvxcCN96PkULh+DoMQtw== X-Received: by 10.25.160.20 with SMTP id j20mr9763642lfe.66.1483358191976; Mon, 02 Jan 2017 03:56:31 -0800 (PST) Received: from xi.terra (c-04aadb54.07-184-6d6c6d4.cust.bredbandsbolaget.se. [84.219.170.4]) by smtp.gmail.com with ESMTPSA id 32sm8330042lfv.21.2017.01.02.03.56.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jan 2017 03:56:30 -0800 (PST) Sender: Johan Hovold Received: from johan by xi.terra with local (Exim 4.88) (envelope-from ) id 1cO1E5-0008Ss-Aw; Mon, 02 Jan 2017 12:56:29 +0100 From: Johan Hovold To: "David S. Miller" CC: Giuseppe Cavallaro , Alexandre Torgue , Neil Armstrong , netdev@vger.kernel.org, linux-oxnas@lists.tuxfamily.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [linux-oxnas] [PATCH net 3/3] net: stmmac: dwmac-oxnas: use generic pm implementation Date: Mon, 2 Jan 2017 12:56:04 +0100 Message-ID: <20170102115604.32482-4-johan@kernel.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170102115604.32482-1-johan@kernel.org> References: <20170102115604.32482-1-johan@kernel.org> List-Unsubscribe: List-Subscribe: List-Help: List-Software: Listengine, VHFFS 4.7-dev-4c39578052 List-ID: List-Post: List-Archive: Precedence: list Reply-To: linux-oxnas@lists.tuxfamily.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have an exit callback in place, add init as well and get rid of the custom PM callbacks in favour of the generic ones. Signed-off-by: Johan Hovold --- drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 38 +++-------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c index 3efd110613df..3dc7d279f805 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c @@ -60,8 +60,9 @@ struct oxnas_dwmac { struct regmap *regmap; }; -static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac) +static int oxnas_dwmac_init(struct platform_device *pdev, void *priv) { + struct oxnas_dwmac *dwmac = priv; unsigned int value; int ret; @@ -135,6 +136,7 @@ static int oxnas_dwmac_probe(struct platform_device *pdev) dwmac->dev = &pdev->dev; plat_dat->bsp_priv = dwmac; + plat_dat->init = oxnas_dwmac_init; plat_dat->exit = oxnas_dwmac_exit; dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, @@ -151,7 +153,7 @@ static int oxnas_dwmac_probe(struct platform_device *pdev) goto err_remove_config_dt; } - ret = oxnas_dwmac_init(dwmac); + ret = oxnas_dwmac_init(pdev, plat_dat->bsp_priv); if (ret) goto err_remove_config_dt; @@ -170,36 +172,6 @@ static int oxnas_dwmac_probe(struct platform_device *pdev) return ret; } -#ifdef CONFIG_PM_SLEEP -static int oxnas_dwmac_suspend(struct device *dev) -{ - struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev); - int ret; - - ret = stmmac_suspend(dev); - clk_disable_unprepare(dwmac->clk); - - return ret; -} - -static int oxnas_dwmac_resume(struct device *dev) -{ - struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev); - int ret; - - ret = oxnas_dwmac_init(dwmac); - if (ret) - return ret; - - ret = stmmac_resume(dev); - - return ret; -} -#endif /* CONFIG_PM_SLEEP */ - -static SIMPLE_DEV_PM_OPS(oxnas_dwmac_pm_ops, - oxnas_dwmac_suspend, oxnas_dwmac_resume); - static const struct of_device_id oxnas_dwmac_match[] = { { .compatible = "oxsemi,ox820-dwmac" }, { } @@ -211,7 +183,7 @@ static struct platform_driver oxnas_dwmac_driver = { .remove = stmmac_pltfr_remove, .driver = { .name = "oxnas-dwmac", - .pm = &oxnas_dwmac_pm_ops, + .pm = &stmmac_pltfr_pm_ops, .of_match_table = oxnas_dwmac_match, }, };