Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3257607pxu; Tue, 15 Dec 2020 02:33:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrqKxmx0bnDHSpPqanqDIRkfr1/mc8zt18UK1HL8ZKWGtIwHuzdyCf5TJUIYnZn9NjN/fy X-Received: by 2002:a17:906:7b8d:: with SMTP id s13mr26045584ejo.479.1608028437526; Tue, 15 Dec 2020 02:33:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608028437; cv=none; d=google.com; s=arc-20160816; b=wDL2Yb1dKTP7Z9o5xXDoBt73QiXMXUTcUearJgWpaMeQs9tk5wz6XawqVv9H8MZ1UC HKEuyXIn30/0B/4fHzW5fUZtuGAr/tLvHAxIfFHYDt6eu1IT83qG92GwZDnQoJZAECwv SNMK819SnLxGXTDWB7FsJB2SJQxZwEiCM1ExwYmjej5+lm8q4CeU3gNfvWakp3x/67N2 J+V74YLbh+KgUuPIn8+adUYhTyGEWgR0hc7lTdH15diA3ZnSV39O2XrWQUaUsgM0yg6R uAqIJbhktUjGOd79GCs6Q+/xmZRrqiuuPf1S7VF/NNbFvChg4eLgKimiucI4fvAZmNcj O8aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=a4iTTGEkkE1CuiVq33XhUmgMkbPEM8DMTFwXPym0vBE=; b=j3tvEFEgdlz8mZXZs9lW/MbIDrgnGVLBhkUhnjSwZtjjdJXbc+CwU/ldxkS2yDfZzB YaxCtdG14ZA2O/afpm+WbNLI8f/njV+u+XayKu/eMY8AlB3ctWny3YiLAC0BSUiM9VBe 11O5n3iInDg/6vxymhgih7CI8mfdsx5u3aTHCZNWJAPEQFwR5XmzSIxm1kd1kwaMwaV5 JeFC2sylwDLHRar1w164RvnvHZXP60dnLFx6F+0CpIzHsjYij5L8gVl2qNHYdkmsAmIO 79WAcb8/Sem7Xj6csF2mUk5lpHXxAoMWxr2Jr6aIBg5KCVRewnkSOS+UPE0eXMOMFxwf 4ozw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rx5+KdVq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si671241ejg.723.2020.12.15.02.33.34; Tue, 15 Dec 2020 02:33:57 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rx5+KdVq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728352AbgLOKbo (ORCPT + 99 others); Tue, 15 Dec 2020 05:31:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:43932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728296AbgLOKbn (ORCPT ); Tue, 15 Dec 2020 05:31:43 -0500 Date: Tue, 15 Dec 2020 11:32:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1608028256; bh=xjHykK8XN96dFaYhZnIiizf13PE8cJP1VJ6OL+POwMs=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=rx5+KdVqHDFmwGePFBKeeEtCEGFlUSzx8w67xkKNWoRu8bslOe3BzN7jDUvcUOCcC bdnyDG8zkd0IqTOqJc7pww5pFPlbEC1BnAtOXK5nnqFYmkR6wP5R6eNxtax7ak4r9V NV0Acgqi8VazkHA8mrRnxvJTuxkQLCeFFs67co80= From: Greg KH To: Bean Huo Cc: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/6] scsi: ufs: Add "wb_on" sysfs node to control WB on/off Message-ID: References: <20201211140035.20016-1-huobean@gmail.com> <20201211140035.20016-2-huobean@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201211140035.20016-2-huobean@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 11, 2020 at 03:00:30PM +0100, Bean Huo wrote: > From: Bean Huo > > Currently UFS WriteBooster driver uses clock scaling up/down to set > WB on/off, for the platform which doesn't support UFSHCD_CAP_CLK_SCALING, > WB will be always on. Provide a sysfs attribute to enable/disable WB > during runtime. Write 1/0 to "wb_on" sysfs node to enable/disable UFS WB. > > Reviewed-by: Avri Altman > Reviewed-by: Stanley Chu > Signed-off-by: Bean Huo > --- > drivers/scsi/ufs/ufs-sysfs.c | 41 ++++++++++++++++++++++++++++++++++++ > drivers/scsi/ufs/ufshcd.c | 3 +-- > drivers/scsi/ufs/ufshcd.h | 2 ++ > 3 files changed, 44 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c > index 08e72b7eef6a..2b4e9fe935cc 100644 > --- a/drivers/scsi/ufs/ufs-sysfs.c > +++ b/drivers/scsi/ufs/ufs-sysfs.c > @@ -189,6 +189,45 @@ static ssize_t auto_hibern8_store(struct device *dev, > return count; > } > > +static ssize_t wb_on_show(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + struct ufs_hba *hba = dev_get_drvdata(dev); > + > + return scnprintf(buf, PAGE_SIZE, "%d\n", hba->wb_enabled); Please just use sysfs_emit(). > +} > + > +static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct ufs_hba *hba = dev_get_drvdata(dev); > + unsigned int wb_enable; > + ssize_t res; > + > + if (ufshcd_is_clkscaling_supported(hba)) { > + /* > + * If the platform supports UFSHCD_CAP_AUTO_BKOPS_SUSPEND, > + * turn WB on/off will be done while clock scaling up/down. > + */ > + dev_warn(dev, "To control WB through wb_on is not allowed!\n"); > + return -EOPNOTSUPP; > + } > + if (!ufshcd_is_wb_allowed(hba)) > + return -EOPNOTSUPP; > + > + if (kstrtouint(buf, 0, &wb_enable)) > + return -EINVAL; > + > + if (wb_enable != 0 && wb_enable != 1) > + return -EINVAL; > + > + pm_runtime_get_sync(hba->dev); > + res = ufshcd_wb_ctrl(hba, wb_enable); > + pm_runtime_put_sync(hba->dev); > + > + return res < 0 ? res : count; > +} Where is the new Documentation/ABI/ update for this new sysfs file you are adding? thanks, greg k-h