Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1234004pxk; Mon, 31 Aug 2020 13:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo0m6JbMrs4xcFCPxp5EdWoRhKG3IK8DZXaFW9Rzf4FlqlVGl4Fc2pqsBxmEcLm83OYHVG X-Received: by 2002:a17:906:868c:: with SMTP id g12mr2469780ejx.230.1598906222998; Mon, 31 Aug 2020 13:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598906222; cv=none; d=google.com; s=arc-20160816; b=augt4wwaeCE5D6NjsueZv432zV5Ev0Oy10FNwuAPf8i3YAYkHua2hN7x2uR6YKe4KI mE1HtoLSEaRBNRDceZfFTn1y5ul9C0iohOIMRhCgo/oIDMkyiKpaERaGil8BA1O+pz1i MybtNjmKF9QTnWIGLwFZz1TZr5UhEr6DTFVdZCUp3L9W0UWHzZuTiQLNxNej3VFTRaXt WQCGmo4u5oR8IfVS8CKq2Yd5wnXmxxGtknPtXEPBiTgB7lOq7Jxt3awcJU4dhhBcxK64 4QHQbJvPqE/eniqBvaroH/PmH+QZx6hTJrYMe3MkElOfJhYwCj+Kkzyi3497JCaAb9Qy p/9g== 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=tLMc2AoC+KjzdShJAZhh/7JBmG+icFLxMYh/8L1monU=; b=w4jK/10GCiD5OPA+pW65ZbeSE2OKI3b4yn6LUCsNd8ul8p2Yi2S2w3XMbbv/wY+T9p GG9rH7LGgm1hdEbfLAlEyaaZqWhijQkSTovY0rvu2zVZDIcUBLxh+nmhk9JNVBScifcY dzOslUZGfnygFhUopaRf95vV55l8KjPVDefavXlPeFUV4F1MgT6hc2F4kxqvBs919hPC 5vjtFxY6FuFuWhhTxlOdlxVluOcsRrJf4r5JDwBWkyKT/8bnkYBALj5fzFPwb1U0rmdg kK5gak+xZsmniiTbkzNm/QBBW37Il26wrJrazXv4HxmTcnQ6edg5/kRSkR2/tq/GcNrS 6t4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="e0Zo8/yJ"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si5800202edx.293.2020.08.31.13.36.38; Mon, 31 Aug 2020 13:37:02 -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; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="e0Zo8/yJ"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726068AbgHaRi5 (ORCPT + 99 others); Mon, 31 Aug 2020 13:38:57 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:36702 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgHaRi4 (ORCPT ); Mon, 31 Aug 2020 13:38:56 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1598895536; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=tLMc2AoC+KjzdShJAZhh/7JBmG+icFLxMYh/8L1monU=; b=e0Zo8/yJ9Jk67cPdhBJmVOhoVssb8mkaH03RCufgDXcWNhqaxKnce67FRotlP3v+QIwL0065 pHIGy9aZqtx5UzEhc3co1RJ+KpDLiLWpFNYA2bKCFOEzFtiYqUMMr8Y2Ayz6j0+cXP7TOegO W9yC6qlp2SWjpPJRYInLTI4m/eM= X-Mailgun-Sending-Ip: 69.72.43.7 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 smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 5f4d35af9bdf68cc03bc79b7 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 31 Aug 2020 17:38:55 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 35EE5C43391; Mon, 31 Aug 2020 17:38:55 +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 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: nguyenb) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8CA93C433CA; Mon, 31 Aug 2020 17:38:54 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 31 Aug 2020 10:38:54 -0700 From: nguyenb@codeaurora.org To: Bart Van Assche Cc: cang@codeaurora.org, asutoshd@codeaurora.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , Stanley Chu , Nitin Rawat , Bean Huo , open list Subject: Re: [PATCH v1 1/1] scsi: ufshcd: Allow zero value setting to Auto-Hibernate Timer In-Reply-To: <56c8bde3-2457-402f-0ad2-94fc1fe12cd5@acm.org> References: <56c8bde3-2457-402f-0ad2-94fc1fe12cd5@acm.org> Message-ID: <0914db1a7aaa8b3b528f2298eb213b3c@codeaurora.org> X-Sender: nguyenb@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 On 2020-08-28 20:13, Bart Van Assche wrote: > On 2020-08-28 18:05, Bao D. Nguyen wrote: >> static ssize_t auto_hibern8_show(struct device *dev, >> struct device_attribute *attr, char *buf) >> { >> + u32 ahit; >> struct ufs_hba *hba = dev_get_drvdata(dev); > > Although not strictly required for SCSI code, how about following the > "reverse > christmas tree" convention and adding "u32 ahit" below the "hba" > declaration? Thanks for your comment. I will change it. >> if (!ufshcd_is_auto_hibern8_supported(hba)) >> return -EOPNOTSUPP; >> >> - return snprintf(buf, PAGE_SIZE, "%d\n", >> ufshcd_ahit_to_us(hba->ahit)); >> + pm_runtime_get_sync(hba->dev); >> + ufshcd_hold(hba, false); >> + ahit = ufshcd_readl(hba, REG_AUTO_HIBERNATE_IDLE_TIMER); >> + ufshcd_release(hba); >> + pm_runtime_put_sync(hba->dev); >> + >> + return scnprintf(buf, PAGE_SIZE, "%d\n", ufshcd_ahit_to_us(ahit)); >> } > > Why the pm_runtime_get_sync()/pm_runtime_put_sync() and > ufshcd_hold()/ufshcd_release() calls? I don't think these are necessary > here. We may try to access the hardware register during runtime suspend or UFS clock is gated. UFS clock gating can happen even during runtime resume. Here we are trying to prevent NoC error due to unclocked access. > Thanks, > > Bart.