Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2499692ybl; Thu, 29 Aug 2019 09:01:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTiWCUamha4Cy4neHgh1JhpuYNRvJlkBeXS6FvW3kXiCr3jChTB/LAYEBPL1jLvDnB0I3s X-Received: by 2002:a17:90a:1b22:: with SMTP id q31mr10607918pjq.61.1567094466937; Thu, 29 Aug 2019 09:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567094466; cv=none; d=google.com; s=arc-20160816; b=nH3X28wL05oHqU8Nb8DNihizzg8SrWOJf5NTsD3eBygemhAw0Nx56epqrq/KqNP9KF 47HI+ZTJfR9TJqX4ToeXeZn+yPVPsoN3AsqVQjOCaf2ZK7g/rRBZJgK71itUdn7u2rzo 2Ej85hUlEvmJviSOLxzhlAvxqRCCvb8gJUEe6j5qaafa+cKoCvXyJqOo8im4t1Qwpqcm fpj4pAJfbRbQakENf/B+czzb1+zi8Z/2m6g8cQevOzb1vSGiXlaY8/KpIsK81fpUO/6M QYyBNvF8Q3ZtXFbDDypMCyUnrfXWXn8sMy2XZ+6pfXC9yRbaJeCX9Yjf/kZTWCW7AUlw qAaw== 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:mime-version :feedback-id:references:in-reply-to:message-id:subject:reply-to:cc :from:to:dkim-signature:date; bh=s0PahgYZsuit8sSrf7wTLbyTQ2qVGl52SRNMyg333Ks=; b=iw6dAYLKhV/3oBG5tqpbLdFNHGG3+FdaOJkBAtXbooW31/m36dkimvznGeZs5dTUXs dSd5vHo40O5+WVoDzgljSmh4XnGUHEw6Ice/XkOWw1GbgcFy+CQ1yXxSu8Ne7YBGHgdh B3d4UG7oAzc1yN8mrzd9tXFg4KwU0KW7HvPmLgBN5cGmOtjbkQXMTaopHnvsZJl96KZL MVJ3TqkzJpv3D7ffcULbk8hKZbg5UWxCvB93+T0FVefCoq6I0c/Fy1HBd9xNt1hVhuTt EjKB7HVPln0jWXKtr7CkqKRanJ1prNnguF5ylgvHRhSR+P04pE1QlEjgJOQm523MDl9h qIOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.ch header.s=default header.b=mp6rq7K1; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.ch Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si2453394pjn.77.2019.08.29.09.00.50; Thu, 29 Aug 2019 09:01:06 -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; dkim=pass header.i=@protonmail.ch header.s=default header.b=mp6rq7K1; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728007AbfH2P76 (ORCPT + 99 others); Thu, 29 Aug 2019 11:59:58 -0400 Received: from mail-40130.protonmail.ch ([185.70.40.130]:44371 "EHLO mail-40130.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727600AbfH2P75 (ORCPT ); Thu, 29 Aug 2019 11:59:57 -0400 Date: Thu, 29 Aug 2019 15:59:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.ch; s=default; t=1567094393; bh=s0PahgYZsuit8sSrf7wTLbyTQ2qVGl52SRNMyg333Ks=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=mp6rq7K16xOW7a7JH2Dr8zmKgqrqZJS+W/BULOYMGrphHtPcy5daClMOl6Q4hiJRD e9R3+q0XHsb8umldAcfRlZ07UoAdwKPQRFt3vq47DeDJL9vpTcPWluVtpADfdVMIPW UnvtbcKwpfiGxn5S7TxrzGhAF/r48M5evKTJpMVY= To: Geert Uytterhoeven From: =?UTF-8?Q?Tam=C3=A1s_Sz=C5=B1cs?= Cc: Wolfram Sang , Ulf Hansson , Linux MMC List , Linux Kernel Mailing List , Linux-Renesas Reply-To: =?UTF-8?Q?Tam=C3=A1s_Sz=C5=B1cs?= Subject: Re: [PATCH] mmc: sdhi: fill in actual_clock Message-ID: In-Reply-To: References: <20190828185518.4340-1-tszucs@protonmail.ch> Feedback-ID: nIMxuco3ul2LtVHhzi8PphYHQLjwNa0SMoiI49kuTHKENnPWKUsinAdWedFtAsi63naFGY15tCjh3_itnNk3og==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, It would be possible to call clk_get_rate() unconditionally but there's usu= ally no need, thus the ternary. Are you in favor of that though? It turns out I need to send a followup to fix some glitches. Please stay tu= ned. Kind regards, Tamas Tam=C3=A1s Sz=C5=B1cs tszucs@protonmail.ch =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Thursday, August 29, 2019 9:47 AM, Geert Uytterhoeven wrote: > Hi Tam=C3=A1s, > > On Wed, Aug 28, 2019 at 9:02 PM Tam=C3=A1s Sz=C5=B1cs tszucs@protonmail.c= h wrote: > > > Save set clock in mmc_host actual_clock enabling exporting it via debug= fs. > > This will indicate the precise SD clock in I/O settings rather than onl= y the > > sometimes misleading requested clock. > > Signed-off-by: Tam=C3=A1s Sz=C5=B1cs tszucs@protonmail.ch > > 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 =3D host_to_priv(host); > > unsigned int freq, diff, best_freq =3D 0, diff_min =3D ~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 =3D clk_set_rate(priv->clk, best_freq); > > > > > > > > - host->mmc->actual_clock =3D > > > > > > - clk_set_rate(priv->clk, best_freq) =3D=3D 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 =3D=3D 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-m6= 8k.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