From patchwork Thu Apr 23 08:15:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6260191 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 737669F313 for ; Thu, 23 Apr 2015 08:15:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 808C62012E for ; Thu, 23 Apr 2015 08:15:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64BA720383 for ; Thu, 23 Apr 2015 08:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754225AbbDWIPO (ORCPT ); Thu, 23 Apr 2015 04:15:14 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:44705 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750822AbbDWIPM (ORCPT ); Thu, 23 Apr 2015 04:15:12 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 23 Apr 2015 17:15:11 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 30641509BD; Thu, 23 Apr 2015 17:15:11 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 2C6FC2806E; Thu, 23 Apr 2015 17:15:11 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 25CD62806D; Thu, 23 Apr 2015 17:15:11 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id TAN22102; Thu, 23 Apr 2015 17:15:11 +0900 X-IronPort-AV: E=Sophos;i="5.11,629,1422889200"; d="scan'208";a="184687383" Received: from mail-hk1lp0124.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.124]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 23 Apr 2015 17:15:10 +0900 Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.132) by SIXPR06MB318.apcprd06.prod.outlook.com (10.141.125.144) with Microsoft SMTP Server (TLS) id 15.1.136.25; Thu, 23 Apr 2015 08:15:08 +0000 Message-ID: <877ft3gt2y.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/7 v4] mmc: sh_mmcif: remove unnecessary int clk from struct sh_mmcif_host User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Ulf Hansson , Simon CC: linux-mmc , Magnus , Linux-SH , Laurent , kobayashi In-Reply-To: <87d22vgt8u.wl%kuninori.morimoto.gx@renesas.com> References: <873840a4ch.wl%kuninori.morimoto.gx@renesas.com> <87d22vgt8u.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 23 Apr 2015 08:15:08 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: KAWPR01CA0011.jpnprd01.prod.outlook.com (25.161.24.21) To SIXPR06MB318.apcprd06.prod.outlook.com (10.141.125.144) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB318; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(46102003)(50986999)(2950100001)(122386002)(76176999)(77096005)(33646002)(5001770100001)(77156002)(86362001)(46406003)(66066001)(53416004)(19580405001)(47776003)(40100003)(87976001)(50466002)(54356999)(83506001)(92566002)(23726002)(62966003)(42186005)(229853001)(19580395003)(4001350100001)(36756003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB318; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:SIXPR06MB318; BCL:0; PCL:0; RULEID:; SRVR:SIXPR06MB318; X-Forefront-PRVS: 0555EC8317 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2015 08:15:08.1784 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB318 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 From: Kuninori Morimoto struct sh_mmcif_host has 1) int clk, 2) struct clock *hclk, and host->clk = clk_get_rate(host->hclk). This int clk is not necessary. Let's remove it. And, current hclk is confusable naming. Let's rename it to clk. Signed-off-by: Kuninori Morimoto Tested-by: Keita Kobayashi Acked-by: Geert Uytterhoeven --- v3 -> v4 - new patch, this is cleanup patch drivers/mmc/host/sh_mmcif.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 5282c5b..ff4f8c0 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -228,8 +228,7 @@ struct sh_mmcif_host { struct mmc_host *mmc; struct mmc_request *mrq; struct platform_device *pd; - struct clk *hclk; - unsigned int clk; + struct clk *clk; int bus_width; unsigned char timing; bool sd_error; @@ -484,17 +483,18 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk) { struct sh_mmcif_plat_data *p = host->pd->dev.platform_data; bool sup_pclk = p ? p->sup_pclk : false; + unsigned int current_clk = clk_get_rate(host->clk); sh_mmcif_bitclr(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE); sh_mmcif_bitclr(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR); if (!clk) return; - if (sup_pclk && clk == host->clk) + if (sup_pclk && clk == current_clk) sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK); else sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR & - ((fls(DIV_ROUND_UP(host->clk, + ((fls(DIV_ROUND_UP(current_clk, clk) - 1) - 1) << 16)); sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE); @@ -980,12 +980,13 @@ static void sh_mmcif_request(struct mmc_host *mmc, struct mmc_request *mrq) static int sh_mmcif_clk_update(struct sh_mmcif_host *host) { - int ret = clk_prepare_enable(host->hclk); + int ret = clk_prepare_enable(host->clk); if (!ret) { - host->clk = clk_get_rate(host->hclk); - host->mmc->f_max = host->clk / 2; - host->mmc->f_min = host->clk / 512; + unsigned int clk = clk_get_rate(host->clk); + + host->mmc->f_max = clk / 2; + host->mmc->f_min = clk / 512; } return ret; @@ -1034,7 +1035,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) } if (host->power) { pm_runtime_put_sync(&host->pd->dev); - clk_disable_unprepare(host->hclk); + clk_disable_unprepare(host->clk); host->power = false; if (ios->power_mode == MMC_POWER_OFF) sh_mmcif_set_power(host, ios); @@ -1440,9 +1441,9 @@ static int sh_mmcif_probe(struct platform_device *pdev) pm_runtime_enable(dev); host->power = false; - host->hclk = devm_clk_get(dev, NULL); - if (IS_ERR(host->hclk)) { - ret = PTR_ERR(host->hclk); + host->clk = devm_clk_get(dev, NULL); + if (IS_ERR(host->clk)) { + ret = PTR_ERR(host->clk); dev_err(dev, "cannot get clock: %d\n", ret); goto err_pm; } @@ -1492,13 +1493,13 @@ static int sh_mmcif_probe(struct platform_device *pdev) dev_info(dev, "Chip version 0x%04x, clock rate %luMHz\n", sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0xffff, - clk_get_rate(host->hclk) / 1000000UL); + clk_get_rate(host->clk) / 1000000UL); - clk_disable_unprepare(host->hclk); + clk_disable_unprepare(host->clk); return ret; err_clk: - clk_disable_unprepare(host->hclk); + clk_disable_unprepare(host->clk); err_pm: pm_runtime_disable(dev); err_host: @@ -1511,7 +1512,7 @@ static int sh_mmcif_remove(struct platform_device *pdev) struct sh_mmcif_host *host = platform_get_drvdata(pdev); host->dying = true; - clk_prepare_enable(host->hclk); + clk_prepare_enable(host->clk); pm_runtime_get_sync(&pdev->dev); dev_pm_qos_hide_latency_limit(&pdev->dev); @@ -1526,7 +1527,7 @@ static int sh_mmcif_remove(struct platform_device *pdev) */ cancel_delayed_work_sync(&host->timeout_work); - clk_disable_unprepare(host->hclk); + clk_disable_unprepare(host->clk); mmc_free_host(host->mmc); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev);