From patchwork Wed Sep 14 15:46:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12976322 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8ED5ECAAD3 for ; Wed, 14 Sep 2022 15:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230152AbiINPqq (ORCPT ); Wed, 14 Sep 2022 11:46:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbiINPqp (ORCPT ); Wed, 14 Sep 2022 11:46:45 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7680761710; Wed, 14 Sep 2022 08:46:42 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id lc7so35785042ejb.0; Wed, 14 Sep 2022 08:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=qCtdxjdxOBvkSvYtMMaZ3sW9JYkd4Tc2K0Q0H8m3kj4=; b=frFM1gVUuxqwG/DVL4XTMx2i5cLj/w0y9DyIK92XGVYgN+Zy0/WYP8i1vjckdg4Bfo WIOhjk1P+GDtqPvDrFbDh7E2VflLrzWRmI2q3/2Jh44EDDViunJU+0ZyQf97ZO4WH7Y+ CyO728TkafnlZeiEe1JszXvOmMQt7gIzJHS/5Z1iNfojF6Bizx7OisUSJOppnK8sr5JC pD/GUwkUbQWtEdWiEIt2IzIcM2WBGk5shnZQ68MGkg3ti+nWISlchlHjL7GmDGINROqB ht0z9H6Vxa9othsmB/xSYlilvYUTHKnkj7iTtW9yeBj2B1TrbRNb7Rn3pcKKFjTp5FHr yt1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=qCtdxjdxOBvkSvYtMMaZ3sW9JYkd4Tc2K0Q0H8m3kj4=; b=6NqNZs3cuINC4rYnLZpEngdZQOQ2xOOsdt15dGfQhmLNGLahPnFtvph+a7EVjXditN xWbYAubcEyUjv6Vr+gsGsRJV8jpES75bRwD1PNhPBOZrNN3WItrmuOEcwKd2rqdT6V2B OrEXmAA9mrMNToCHMemySXZDtKYrM3Uqxq4CGQf8Cs9OM4piqI7ZHaLyi0JFBCsgHrg3 wV0ex7g2pL3ZWRmKK74ygTRb2dMKxvqqf3vbZTfEIwiCUrG/vNmcby9ynA4NgAGfk6jT N9kD7UqnQC5WFja5sRUKqe8UepKOAvAIybujQtgd0shIQ41MbDQIynwgXJwj5JQVx4Qw P6HQ== X-Gm-Message-State: ACgBeo2sVQiO0Elylkp+bAW/MszHZc/v8uTX6PIQ7t/uDxIfE5KSJeg6 HZh5/2Fim6dN/yOL2wS1nbk= X-Google-Smtp-Source: AA6agR7m5UIHgoP6PQV0w5Wvxq1/hmYZgsbZw8zxTNfidIPz1xUX5kfl1z4JD9dcDAT/aVNzl9eNtw== X-Received: by 2002:a17:907:3da3:b0:780:3d46:cbe3 with SMTP id he35-20020a1709073da300b007803d46cbe3mr1834594ejc.175.1663170400329; Wed, 14 Sep 2022 08:46:40 -0700 (PDT) Received: from localhost.localdomain (93-42-70-134.ip85.fastwebnet.it. [93.42.70.134]) by smtp.googlemail.com with ESMTPSA id u18-20020a1709061db200b0077077c62cadsm7800849ejh.31.2022.09.14.08.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 08:46:39 -0700 (PDT) From: Christian Marangi To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Amit Kucheria , Thara Gopinath , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi , Thara Gopinath Subject: [PATCH v2 1/2] thermal: qcom: tsens: init debugfs only with successful probe Date: Wed, 14 Sep 2022 17:46:34 +0200 Message-Id: <20220914154635.2928-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.37.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: Christian Marangi Acked-by: Thara Gopinath --- v2: - Change sob tag with new name 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 b1b10005fb28..cc2965b8d409 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; @@ -1153,7 +1151,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 Wed Sep 14 15:46:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12976323 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87C6FC6FA8B for ; Wed, 14 Sep 2022 15:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230072AbiINPqr (ORCPT ); Wed, 14 Sep 2022 11:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230205AbiINPqq (ORCPT ); Wed, 14 Sep 2022 11:46:46 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F31A1402D5; Wed, 14 Sep 2022 08:46:43 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id z21so22894296edi.1; Wed, 14 Sep 2022 08:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=3fEMqwu/7m90JA2rCJpdghe2lX/otH8/FVwJWzq7lZI=; b=Bi5D09J/lLGHBY4iPgk0h2oeeBJsx+4978gcV1ZbotADTkfIU/amTDzNXVoRQF7niK mHN0dYxP4embLRUbQVK1aJdR9QgN41NawraAs7UPykJFiut3sCT3X6WUCBXgVwhUZVmG IqiT0oKLAT78NqtUO/27vEq91VvEu5sqizzfwoFmJCy9M6ES/ggeoiflelyjL+NDqz8F +S3E7gCYYIS9MT5QjUvWm/rOgRStQ2Y2l0DieRJo4wVB2xNxbym6QZi5A31NCKj7Y2Qf nF9I4GbnuZcm+7dBHCAVTMV4W+d4auf4up+xB3e1kWB7Xj52MQMOJRCkYJoRxrDFdc1t yrsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=3fEMqwu/7m90JA2rCJpdghe2lX/otH8/FVwJWzq7lZI=; b=DAikOIFP2TDzbyb/j8iH1IHQmLtAjIpzzd/UfR5ph7kpH77pGH8SkouLUGlZBbilqI YOPTVVQ799ogcY7rnhB7onlwE7KwO4Si+22LwuCrh3wY809EtWzFMCMmmQWYW4YM26ug Kb8GTJMrfgzBe0xhexoXfKJT6zbzfHcsIOdLQfSDTjC8727lEdUOxqxoOjMnbjhGhE66 d3KhoQK8Chxk4vmEzOUptxYlNN6w393W/bKBsAcm7hYPGAcdqvr7vxfhaEmmFnYZfdZ4 eZ0QY1LG0mV+bVnnLgk8NuJ09x074GxPfVKgbzNxGBwkcKw5/v0IHjsCoh7/HwPjDXW8 uydg== X-Gm-Message-State: ACgBeo1xnQqe2zy7V25IGxi5eLj6hTwQxsaqGJYMiSHxxCo+f8FuM6yx B7i1Jecldgux/P9zLLpM+6nFqJ+IFSI= X-Google-Smtp-Source: AA6agR77XX86RsKcQFSsUFOux7rHsaN4yizVGgXqITU9r0+livb/E1zqr6/mtHFy3iuvb+btiJx1rg== X-Received: by 2002:aa7:d703:0:b0:44e:a7b9:d5bd with SMTP id t3-20020aa7d703000000b0044ea7b9d5bdmr31096347edq.425.1663170401917; Wed, 14 Sep 2022 08:46:41 -0700 (PDT) Received: from localhost.localdomain (93-42-70-134.ip85.fastwebnet.it. [93.42.70.134]) by smtp.googlemail.com with ESMTPSA id u18-20020a1709061db200b0077077c62cadsm7800849ejh.31.2022.09.14.08.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 08:46:41 -0700 (PDT) From: Christian Marangi To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Amit Kucheria , Thara Gopinath , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi , Thara Gopinath Subject: [PATCH v2 2/2] thermal: qcom: tsens: simplify debugfs init function Date: Wed, 14 Sep 2022 17:46:35 +0200 Message-Id: <20220914154635.2928-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220914154635.2928-1-ansuelsmth@gmail.com> References: <20220914154635.2928-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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: Christian Marangi Reviewed-by: Thara Gopinath --- v2: - Change sob tag with new name drivers/thermal/qcom/tsens.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index cc2965b8d409..ff82626cecef 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,17 @@ 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); debugfs_create_file("sensors", 0444, priv->debug, pdev, &dbg_sensors_fops); } #else