Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp416132pxf; Wed, 31 Mar 2021 06:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1M+rOyhMQ3WL218P7Yj4iOd+y1u1ptyuEom2wuf+laB0F/FGXq8nAG4cmhNgxmK1v+sVl X-Received: by 2002:a17:906:7f84:: with SMTP id f4mr3479919ejr.525.1617198174360; Wed, 31 Mar 2021 06:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617198174; cv=none; d=google.com; s=arc-20160816; b=ZBQ4PaIB65d4coFAN3mO7rIBe5MhSpMR6oAMsglFWlwPZ0LEL4w+5aZ52Yj3rtwuis rfEBuAiogZvowHxlhygPYxC37J1CYV3RwCBtMVVsZ6P3Pn4oHDb3wGIZlQP4oTo3L6fF W1xDDNqR3iiILghAOc56BhBOij4is700IrbRETKubAdWRFst8yNdkWYbHFMUYCEE3Mb7 zIdnkqYDuSdY2LaHwHQt6+Dm2d8uXyW4tuj4eC9oasxxDJLCPDojR1u5xBuT+GL2xog8 u9mLhvSm/sakwmnRpSeLe21mJEWPApq/sTapuoGbuiU4Ofy7y+89+dlaQ4c5RY+h4PgX 9xoA== 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=xDDJKVuKCqulvPrKsCKgFOU1ewD6bjNl6r3Ie+Bg+brLckfH+n2ybXGA8BF4fA1wci 696Ad5hWJJHCFxkYsnlq+/Qf8ZdnDCywsvOF3jgOXWpjP6qvOADgFfquTsqG6UJ9Wymx qkUVm1Ly50D1wUbAwMIk3O/IeBXYJtAuuNdUtclnWg0pVyXHoM+QgUcRKGY8TQkMHZK2 56tZvDgeo+RmaoKfxDhziUyl5oo48e4cjm2iWsFTKmUEQqph4jup3pNrK+Mqp43GgSVd TebCnteeDlW//jeE1n3dMKSGAUKtxn60LmDeTvOFwlept8vx07pyz0H9f4wzBVsDSWc6 Fsbg== 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 dm14si1704906ejc.502.2021.03.31.06.42.31; Wed, 31 Mar 2021 06:42:54 -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 S235968AbhCaNjj (ORCPT + 99 others); Wed, 31 Mar 2021 09:39:39 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:15415 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235870AbhCaNjP (ORCPT ); Wed, 31 Mar 2021 09:39:15 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4F9S6c0C6xzlWpH; Wed, 31 Mar 2021 21:37:28 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Wed, 31 Mar 2021 21:39:01 +0800 From: Yicong Yang To: , , , , CC: , , , , , , , , , Subject: [PATCH v6 5/5] i2c: designware: Switch over to i2c_freq_mode_string() Date: Wed, 31 Mar 2021 21:36:30 +0800 Message-ID: <1617197790-30627-6-git-send-email-yangyicong@hisilicon.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1617197790-30627-1-git-send-email-yangyicong@hisilicon.com> References: <1617197790-30627-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