Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp863429pxf; Wed, 7 Apr 2021 13:35:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfG4wwTVrCUl2khYoLAU6kyQIWrCoshCOgRWjvuVpudaI3lCYI/q3bhdW/oxC3wRxkK47R X-Received: by 2002:a17:906:eb88:: with SMTP id mh8mr6097876ejb.74.1617827716254; Wed, 07 Apr 2021 13:35:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617827716; cv=none; d=google.com; s=arc-20160816; b=u/rufru6JaXrl0vaFKFBK6ZaORghuqs5+t2Frvl6T+xvhNWmMBU7WbT7BecqA8K1dY H0q5HzJEUj4Qro/u+XdNcCoQ7VHr7YG5ia5XSVnUxLjYsIgpAxZtxTmHC1pIt3tg3lUy 7GTFVggqc7jlwJE5McxBAV26KdhTR8/pShS4I2osfUFJmPc6Sz5ZhTPWtdlydm/YGOia RrHNOpP3tLxaw4pZFZEqIqbcJiie1MVWAEiaxBANZVv7j65iRxfJcrJd9ItIok6hppkp 3o4yXGau9F1+xXYhKw8xeBjP7QcYwb05w/9dRRAM9jDyiElGVLZVOO8rj3pEWl6f216J oqjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject; bh=ZPjiFPOIV7HLVeFlgBpfSIvY9FE814H8vw/02mEe9bc=; b=SXMd4s5g3sSm8MVEPXD5x9xOOM/EVVqj1EmZ1KMK9NHd2NDHrtSiJpNb8DB+DKJzeM nNWA0RGs1+FYZwmfK0AAIPkudMsFOwU61AiexP9u4MMWmyyUehv8khVOSlYXlVNpLk+V Pa0hhAlRrRS/qF0ps7+otqlAISE0WdVDylP+uxA4q8exI4o41pqFkIHcvfzFfJcf8I9p 1QLtgRB48Qbbxy9WjVpNDWS92r+6b3cICik+TxJB60eJn5GA7bNj+fTh9m3nyf3vTT+q rag271pE2aMZmZU4BEGkp/G3R4zh9aZkWP+622RmSepU9WfReRdVLpcEmAFHxMMcMmYG tdtw== 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 m17si9175222edr.21.2021.04.07.13.34.52; Wed, 07 Apr 2021 13:35:16 -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 S244884AbhDGI3y (ORCPT + 99 others); Wed, 7 Apr 2021 04:29:54 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:16810 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349659AbhDGI3q (ORCPT ); Wed, 7 Apr 2021 04:29:46 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FFcvc3HX9z7tQ2; Wed, 7 Apr 2021 16:27:24 +0800 (CST) Received: from [127.0.0.1] (10.69.38.196) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Wed, 7 Apr 2021 16:29:28 +0800 Subject: Re: [PATCH v6 2/5] i2c: core: add api to provide frequency mode strings To: Wolfram Sang , , , , , , , , , , , , , References: <1617197790-30627-1-git-send-email-yangyicong@hisilicon.com> <1617197790-30627-3-git-send-email-yangyicong@hisilicon.com> <20210406195414.GG3122@kunai> From: Yicong Yang Message-ID: <0d48f447-d1f2-1c86-27f4-3c8b23dcaf30@hisilicon.com> Date: Wed, 7 Apr 2021 16:29:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20210406195414.GG3122@kunai> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.38.196] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/4/7 3:54, Wolfram Sang wrote: > >> diff --git a/include/linux/i2c.h b/include/linux/i2c.h >> index 10bd0b0..7268180 100644 >> --- a/include/linux/i2c.h >> +++ b/include/linux/i2c.h >> @@ -47,6 +47,26 @@ typedef int (*i2c_slave_cb_t)(struct i2c_client *client, >> #define I2C_MAX_HIGH_SPEED_MODE_FREQ 3400000 >> #define I2C_MAX_ULTRA_FAST_MODE_FREQ 5000000 >> >> +static inline const char *i2c_freq_mode_string(u32 bus_freq_hz) >> +{ >> + switch (bus_freq_hz) { >> + case I2C_MAX_STANDARD_MODE_FREQ: >> + return "Standard Mode (100 kHz)"; >> + case I2C_MAX_FAST_MODE_FREQ: >> + return "Fast Mode (400 kHz)"; >> + case I2C_MAX_FAST_MODE_PLUS_FREQ: >> + return "Fast Mode Plus (1.0 MHz)"; >> + case I2C_MAX_TURBO_MODE_FREQ: >> + return "Turbo Mode (1.4 MHz)"; >> + case I2C_MAX_HIGH_SPEED_MODE_FREQ: >> + return "High Speed Mode (3.4 MHz)"; >> + case I2C_MAX_ULTRA_FAST_MODE_FREQ: >> + return "Ultra Fast Mode (5.0 MHz)"; >> + default: >> + return "Unknown Mode"; >> + } >> +} > > Any reason ehy this is an inline function? My gut feeling says it would > be better added to the core? > it's not a complicated function so i didn't think it'll make much difference, so i just put it in the header along with the coresponding macro definitions. do you want me to move it to the core? Thanks