Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5295840ybf; Wed, 4 Mar 2020 21:45:22 -0800 (PST) X-Google-Smtp-Source: ADFU+vsOGrBPf1Z561Jv24BbA/dIn8JVUd2fOIx/9Pn17CUr7f25hCIIUUqC+kdi4YrVWOeBLyYf X-Received: by 2002:a9d:2f05:: with SMTP id h5mr5450870otb.316.1583387122308; Wed, 04 Mar 2020 21:45:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583387122; cv=none; d=google.com; s=arc-20160816; b=OLY3WxAW8iNrI/YcIeVX2sdev8cafU8oCEMhd+F09XX5TXSD1qMZg9CpIimHm4CaLe J+K/sSnD/+OQD6b1xnzj0wYl7eZbfTX/bHdr+Uv43NLX818c4qKB0Kks5NSHhw8FU+8h rCj5dwLlZ4btbsAabp0trow5O4CilQeeV5P4ZjeM9LETqhgNlGeasImbV52qvJHLuU32 YmB4ifsjLvCwwED8fRUZPoBuAjxZF4dX8K4lrEDIy36JIUeMiNjuJccAy7uJ9X4YaL15 72+ESEt/0WqfcXuLUrrD03wszuh/6nhHEVb1NWM154bFnrNzdG6iaI2r2tBCeKy/fDTs K3Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=As7z+9RsocK5CQV9qlxwp3vbojEnbfUk/NP3ejBV3dc=; b=Z6V/9DLf+WUvxudcOvo5ZSSFOxU4KL3cCX/+DX5Nt6yHdJ1s7hG9VH2J5ETv8hQeDH j6qc3sXwhLeamcssO5ki+oD0MDdTGsPHLBmBz+kYs/s3zORW1EV2V4UTxdiO2xv0gg/e kd3Fvo391mwQvUcQg2hfOpTnCQZH7+XQiOjPsP1CGiNxc4GHXiW8doQMFuKGQ0Mg/DGK FXXhaoEQ7+e3raHbE12OGb655jmRFNdI5O4qmDmjG8qM1KcN8bpzw7JkGCKKzdC1kD+P 48XeCLsDFZ4RVZU1i6zls0RPcwUe8zvVHf5cfufPDd486Iyze0u/eurp6TdxlydNYj2X NFKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=V6yyqpEe; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17si2840545ots.153.2020.03.04.21.45.09; Wed, 04 Mar 2020 21:45:22 -0800 (PST) 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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=V6yyqpEe; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725926AbgCEFop (ORCPT + 99 others); Thu, 5 Mar 2020 00:44:45 -0500 Received: from mail26.static.mailgun.info ([104.130.122.26]:61650 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbgCEFop (ORCPT ); Thu, 5 Mar 2020 00:44:45 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1583387084; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=As7z+9RsocK5CQV9qlxwp3vbojEnbfUk/NP3ejBV3dc=; b=V6yyqpEeGhjXBzHPiqJk2aFtDuK+RDojVipsiIk6nqCbn6am5VwdZ2J1CzOh9fS40o/1pzVF xHI957itbSNzbMrk4o6PPUBl1CeM7ZXT67ukzUEV/eO3q4v5V7Y3LWcdQMoQWbqcLdlK+VSk DyWcfVH8zw1tv6nFI99uJP7alRQ= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e6091cb.7f9a4dcfafb8-smtp-out-n04; Thu, 05 Mar 2020 05:44:43 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 2E615C447A4; Thu, 5 Mar 2020 05:44:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id A1C56C43383; Thu, 5 Mar 2020 05:44:39 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 05 Mar 2020 13:44:39 +0800 From: Can Guo To: Stanley Chu Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com, avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com, beanhuo@micron.com, asutoshd@codeaurora.org, matthias.bgg@gmail.com, bvanassche@acm.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kuohong.wang@mediatek.com, peter.wang@mediatek.com, chun-hung.wu@mediatek.com, andy.teng@mediatek.com Subject: Re: [PATCH v1 2/4] scsi: ufs: use an enum for host capabilities In-Reply-To: <20200305040704.10645-3-stanley.chu@mediatek.com> References: <20200305040704.10645-1-stanley.chu@mediatek.com> <20200305040704.10645-3-stanley.chu@mediatek.com> Message-ID: <2f7c30cab1abf458930ac4253ff17ee1@codeaurora.org> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stanley, On 2020-03-05 12:07, Stanley Chu wrote: > Use an enum to specify the host capabilities instead of #defines inside > the > structure definition. > > Signed-off-by: Stanley Chu Reviewed-by: Can Guo > --- > drivers/scsi/ufs/ufshcd.h | 65 ++++++++++++++++++++++----------------- > 1 file changed, 37 insertions(+), 28 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index 4e235cef99bc..49ade1bfd085 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -510,6 +510,43 @@ enum ufshcd_quirks { > UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION = 1 << 5, > }; > > +enum ufshcd_caps { > + /* Allow dynamic clk gating */ > + UFSHCD_CAP_CLK_GATING = 1 << 0, > + > + /* Allow hiberb8 with clk gating */ > + UFSHCD_CAP_HIBERN8_WITH_CLK_GATING = 1 << 1, > + > + /* Allow dynamic clk scaling */ > + UFSHCD_CAP_CLK_SCALING = 1 << 2, > + > + /* Allow auto bkops to enabled during runtime suspend */ > + UFSHCD_CAP_AUTO_BKOPS_SUSPEND = 1 << 3, > + > + /* > + * This capability allows host controller driver to use the UFS HCI's > + * interrupt aggregation capability. > + * CAUTION: Enabling this might reduce overall UFS throughput. > + */ > + UFSHCD_CAP_INTR_AGGR = 1 << 4, > + > + /* > + * This capability allows the device auto-bkops to be always enabled > + * except during suspend (both runtime and suspend). > + * Enabling this capability means that device will always be allowed > + * to do background operation when it's active but it might degrade > + * the performance of ongoing read/write operations. > + */ > + UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND = 1 << 5, > + > + /* > + * This capability allows host controller driver to automatically > + * enable runtime power management by itself instead of waiting > + * for userspace to control the power management. > + */ > + UFSHCD_CAP_RPM_AUTOSUSPEND = 1 << 6, > +}; > + > /** > * struct ufs_hba - per adapter private structure > * @mmio_base: UFSHCI base register address > @@ -662,34 +699,6 @@ struct ufs_hba { > struct ufs_clk_gating clk_gating; > /* Control to enable/disable host capabilities */ > u32 caps; > - /* Allow dynamic clk gating */ > -#define UFSHCD_CAP_CLK_GATING (1 << 0) > - /* Allow hiberb8 with clk gating */ > -#define UFSHCD_CAP_HIBERN8_WITH_CLK_GATING (1 << 1) > - /* Allow dynamic clk scaling */ > -#define UFSHCD_CAP_CLK_SCALING (1 << 2) > - /* Allow auto bkops to enabled during runtime suspend */ > -#define UFSHCD_CAP_AUTO_BKOPS_SUSPEND (1 << 3) > - /* > - * This capability allows host controller driver to use the UFS HCI's > - * interrupt aggregation capability. > - * CAUTION: Enabling this might reduce overall UFS throughput. > - */ > -#define UFSHCD_CAP_INTR_AGGR (1 << 4) > - /* > - * This capability allows the device auto-bkops to be always enabled > - * except during suspend (both runtime and suspend). > - * Enabling this capability means that device will always be allowed > - * to do background operation when it's active but it might degrade > - * the performance of ongoing read/write operations. > - */ > -#define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 5) > - /* > - * This capability allows host controller driver to automatically > - * enable runtime power management by itself instead of waiting > - * for userspace to control the power management. > - */ > -#define UFSHCD_CAP_RPM_AUTOSUSPEND (1 << 6) > > struct devfreq *devfreq; > struct ufs_clk_scaling clk_scaling;