Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4699060rwl; Mon, 3 Apr 2023 08:26:50 -0700 (PDT) X-Google-Smtp-Source: AK7set9pYPB9vCPkZAX4R2ygjCCj9M/ADOX/5BW0eVei9J4RHmcQCY0tm4GVccTmzS6Jj+RxrPJB X-Received: by 2002:a05:6a20:29a0:b0:d9:2028:dfd4 with SMTP id f32-20020a056a2029a000b000d92028dfd4mr29141392pzh.19.1680535609739; Mon, 03 Apr 2023 08:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680535609; cv=none; d=google.com; s=arc-20160816; b=G8ViMo0CwTn6CmHEekl3KAq+1MIR1HHqFsys8DL73If6vrFqf7t0WCHPffbkM/2G0Z wWQk3+tA8/Xy3OHPEG9huRfeQDeY7ESXXWJOmTwjr3yh77o3myt1siLuIwwwawZfg8Q4 PLGteft61EHtrfXVJqzIpYo4gFbYvyxbfihLxxkMO1ZxR9QfTPwrUwXwPUCz0MEl020N 7OiknRdsEC5m7LqsNb9FNuNKh81zyDc7p1CnryZRG0sSsxAelAGuwqaXQPXvmqqCBMqQ lxDX5yQdAuNsQUWuBSEjqMoC/YwPu+FMyHiAXe0+fQhpN8f1xoJTNKVEkXz+svB73MDB WcOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pQNnVGBwR1zLwyjbiqyhOJRY+qABPF1Qm7nCMwXhrsA=; b=Hq4MGEfq89MUac0w5ChZGGHxoyGprpfwnR3R2rTxzrvb16oRLMdesgfEeXQjThYWq/ Ga9KxXbUqKWTz9eVxDgh1lMP+hHsP0RyPUyK6xkOYJaRA0bOWo4XXtXJY5upUR3NaWeB tifo1mG5Ehoc6eYH866iPddHQcbayWqJVP+ZuN8xiaD5vpjMa0DZINmsk7djH9zWt2Oo WvbveE13XwnL9Vs3f8Gn52txs4NCBgYFZ4mKrPHScaOOmHtxNY0bMRIfktKcmuWiN58c 4eVtFjW+mXUXVh+Xjmcr6D0Bh2LYLCIImKw6vAGFzPiYnabaaSGHXApJZ9satZUkiKtx iwoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mRsYPWkY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020aa79687000000b00625108d5b7esi8461982pfk.103.2023.04.03.08.26.37; Mon, 03 Apr 2023 08:26:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mRsYPWkY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232468AbjDCPGw (ORCPT + 99 others); Mon, 3 Apr 2023 11:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232425AbjDCPGv (ORCPT ); Mon, 3 Apr 2023 11:06:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5D9191D0 for ; Mon, 3 Apr 2023 08:06:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0679D61F94 for ; Mon, 3 Apr 2023 15:06:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0CD2C433D2; Mon, 3 Apr 2023 15:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680534409; bh=iPsLfUOydlyRBM14W+1Y54Vdkd9NzvvPvuL3Akt7gro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mRsYPWkYCNmwTCjgnX9A4Fgng8HytyNJLrHJG55zROJd+xwUXCaIB/Z+2HKftDsVD 9BX4RxhBRVkrv1zrwAYZHDE/xXlYxYwBMr91VbEny7S0WD01sXo6VptG4e00uf8yZa 5HXaNt5WArUs+4nVo+FmDU+KxudutNURsPf/YvB8flUdvsIeq23eeOv4qVRgqsYw8o PydEPYPhpFxousptAc465o/Qjvtcu9JBlxgegUDLYeuHsPMvwozW9BohIBKiJnhiF9 QtvLyGcu2VzvHj+MpqHzUwRUnmLG3YfKH3ntCjrt+RDEUsXYfG5oFdS4BdkbIn8qos CvUrnMlh7drUg== Date: Mon, 3 Apr 2023 20:36:45 +0530 From: Vinod Koul To: Chunfeng Yun Cc: Matthias Brugger , AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Eddie Hung Subject: Re: [PATCH v9 1/2] phy: core: add debugfs files Message-ID: References: <20230316071452.9161-1-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230316071452.9161-1-chunfeng.yun@mediatek.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16-03-23, 15:14, Chunfeng Yun wrote: > Add a debugfs root for phy class, and create a debugfs directory under > the root when create phy, then phy drivers can add debugfs files. > > Signed-off-by: Chunfeng Yun > --- > v9: create a 'phy' debugfs root, add a debugfs entry in struct phy suggested by Vinod; > > No v8 sent out; > > v2~v7: no changes > --- > drivers/phy/phy-core.c | 14 ++++++++++++++ > include/linux/phy/phy.h | 2 ++ > 2 files changed, 16 insertions(+) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index 9951efc03eaa..05715352881e 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -20,6 +21,7 @@ > #include > > static struct class *phy_class; > +static struct dentry *phy_debugfs_root; > static DEFINE_MUTEX(phy_provider_mutex); > static LIST_HEAD(phy_provider_list); > static LIST_HEAD(phys); > @@ -996,6 +998,8 @@ struct phy *phy_create(struct device *dev, struct device_node *node, > pm_runtime_no_callbacks(&phy->dev); > } > > + phy->debugfs = debugfs_create_dir(dev_name(&phy->dev), phy_debugfs_root); > + > return phy; > > put_dev: > @@ -1226,6 +1230,7 @@ static void phy_release(struct device *dev) > > phy = to_phy(dev); > dev_vdbg(dev, "releasing '%s'\n", dev_name(dev)); > + debugfs_remove_recursive(phy->debugfs); > regulator_put(phy->pwr); > ida_simple_remove(&phy_ida, phy->id); > kfree(phy); > @@ -1242,6 +1247,15 @@ static int __init phy_core_init(void) > > phy_class->dev_release = phy_release; > > + phy_debugfs_root = debugfs_create_dir("phy", NULL); > + > return 0; > } > device_initcall(phy_core_init); > + > +static void __exit phy_core_exit(void) > +{ > + debugfs_remove_recursive(phy_debugfs_root); This should be moved to phy_release() we want the debugfs to be cleaned first > + class_destroy(phy_class); hmmm we are missing this already, that might be an issue! > +} > +module_exit(phy_core_exit); > diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h > index 3a570bc59fc7..f6d607ef0e80 100644 > --- a/include/linux/phy/phy.h > +++ b/include/linux/phy/phy.h > @@ -148,6 +148,7 @@ struct phy_attrs { > * @power_count: used to protect when the PHY is used by multiple consumers > * @attrs: used to specify PHY specific attributes > * @pwr: power regulator associated with the phy > + * @debugfs: debugfs directory > */ > struct phy { > struct device dev; > @@ -158,6 +159,7 @@ struct phy { > int power_count; > struct phy_attrs attrs; > struct regulator *pwr; > + struct dentry *debugfs; > }; > > /** > -- > 2.18.0 -- ~Vinod