From patchwork Thu Aug 30 12:14:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10581625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18B7F139B for ; Thu, 30 Aug 2018 12:15:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 081222BCCC for ; Thu, 30 Aug 2018 12:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF1BF2BCC7; Thu, 30 Aug 2018 12:15:01 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B53C32BBFF for ; Thu, 30 Aug 2018 12:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728725AbeH3QQv (ORCPT ); Thu, 30 Aug 2018 12:16:51 -0400 Received: from sauhun.de ([88.99.104.3]:53566 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727876AbeH3QQv (ORCPT ); Thu, 30 Aug 2018 12:16:51 -0400 Received: from localhost (p54B33850.dip0.t-ipconnect.de [84.179.56.80]) by pokefinder.org (Postfix) with ESMTPSA id D992834790F; Thu, 30 Aug 2018 14:14:57 +0200 (CEST) From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Masahiro Yamada , Wolfram Sang Subject: [PATCH] mmc: tmio: more concise clk calculation Date: Thu, 30 Aug 2018 14:14:38 +0200 Message-Id: <20180830121438.12588-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Concise, but still readable. Signed-off-by: Wolfram Sang --- drivers/mmc/host/tmio_mmc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index 0ae9ba1ee01b..0ae100e62b57 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -56,14 +56,9 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, divisor = host->pdata->hclk / new_clock; - if (divisor <= 1) { - clk_sel = 1; - clk = 0; - } else { - clk_sel = 0; - /* bit7 set: 1/512, ... bit0 set:1/4, all bits clear: 1/2 */ - clk = roundup_pow_of_two(divisor) >> 2; - } + /* bit7 set: 1/512, ... bit0 set: 1/4, all bits clear: 1/2 */ + clk_sel = (divisor <= 1); + clk = clk_sel ? 0 : (roundup_pow_of_two(divisor) >> 2); host->pdata->set_clk_div(host->pdev, clk_sel);