Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1636437pxa; Fri, 28 Aug 2020 20:14:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1NV2Xld8umcQNm6Aw16/5Vrej9UoEZvVo0YrUEBXI8WRaeujCWdPNyNfnDhpaGdLTSak0 X-Received: by 2002:a17:906:d050:: with SMTP id bo16mr1813544ejb.367.1598670897363; Fri, 28 Aug 2020 20:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598670897; cv=none; d=google.com; s=arc-20160816; b=GT0s2h0iBJIoM7qwvlHgU0YMbXKflE015WM53G986TcFDfshlaITACeH02GJHqdkGD Lgn3x1VAs4OmkTgIrXC+f/kWGwnsjXMMHO0TJ+QKmNy07QlfIyUhlwOVX50e4wjxRT7Z 3zY+tguL52fd2gmgoUbLc1bxEiMakzHGVv7hHSDQXM4Ycdz4ConhwaK8nwSpez/qZB+L 0gGpaWCrC+P432ja5Jwu+D7qY1QXsVJHzxwOpRVwBtTJMNzQSdfay+HGV0Z92aAg8wNb jwToCfL/VOiX4fiRNJkelO+Dprt9YZ7WxaQl8LsTF9nV5GTIKVIhKr9zGk273QXl2Nrq Y+YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=XXakmc3gymcUqXRvGokRvFPmNkxunt9+SUPrMkXb9nc=; b=ugptwSEi8c4ganV3SXfC8vUu+6hJZjX31MwqhSvLANnRZz/tmcrswCZDQHxEGRkANl 1aTujt0dDwy9RVP27uPSR85B5hClSs3hh3w8PoJuu5msIQdVHva+QrNmVvlnCDMAU6GQ kOKAVLrhBUvPuMMWfD7FpcqiMpidTZfSvdVboCDZxoUcbHV/rQ3Ow8lNkPDRGIl6I6U0 Sh+20eRIoBIdhgfCxhvdoilr0oiDmktuNi+oZaOQdy/hCvCnUzu89HT4Gmt/QsMZPEtA O1e6jN1J1klL9oNLpOxrfSYaPjGVeguh+wX5T76DufxxhJU24SQk8JovpX+TvCojVbXP q3MA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r7si718921edb.20.2020.08.28.20.14.33; Fri, 28 Aug 2020 20:14:57 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726900AbgH2DN7 (ORCPT + 99 others); Fri, 28 Aug 2020 23:13:59 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34281 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726395AbgH2DN7 (ORCPT ); Fri, 28 Aug 2020 23:13:59 -0400 Received: by mail-pg1-f194.google.com with SMTP id i10so1338930pgk.1; Fri, 28 Aug 2020 20:13:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=XXakmc3gymcUqXRvGokRvFPmNkxunt9+SUPrMkXb9nc=; b=bZahgTx3i8Ja1CI6Yq6N28bx3gbkFQ1Fc8k1ixM5MSN+NZOzR0wK3lWBbTrgMuEAQC EosoOAKr8oIyhielm4TmuzUPU6dx3FDHoZALx+mJLV5npGHKu94xtHOZ+N+J2p3hLO3L jwwlVGoAQUBp1dw+TwLJLVQ2RSiNR0CJcXKHubWfCfAuh/s/aroTn9L7dt8oZ0ebooKV elXamfA6lu1rcqgK43quQUBx4zJ1grVYFiW3Suw3UJph4GPf+Ch3JqKymtc1BBsP8JmC 7/ipwFHhjJt0rXSpk9Zpn4/e/CJy1Q2dXRnwD2Z71Ar4BBYY4Ld2juOphnfoCmmRP8Su jUZg== X-Gm-Message-State: AOAM532Gx1lI05VXGKtxrUznEWwkocHrYWHbAX1/mtm9Mt4X8ud2lVlQ SWhkJDUTJHuvK41WMiRM2hFGpYxtasI= X-Received: by 2002:a63:c901:: with SMTP id o1mr1218245pgg.2.1598670837823; Fri, 28 Aug 2020 20:13:57 -0700 (PDT) Received: from [192.168.3.217] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id f18sm857290pfj.35.2020.08.28.20.13.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Aug 2020 20:13:57 -0700 (PDT) Subject: Re: [PATCH v1 1/1] scsi: ufshcd: Allow zero value setting to Auto-Hibernate Timer To: "Bao D. Nguyen" , cang@codeaurora.org, asutoshd@codeaurora.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , Stanley Chu , Nitin Rawat , Bean Huo , open list References: From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU447Bts8TJNa3lZKS1 AvW1ZklbvJfAJJAwzDih35LxU2fcWbmhPa7EO2DCv/LM1B10GB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hfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <56c8bde3-2457-402f-0ad2-94fc1fe12cd5@acm.org> Date: Fri, 28 Aug 2020 20:13:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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. Thanks, Bart.