From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 5DE0CC3A59F for ; Mon, 26 Aug 2019 20:55:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BED9217F5 for ; Mon, 26 Aug 2019 20:55:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="CG3B73Jc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbfHZUz6 (ORCPT ); Mon, 26 Aug 2019 16:55:58 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43966 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfHZUzx (ORCPT ); Mon, 26 Aug 2019 16:55:53 -0400 Received: by mail-pl1-f195.google.com with SMTP id 4so10607414pld.10 for ; Mon, 26 Aug 2019 13:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:cc:subject:to:from:user-agent:date; bh=FghN6Mc40EPJyH60IJRS3NSuxjYJJ6oJa+6cfkHbcEQ=; b=CG3B73JctUodMjIEjMsdzkgftz3Lk7Hw301lt+ChJplNaD4WWljA7Mf07AXYJSksH1 zK8iBXNS71J22cYdDCipqCOVcu10jmcRPqdcB4jWsfUDB3moMUaJLamzkZumWqO4cAbv x9nBWiUT7BbCgCsl6xfUyRcRXV8tN/eRY/9eo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:cc:subject:to:from :user-agent:date; bh=FghN6Mc40EPJyH60IJRS3NSuxjYJJ6oJa+6cfkHbcEQ=; b=Os87Xp7aMQsbttrxc5ZdT2I2SkYt8verJ50jfoh4m0c0vmx1sxiuFRIBIWaRVOJOkk YBTQYZ7EOk7fZwAXqzXpsYW6HpH+KFYX/khatahQ5+Vj18C1be3nqtWCcY2aBKRCQdRU sjDu9dz3aTAx7ke1i15ROqJ2eUCx31rM2wYESNvyVIq2ilWJ5wUgxnPQ9jDzbhhgDdGz lMdtEEjtUn5MkERIjciR+l2mFXPih7FtFyFpfpMnrBkg3WYbs7WkBBAtUZiusMR9C7Ka O2//hZ0qZfbVbY7K0RDUCba2dySZVcto/v7UgCjJY+h0dj4hd9yFF5RqlkzK9wjo7S1z ECQg== X-Gm-Message-State: APjAAAUpdURop9OkeHN5VBG3qLZDGZN/uAMfo5040SY/p9kAzYrfFevq K2NaH9oBFDKupWM5t3HQcMNBPA== X-Google-Smtp-Source: APXvYqx9XXxGe4Jgq3CTT3CN1lc1lQpUBmkZwGA+hD5RxJH41Dh4HIrKDUhBYRQDSJhlhN27af5CzA== X-Received: by 2002:a17:902:a40d:: with SMTP id p13mr20580372plq.92.1566852953013; Mon, 26 Aug 2019 13:55:53 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id v184sm11039530pgd.34.2019.08.26.13.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 13:55:52 -0700 (PDT) Message-ID: <5d644758.1c69fb81.76a4f.cf59@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <534b5017c2210ba8d541c206dace204d6617b4c9.1564091601.git.amit.kucheria@linaro.org> <5d577d77.1c69fb81.b6b07.83e6@mx.google.com> <5d5ab1e0.1c69fb81.d71db.1ca3@mx.google.com> Cc: Andy Gross , Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui , Andy Gross , Bjorn Andersson , Eduardo Valentin , linux-arm-msm , LKML , Linux PM list Subject: Re: [PATCH 04/15] drivers: thermal: tsens: Add debugfs support To: Amit Kucheria From: Stephen Boyd User-Agent: alot/0.8.1 Date: Mon, 26 Aug 2019 13:55:51 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Amit Kucheria (2019-08-21 05:55:39) > On Mon, Aug 19, 2019 at 7:57 PM Stephen Boyd wrote: > > > > Quoting Amit Kucheria (2019-08-19 00:58:23) > > > On Sat, Aug 17, 2019 at 9:37 AM Stephen Boyd wr= ote: > > > > > + > > > > > +static void tsens_debug_init(struct platform_device *pdev) > > > > > +{ > > > > > + struct tsens_priv *priv =3D platform_get_drvdata(pdev); > > > > > + struct dentry *root, *file; > > > > > + > > > > > + root =3D debugfs_lookup("tsens", NULL); > > > > > > > > Does this get created many times? Why doesn't tsens have a pointer = to > > > > the root saved away somewhere globally? > > > > > > > > > > I guess we could call the statement below to create the root dir and > > > save away the pointer. I was trying to avoid #ifdef CONFIG_DEBUG_FS in > > > init_common() and instead have all of it in a single function that > > > gets called once per instance of the tsens controller. > > > > Or call this code many times and try to create the tsens node if > > !tsens_root exists where the variable is some global. >=20 > So I didn't quite understand this statement. The change you're > requesting is that the 'root' variable below should be a global? >=20 > tsens_probe() will get called twice on platforms with two instances of > the controller. So I will need to check some place if the 'tsens' root > dir already exists in debugfs, no? That is what I'm doing below. >=20 Yeah. I was suggesting making a global instead of doing the lookup, but I guess the lookup is fine and avoids a global variable. It's all debugfs so it doesn't really matter. Sorry! Do whatever then.