Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp769852pxy; Wed, 28 Apr 2021 13:55:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkBZCWdrYUOXJf62sp/LVXFiBV+RBx341q7C3x6HRId1lB3yLIuwxal+mmkbhNdr9ZyW3x X-Received: by 2002:a17:906:ce5a:: with SMTP id se26mr21172057ejb.332.1619643351753; Wed, 28 Apr 2021 13:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619643351; cv=none; d=google.com; s=arc-20160816; b=uhVFK5pxqP811kntQNaC6EQDrt2I2iwBfyQ2fmOETTKh4KYrnAq+verRIBy4J5Tqc7 ibVbeLh1hlD07QCXbr1j0BxJjq7hcsowlAT7AVlV4B/XEGMDaOMndt2z3rjGr0P+FQpZ oIhwaW+JmBJ7wFhvcuhdBYsT/VFmbCs3Uqs9mtdOxt7oe/p5o5zmsi9scVJ91WLyw5nN clygxHqYbDYlWKc+CQt4sihZTi16UHewBzOwAgh8I0QP2PbJD6TQc2ah+KHiX0DrcGaq e81sRgC5uFx+Me0KsnL7Yp9+eXfXbWvEcYhrKv/9x95UTu6RFuP3O8E42t26zvPif6uZ 5Z1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Sn7CSGIgmGn5VKzZbm8BRN6Y1B3vMVtXzAiBVY8ViXE=; b=mIJAiBEpg0lNemmyfvhD2e2OsgK/MnWdIIrwLS79ORRjgzQtRlgFXlW65iq4g8VQnH GRTl3pizU6JGGo5gJrfiJYjSAP8030bBNdi/Ykv5scP6ZSzcAnguiDz0f9lSm2lHToRY 7ydxgd4c+LbFAypTQjZQJ8+UgpxsE0hmUz9fb3A+9yoFdvs4oRUazZZnl4f5ksR0gEvd BIq/fKXFy/A12uqRoqFlqZwcExsbz3lcWig9tNoP/h4GGVHQQ+ELI8PuCmcyRmiPGWdc AIVvsTUroUhGFxST0OZulZcf35IbcCZ4WUe9KvuWEZhquKJ66THF1FhL5V+FUloFBTUn Gelw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uv/K0P/Q"; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds7si1083749ejc.164.2021.04.28.13.55.28; Wed, 28 Apr 2021 13:55:51 -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=pass header.i=@linaro.org header.s=google header.b="uv/K0P/Q"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239670AbhD1TpX (ORCPT + 99 others); Wed, 28 Apr 2021 15:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232284AbhD1TpR (ORCPT ); Wed, 28 Apr 2021 15:45:17 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 915EDC061573 for ; Wed, 28 Apr 2021 12:44:31 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id x7so64291938wrw.10 for ; Wed, 28 Apr 2021 12:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Sn7CSGIgmGn5VKzZbm8BRN6Y1B3vMVtXzAiBVY8ViXE=; b=uv/K0P/Q182pdyPl5FpzzqZhMn45UrPIPQALeC9OD7sSme6UpfvHw0/R/1YCWlN2q2 CsnI3gnu3GZAwDve0cqzlzFNIHxFsdGEOEaibi21FxFoD3s43Qwbmp7tI3hWEaHztLxd c0hDUzNY3G8xKjcx7mzp9kcjJCEVyMRn7iTADXAV3e/T/xfwVHuYv7COt2dDGXIpk+Hg rzXPvmNFz8qIZJsCzv67dywANmiZ2SyEk0+QIGo2b38l4K3tUG4R9Mli88wUto9KblMW g2NPN0vIxZdaj2rHJ2vQSa90VvsT4zm3FCvYLfuKgDSEm951TzlCkvKusd0yiIR5Jox7 82IA== 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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Sn7CSGIgmGn5VKzZbm8BRN6Y1B3vMVtXzAiBVY8ViXE=; b=ajHol9sKsh1dMrqq0miSjfP5eQNPVyw5ZCzzby99Nq4z1+nb7IOfmL/e3iaJwOV5Mx B9uvyVvc3gtx8oypHK9YEmVy8s0DYReU69kgE7YwWm8HIZpT9E1X5ZZm/uj5aKXOGXUc ntaXp7ZiG9rG3IwcnxgvYn1J8gMdtCgGcTf/DpWe4sWq26idnQo05mkhhZdnwJgur6wd YDZDCC41To7eLYwzTtoSZDrEwcCOtmU08rQ+eweAUmUqpA21M9thW+ZQD0Xifs55an8K +7G5mCVUeV6yDsOjUmDD6YUPW2oymXQfwt9phajD+rnVLe1u2XWi2wDmqYYu6B4rqBNl ah1A== X-Gm-Message-State: AOAM530HVssrjSGXEXOZ7LV75lcCfiHuav5vhpqkuV2YtNCm/Kbx16nV qf7Q/mCAByJ/hTqr3mERvp7fxy5O+s9FlxJP X-Received: by 2002:adf:efca:: with SMTP id i10mr37850612wrp.316.1619639070055; Wed, 28 Apr 2021 12:44:30 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:c98e:c214:1762:12d3? ([2a01:e34:ed2f:f020:c98e:c214:1762:12d3]) by smtp.googlemail.com with ESMTPSA id 3sm9510689wma.45.2021.04.28.12.44.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Apr 2021 12:44:29 -0700 (PDT) Subject: Re: [thermal-next PATCH 2/2] thermal: qcom: tsens: simplify debugfs init function To: Thara Gopinath , Ansuel Smith Cc: Andy Gross , Bjorn Andersson , Amit Kucheria , Zhang Rui , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210419012930.7727-1-ansuelsmth@gmail.com> <20210419012930.7727-2-ansuelsmth@gmail.com> <8e679407-07e7-244a-48fa-0d4d451d744d@linaro.org> From: Daniel Lezcano Message-ID: <6c5208b3-8bbd-d00f-9147-c4a35ae202c7@linaro.org> Date: Wed, 28 Apr 2021 21:44:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <8e679407-07e7-244a-48fa-0d4d451d744d@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/04/2021 18:47, Thara Gopinath wrote: > Hi, > > Please include a cover letter next time describing the patch series. Yes, a cover letter helps for the understanding of a patch series but in this case the changes are simple enough to get rid of it. > On 4/18/21 9:29 PM, Ansuel Smith wrote: >> Simplify debugfs init function. >> - Drop useless variables >> - Add check for existing dev directory. >> - Fix wrong version in dbg_version_show (with version 0.0.0, 0.1.0 was >>    incorrectly reported) >> >> Signed-off-by: Ansuel Smith >> --- >>   drivers/thermal/qcom/tsens.c | 16 +++++++--------- >>   1 file changed, 7 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c >> index f9d50a67e..b086d1496 100644 >> --- a/drivers/thermal/qcom/tsens.c >> +++ b/drivers/thermal/qcom/tsens.c >> @@ -692,7 +692,7 @@ static int dbg_version_show(struct seq_file *s, >> void *data) >>               return ret; >>           seq_printf(s, "%d.%d.%d\n", maj_ver, min_ver, step_ver); >>       } else { >> -        seq_puts(s, "0.1.0\n"); >> +        seq_printf(s, "0.%d.0\n", priv->feat->ver_major); >>       } >>         return 0; >> @@ -704,21 +704,19 @@ DEFINE_SHOW_ATTRIBUTE(dbg_sensors); >>   static void tsens_debug_init(struct platform_device *pdev) >>   { >>       struct tsens_priv *priv = platform_get_drvdata(pdev); >> -    struct dentry *root, *file; >>   -    root = debugfs_lookup("tsens", NULL); >> -    if (!root) >> +    priv->debug_root = debugfs_lookup("tsens", NULL); >> +    if (!priv->debug_root) >>           priv->debug_root = debugfs_create_dir("tsens", NULL); >> -    else >> -        priv->debug_root = root; >>   -    file = debugfs_lookup("version", priv->debug_root); >> -    if (!file) >> +    if (!debugfs_lookup("version", priv->debug_root)) >>           debugfs_create_file("version", 0444, priv->debug_root, >>                       pdev, &dbg_version_fops); >>         /* A directory for each instance of the TSENS IP */ >> -    priv->debug = debugfs_create_dir(dev_name(&pdev->dev), >> priv->debug_root); > > Unconditionally creating priv->debug here is correct. The below if > (!priv->debug) will never be true because as per your patch 1, we call > tsens_debug_init once per instance of tsens. > >> +    priv->debug = debugfs_lookup(dev_name(&pdev->dev), >> priv->debug_root); >> +    if (!priv->debug) >> +        priv->debug = debugfs_create_dir(dev_name(&pdev->dev), >> priv->debug_root); >>       debugfs_create_file("sensors", 0444, priv->debug, pdev, >> &dbg_sensors_fops); >>   } >>   #else >> > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog