From patchwork Mon Apr 19 01:29:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12210613 X-Patchwork-Delegate: daniel.lezcano@linaro.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB612C433ED for ; Mon, 19 Apr 2021 01:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C310560FEA for ; Mon, 19 Apr 2021 01:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237054AbhDSBaZ (ORCPT ); Sun, 18 Apr 2021 21:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbhDSBaZ (ORCPT ); Sun, 18 Apr 2021 21:30:25 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC53C06174A; Sun, 18 Apr 2021 18:29:49 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id mh2so28801936ejb.8; Sun, 18 Apr 2021 18:29:49 -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:mime-version :content-transfer-encoding; bh=vWDsiHjf+/A9AetBxgcblwtERScRVbbT/XAQkG0jnaI=; b=BSqEGVrVWE5WRx2Qt4BNZyM9T157nDr2Hdsp+OwNLP3sqq+MaBjofQEsrXtyx+x6z7 bV+nGR7JC5DK13zj0LJ5wL5U0mn5wzbL4YSqHUrAfKvz+5dZNxmFOgYY/myl3YEO0WD/ CTTMCPzuzIY61RxtmdHAvrPdGgiG0w6mAfVJD0hjlLZMWUKxbbY4Hpl2BPWzXbhv3de6 rJ1P8AjG8vWK+UhU4GGGqoIbkuhs9IOSexx0tNvDA5AClqlgfGX2fNCQFZeQU2I8hHUi QN/ZmcWIJTONUqwvi8EfBpgpSciQVxZXn8h8H2ycVoQEp6vzJS6AYm5xgwfADnBuhfZ/ h7CQ== 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:mime-version :content-transfer-encoding; bh=vWDsiHjf+/A9AetBxgcblwtERScRVbbT/XAQkG0jnaI=; b=Y9lMaARIZgWuBeBhARG3mKYM2xvwyXBV4Na5/7whTT/JSXg1K6DWOME+b2M1S/VUUH cQ3lMz53vqDKCq7245kpcpc8hfrLqXRtW4Sj48b+CsxPRSpbegVNkZ6l1tBzCdGmc+ey caP7WFtJOsxztBZrJ9SZy3BCNDD4OTMl49lo1OWqT5l9gkb5kTSPPzAFYfpte8QhgTJo dGIvWm3idqedylHi3Y3yb+a82Ys6UQkBXaPG0MJcQw1Ztxa2PtEA5gqYg6OIZX9Y+NR/ FFuQxobd+fpuNavMH/a82LZjVSLV3wj9rw8oYZucdQ0gcKOiNk/lEE28SgBwN4HKzcYn 0qtA== X-Gm-Message-State: AOAM5308gNJVweUOelvxm82+xD2msi2L1odwE0XrD7rWTc+yrd2jbQmx JciEQHCICgu3vOPupAbUhf48faufyD9F0w== X-Google-Smtp-Source: ABdhPJz6pki9l6EsU/sEor1DgG33Aa+K5XaasHVCuV6bnDsHWcno0+evodKoHT3WQdImdh/wxzBWSA== X-Received: by 2002:a17:906:3952:: with SMTP id g18mr19437001eje.104.1618795788617; Sun, 18 Apr 2021 18:29:48 -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 mj3sm9083579ejb.3.2021.04.18.18.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Apr 2021 18:29:48 -0700 (PDT) From: Ansuel Smith To: Thara Gopinath Cc: Ansuel Smith , Andy Gross , Bjorn Andersson , Amit Kucheria , Zhang Rui , Daniel Lezcano , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [thermal-next PATCH 1/2] thermal: qcom: tsens: init debugfs only with successful probe Date: Mon, 19 Apr 2021 03:29:29 +0200 Message-Id: <20210419012930.7727-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org calibrate and tsens_register can fail or PROBE_DEFER. This will cause a double or a wrong init of the debugfs information. Init debugfs only with successful probe fixing warning about directory already present. Signed-off-by: Ansuel Smith --- drivers/thermal/qcom/tsens.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 4c7ebd1d3..f9d50a67e 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -918,8 +918,6 @@ int __init init_common(struct tsens_priv *priv) if (tsens_version(priv) >= VER_0_1) tsens_enable_irq(priv); - tsens_debug_init(op); - err_put_device: put_device(&op->dev); return ret; @@ -1158,7 +1156,12 @@ static int tsens_probe(struct platform_device *pdev) } } - return tsens_register(priv); + ret = tsens_register(priv); + + if (!ret) + tsens_debug_init(pdev); + + return ret; } static int tsens_remove(struct platform_device *pdev) From patchwork Mon Apr 19 01:29:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12210611 X-Patchwork-Delegate: daniel.lezcano@linaro.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D616C433B4 for ; Mon, 19 Apr 2021 01:29:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 354CD6108D for ; Mon, 19 Apr 2021 01:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233117AbhDSBaU (ORCPT ); Sun, 18 Apr 2021 21:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbhDSBaT (ORCPT ); Sun, 18 Apr 2021 21:30:19 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3220C061760; Sun, 18 Apr 2021 18:29:50 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id sd23so41698261ejb.12; Sun, 18 Apr 2021 18:29:50 -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=vyio+zXMVMJ7Uz88On71j+PqEMDFxBYUNNuIBYyFxT8=; b=NJnPBzkDirodq8hbHuRfEQrt27cLdZZeSqt/jCw3Bm2L/kE2vt4EOhA+LC5X6m4FpW sqOb1CpjcTIy8NZBhCQwDw7HUVtvj/zpaHz+vbEJqvkrvrkmngHALo/nRUF08lx394U9 vh8tPH4W0I029I2H36gHMjyJ9I0So6fJWbta4n9gcO4HI4lJFbT7cL0pddLijgKaOUTS Waxr5nLT0rsrZvxCPpzL3LZEzyB4M6nDWGZZYpSzepyCQ+A5a2t2ld401RhY8LfQOsRp Y9I8N3s+Ikcv5ZFhANC0buBQaomXoJdVx5Jg6JGbKHBcpOAaxDB2kAwhjfnjP4xBiOIG GSjA== 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=vyio+zXMVMJ7Uz88On71j+PqEMDFxBYUNNuIBYyFxT8=; b=F7LwPZvrp/VxpwnP/TOct+7AbEaKQ/exfueTMZDxMTus9Uci2hi+ouUB82JrB5rBvI pseFPIuRN3lQqTf/ktyDpPun2vGFNZCpM/vkY/FbGHOYOfw1TQuqBJjshUejQT+kZDJy vr1OukHNssrYFZfx7sGJEsngkM2YwjkEJNAn/nrCENasbubVsVMR9iJ4B9FzdvSqSaG1 aL0wOdHQr/wIsRQDnh71kvp9yS7++rArJoorkU/P4ChnQ8FaLASx29oR/yWTS7A12UyQ KF50R1SCnx2JWUMs7astv76d6gTNRQ2ddkx+Soo/gQQeQqJ7bWfxi/ln8WwFzP94g+sl CBfA== X-Gm-Message-State: AOAM533Tu9KvltKxzYkmA8gWNXjoISxle6UfNeG0vSqH+27Y1JMC0904 HuratOZOwgUaU/HAa9dq9mFtCAmM9wCorw== X-Google-Smtp-Source: ABdhPJxEOHY6dhXbVJoawZsMi2xGVHy/z8wvsBDyo953717LkPZl1Af7qHaAafvaoLEWABQNZll0Cg== X-Received: by 2002:a17:907:3f9f:: with SMTP id hr31mr19290251ejc.349.1618795789597; Sun, 18 Apr 2021 18:29:49 -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 mj3sm9083579ejb.3.2021.04.18.18.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Apr 2021 18:29:49 -0700 (PDT) From: Ansuel Smith To: Thara Gopinath Cc: Ansuel Smith , Andy Gross , Bjorn Andersson , Amit Kucheria , Zhang Rui , Daniel Lezcano , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [thermal-next PATCH 2/2] thermal: qcom: tsens: simplify debugfs init function Date: Mon, 19 Apr 2021 03:29:30 +0200 Message-Id: <20210419012930.7727-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419012930.7727-1-ansuelsmth@gmail.com> References: <20210419012930.7727-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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); + 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