Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp945186pxy; Wed, 28 Apr 2021 18:10:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPU+fbJi8c0ggurQZogAc2xD/7ZIwqadA0p92dbSeNalHbgeu50w6VnptLxGURzLvjqfA4 X-Received: by 2002:a17:902:104:b029:ec:9fa6:c08 with SMTP id 4-20020a1709020104b02900ec9fa60c08mr33167661plb.10.1619658607990; Wed, 28 Apr 2021 18:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619658607; cv=none; d=google.com; s=arc-20160816; b=ahOHONihjoD5V5VHeGW1LPMdjTWyp6i8vXVQEpUQdIHTvDMRp4j0hQV/9Bpb8GLQEZ ItNM2YBU6MVxakbjh6N9PKZDaeVKDbQOfehWopSASOpeMlT8aw+o6aKXESzD0ODjuaxv L199JO7m4NPZM/TnckTpnY7xgAYWAnWmO4adhiu0S3oGIoEyPtMe/HpT/ZGzxFx5LdKb RBBGroaspFQMwJxsxryTFIw93M3MbKAz1r8346Xh0/OHZAqDd//ICYM5FoErXvQgBwa6 U5fRwTrOL3vKbfTYalX/pFZ78vsxFE3aafRh5OSZizwfCvaAPns1Hp3otvqpBbzkG06e o+6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0OMLFjLReOb2JwNxzWO6xyUiZXAv/sqF1QolMUD4D7A=; b=EyZi0vU+WM7+osVWUEgLeQ/oGWmM9eTBdZI1+pP9lYm8OVwjgzBOS1XeQ7qQ0k3FPu XF0fy+f2k3oPwnKMM5lpTMJhXTcZxb7HoonJG6nESarh+u31F3nnY8AlSiZDUPxHY4DY 6nesjOVHLgQ+KSEiM7aFQJd8SyeD9Ab7O01gyhmVuduuWgT/yLuUfWnhuumxwrut9L2k g/rKfItkRY2+14QiJQvyZP8LBnTONdmQp0rgBIpB5XvdmvsY2TdzKMeKbD/HUOQtKTTQ Xpu70ixRz1coJGJQ+zDpZdM63//bQXq4t3b1rRX3bjiPK2qndKdHRVKgeBXLiP9HQWin xm/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ncV3Zqaw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q15si1488185pfk.70.2021.04.28.18.09.53; Wed, 28 Apr 2021 18:10:07 -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=@gmail.com header.s=20161025 header.b=ncV3Zqaw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233053AbhD2BJX (ORCPT + 99 others); Wed, 28 Apr 2021 21:09:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbhD2BJW (ORCPT ); Wed, 28 Apr 2021 21:09:22 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B043C06138B; Wed, 28 Apr 2021 18:08:36 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id w3so97380749ejc.4; Wed, 28 Apr 2021 18:08:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0OMLFjLReOb2JwNxzWO6xyUiZXAv/sqF1QolMUD4D7A=; b=ncV3ZqawPPttw+QVtlDecYRJhUWMej3+hKvkHiNYQ9GeZIB/do3461XYDJ+K7Q7dkO lytuhhzbCgUIa+iHhSco7sfiAe4YIPZ1kUawVn1IgfaKJMKQfR7VLqOJyDxKOw8WgSK9 16uYjTX7SrKPaxm7UhLpehDveYgyY57mD5EnNMYntgmwtIOBwf8c7eT7wygLhUecXnvv diY6V7NA06KpFkG12gNShYhhsrIws+BBCBZEHVgSfY8kuGBoB1KqZpwaRfEBC9wBZ0sp D+R957udwuvXrHpe04dxfLtRDX63updfjjJ4uHPChU+CAEajckqIeDZ24UbMHu76TBd8 SMZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0OMLFjLReOb2JwNxzWO6xyUiZXAv/sqF1QolMUD4D7A=; b=Dj+H8GiYerS9fAu9hiShgY45eUOOTjRWYQKFvABiFP2phxg6Rj1nJT1VehhcsrPEgu 0da1k7dFNaD6M8mXwZNdkkzvRIDwx6zO2jzc25gBRin80PXqrSK9eDJVN2M5dxJukVBF 610BPL7V6pw4mEVSjfVDJtg8YFp8KZz8xuvfFgoGMhYP0cPC96XjsH0qZn7yilClPvPA rzuzULYFtSvPa8u+YOGCUkSlrxx08GGwYKf/Qwq1qqlIf4gWDO73h0ehxzqKgCOXl3rz RjEfkcg64CQy1TwnVQRdhl/PAAg0fdKQ4I2CbKUYnE+uMgzgnFagMz5I/uJLYsoE0x22 BHpg== X-Gm-Message-State: AOAM530pECrMoHYZ0JoMtgWByeM/07oKRiHO09UeWuawhalvKZiUmrUB L/RzVfJgSroWlgbVabFgPfUhEvc/c6P9MA== X-Received: by 2002:a17:906:494d:: with SMTP id f13mr14561587ejt.490.1619658515152; Wed, 28 Apr 2021 18:08:35 -0700 (PDT) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id d5sm1113398edt.49.2021.04.28.18.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 18:08:34 -0700 (PDT) From: Ansuel Smith To: Thara Gopinath Cc: Ansuel Smith , Amit Kucheria , Andy Gross , Bjorn Andersson , Zhang Rui , Daniel Lezcano , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [thermal-next PATCH v2 2/2] thermal: qcom: tsens: simplify debugfs init function Date: Thu, 29 Apr 2021 03:05:18 +0200 Message-Id: <20210429010518.13319-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210429010518.13319-1-ansuelsmth@gmail.com> References: <20210429010518.13319-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Simplify debugfs init function. - 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 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index b37d5fd71f3a..e43898bf3199 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -657,7 +657,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; @@ -669,16 +669,12 @@ 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); -- 2.30.2