Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp340076pxf; Thu, 8 Apr 2021 04:22:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJFQkBdROS1mayKFRwFSvQzoThwzsxTjrzjdPuNrKbtyVm9XrNHGfkhi3nPkjdDEU560cW X-Received: by 2002:a63:550b:: with SMTP id j11mr7848806pgb.95.1617880958353; Thu, 08 Apr 2021 04:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617880958; cv=none; d=google.com; s=arc-20160816; b=oAbsySCqH6mIQZxNdSCtiov4ief99uLgYG+ajLudPWOYZS4rMsd1fRAfaF00TyJodj BPoL7UHtQiLA8kIOTzYWEvRITIJUuvgXyKAQYdKtIrGudqW1A6NXdzF3T7mQl1ob+G21 o81q7VJMwphr/FO1vuxklxvG1XGJaH0NNMFnSq6l1sW6DiFKk8WYI2sXiywzw/w012cU 8G2HvISQHeI32i93FnsN/BOkuDy4iH+r4Yyb3UHbRDm4imm/i40LcmM6TUOQ3ny7W/AA VdUBvU+aw5e4/UCNunhTe6tU8KbNdoGjmoLHc1desa+xVNLAk+3czK0E8TJ6s/lXJW3F KRAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Iq8JxyzK2KdiXleJ0DCQyEF3pjHREwRAnfwKVA3vhjI=; b=Kj46wJmfk4xtfp0QoCfaV5q5321lyXcmWRPb5FJTMQDQ5FI8Bvnm28RL4hkm10SsEY Sb/XWrfiU7SU5X8bfmzXx+RbQKORMUQiJSGVYdy6GxDeDOoZ+4YL/eKwx4MS9aeFt2U/ +zmdFLFQ8edLLoAHk/1VK9o0svRQSMgZtPdo+bGp2GeO1UgZSxsO8C/hOrKMCWKn0cVp uFF6Uov4FFjnWWbJEaAg2pm60foQ6zQQrrcvjnP7rwUw6QZwpy2h58htKFEBrg9syY8h ouDvbZ8hpqXzGngCEXbGIfejAXNLyFWOnAcHWpeBjNrUyDZJJuwsIattI85KVhklaR3+ ZVhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si28163935plv.429.2021.04.08.04.22.26; Thu, 08 Apr 2021 04:22:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231372AbhDHLU1 (ORCPT + 99 others); Thu, 8 Apr 2021 07:20:27 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:16832 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbhDHLUT (ORCPT ); Thu, 8 Apr 2021 07:20:19 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FGJdt58Cxz7tpl; Thu, 8 Apr 2021 19:17:54 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Thu, 8 Apr 2021 19:19:57 +0800 From: Yicong Yang To: , , , , CC: , , , , , , , , , Subject: [PATCH v7 5/5] i2c: designware: Switch over to i2c_freq_mode_string() Date: Thu, 8 Apr 2021 19:17:21 +0800 Message-ID: <1617880641-664-6-git-send-email-yangyicong@hisilicon.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1617880641-664-1-git-send-email-yangyicong@hisilicon.com> References: <1617880641-664-1-git-send-email-yangyicong@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko Use generic i2c_freq_mode_string() helper to print chosen bus speed. Acked-by: Jarkko Nikula Signed-off-by: Andy Shevchenko Signed-off-by: Yicong Yang --- drivers/i2c/busses/i2c-designware-master.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index dd27b9d..b64c4c8 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -35,10 +35,10 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev) static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) { - const char *mode_str, *fp_str = ""; u32 comp_param1; u32 sda_falling_time, scl_falling_time; struct i2c_timings *t = &dev->timings; + const char *fp_str = ""; u32 ic_clk; int ret; @@ -153,22 +153,10 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) ret = i2c_dw_set_sda_hold(dev); if (ret) - goto out; - - switch (dev->master_cfg & DW_IC_CON_SPEED_MASK) { - case DW_IC_CON_SPEED_STD: - mode_str = "Standard Mode"; - break; - case DW_IC_CON_SPEED_HIGH: - mode_str = "High Speed Mode"; - break; - default: - mode_str = "Fast Mode"; - } - dev_dbg(dev->dev, "Bus speed: %s%s\n", mode_str, fp_str); + return ret; -out: - return ret; + dev_dbg(dev->dev, "Bus speed: %s\n", i2c_freq_mode_string(t->bus_freq_hz)); + return 0; } /** -- 2.8.1