Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1936511ybl; Thu, 29 Aug 2019 00:50:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyT1dZOFzEvQETVLwLFN8bRkZPL34kJn8hO+25nrbqzswYUBysjX1h1TPNoU/3nRjNxtJdD X-Received: by 2002:a17:90a:8c94:: with SMTP id b20mr6357310pjo.127.1567065005151; Thu, 29 Aug 2019 00:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567065005; cv=none; d=google.com; s=arc-20160816; b=SnsW6xsLcpPXswfMvjV4GqExXQvstHBeY8rdwy/3u0j6A2dYjh/8hpH4yNj6lH9n8/ nUp7inSEPGUzKvAMKNQsWqqVkK+gje7AmMhXTzi6LNrNynts9maDhIWpsPJA9tiU5a79 hOBYjKFqL8EJTMuUYPQoGWMx6FAo8QoWyjbpC0z2TsivYQSxxpZgeMRz6zbvloGIf53L WywLB9OgZY4QoOTb9i4aUGunYPnCuMXiBpfzC7L8VEWuNql63jDwsZQ6M/C/L70E3TDS O2Lffe49qmp8J9NAHdO76pcQxR+Bd+4vxq0+QAf/asE4exc31DlppcotjW5A+yBWp7Py xtXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=XBk790Hc80k9SQ1S+te8B05C0bVTsp1yiNAIyUUYna8=; b=N1Ye8EN2LQFvwurM3jqPUrMpnRm4nNUxAClXbiYWnY/7bV0WHFu6Fg93oIQdAZJeUS +p6804IXxVuznWxX4zaOHsNBqpTKrHofJbhDggG6mbpoLip7ZM6LvxzPAZA+d2WXT1T+ UyurLP0zn6xlr/EqFjZ6DM24Zc2rpB30Yhmc28DqfxkKEdzwGkH1PQ3PMkMH3Gn4QSau nlVsBusTnUOdAsC47bQGIAwmi5s6eSJ413aL0l4/9PDt/K6+2XbvBF2LkaZQ6cW26zT6 w6EXY9nrgV0AVyligje3EB0YkDxnYSZPdSk35mw3hhNoSZFQfY2JN8j3SeKfeai3r32K zxKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 185si1739570pfa.40.2019.08.29.00.49.49; Thu, 29 Aug 2019 00:50:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728114AbfH2Hro convert rfc822-to-8bit (ORCPT + 99 others); Thu, 29 Aug 2019 03:47:44 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:42747 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbfH2Hrn (ORCPT ); Thu, 29 Aug 2019 03:47:43 -0400 Received: by mail-oi1-f196.google.com with SMTP id o6so1811700oic.9; Thu, 29 Aug 2019 00:47:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=p4LEbbLsvpFF7jH9kHTSE0avC1YlCtP3CflXztbc43s=; b=kM4GiVQRNujKYhPPpy/Gu6uzAI9jcPNg3CnFexP6VLJ+1NX44666LnA+XVfDSfjXKu nWazwPMwyD8W/JO3CALvZyibaP638HXxGcHl3orKuBQZ77+eFQWicWs4mKa3ShMsyIWe mhd0se0DUswxj+wfEm6j97OQS/k6ZHgBTnOzgSSkirM4RHeuKAf6V3PdSseTDrdFJvPC Tqb2+BdCDbd8bvTXMoUFxF/VOLjyhIMV4LkgTbjCnWxoRO5LxGIpr3oTYY56Ytp/st0J tpv81W6T2dEDXaLFUv72CEdxfnF8x/+adCAtp3oc2sVH4bnXG3Hr8V9kGh8NflxAIQaG lfbw== X-Gm-Message-State: APjAAAV0B9XNZVdHhPxW0o8xMrNvqUQfLgLDCQpUAUAssIMtv7g7TK/A goUzVhzWGocHIZkkNdBhV7P897MAjdi76SfXw0wal9hA X-Received: by 2002:aca:ea82:: with SMTP id i124mr5292700oih.153.1567064862697; Thu, 29 Aug 2019 00:47:42 -0700 (PDT) MIME-Version: 1.0 References: <20190828185518.4340-1-tszucs@protonmail.ch> In-Reply-To: <20190828185518.4340-1-tszucs@protonmail.ch> From: Geert Uytterhoeven Date: Thu, 29 Aug 2019 09:47:31 +0200 Message-ID: Subject: Re: [PATCH] mmc: sdhi: fill in actual_clock To: =?UTF-8?B?VGFtw6FzIFN6xbFjcw==?= Cc: Wolfram Sang , Ulf Hansson , Linux MMC List , Linux Kernel Mailing List , Linux-Renesas Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tamás, On Wed, Aug 28, 2019 at 9:02 PM Tamás Szűcs wrote: > Save set clock in mmc_host actual_clock enabling exporting it via debugfs. > This will indicate the precise SD clock in I/O settings rather than only the > sometimes misleading requested clock. > > Signed-off-by: Tamás Szűcs Thanks for your patch! > --- a/drivers/mmc/host/renesas_sdhi_core.c > +++ b/drivers/mmc/host/renesas_sdhi_core.c > @@ -124,7 +124,7 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host, > { > struct renesas_sdhi *priv = host_to_priv(host); > unsigned int freq, diff, best_freq = 0, diff_min = ~0; > - int i, ret; > + int i; > > /* tested only on R-Car Gen2+ currently; may work for others */ > if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2)) > @@ -153,9 +153,11 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host, > } > } > > - ret = clk_set_rate(priv->clk, best_freq); > + host->mmc->actual_clock = > + clk_set_rate(priv->clk, best_freq) == 0 ? > + best_freq : clk_get_rate(priv->clk); When clk_set_rate() returns 0 to indicate success, it may still have rounded the requested clock rate, no? So wouldn't it be better to always call clk_get_rate()? > > - return ret == 0 ? best_freq : clk_get_rate(priv->clk); > + return host->mmc->actual_clock; > } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds