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=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_DKIMWL_WL_HIGH autolearn=ham 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 42B73C2BCA1 for ; Fri, 7 Jun 2019 19:05:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 156A72133D for ; Fri, 7 Jun 2019 19:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559934324; bh=TxSMtx6lLGs98uGXIiVyUk0DVMENnYc/2yJw23Hmcd8=; h=In-Reply-To:References:To:From:Subject:Cc:Date:List-ID:From; b=HkLkjTR5y81dbqsJyb9aOyh/P5+MFG0Dn/HOOSplZ+lqUQmozky+5oEw6Kx+JGmhi ErxgAInByF+E3McXdgj0ulws7h86kkoYQzIsHsvOvHzAi0PyrkTLypZDK3EHP/rhzZ aFPO79kgA939X2UqHtuYeIOEcAsWJfGpt7LtXSkI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729456AbfFGTFX (ORCPT ); Fri, 7 Jun 2019 15:05:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:32914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729235AbfFGTFX (ORCPT ); Fri, 7 Jun 2019 15:05:23 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D276520868; Fri, 7 Jun 2019 19:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559934322; bh=TxSMtx6lLGs98uGXIiVyUk0DVMENnYc/2yJw23Hmcd8=; h=In-Reply-To:References:To:From:Subject:Cc:Date:From; b=DO3KFOM6eAnUf9YpBWbM86cXXPo/lHeb4x74qBQ43Qyrc9+tJCGSgMhZZVs3VaBfv HmLWGzcJ50XbgMn9cGFyKSReHWy2/oC6smGjWIczLbtn0cz+ko5Kf2eopNN/cOkwan G9nYHPrtmjpO2Sy9lwJmh2kHarxQCIQcE1FwL7Lo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <057720844e78e615e46de34a73b16ffaf7dbfc10.1558686047.git.leonard.crestez@nxp.com> References: <057720844e78e615e46de34a73b16ffaf7dbfc10.1558686047.git.leonard.crestez@nxp.com> To: Leonard Crestez From: Stephen Boyd Subject: Re: [PATCH] clk: Add clk_parent entry in debugfs Cc: Michael Turquette , Peter De Schrijver , Geert Uytterhoeven , Greg Kroah-Hartman , "Rafael J. Wysocki" , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" User-Agent: alot/0.8.1 Date: Fri, 07 Jun 2019 12:05:22 -0700 Message-Id: <20190607190522.D276520868@mail.kernel.org> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Quoting Leonard Crestez (2019-05-24 01:25:25) > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index aa51756fd4d6..94a93b07dd37 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -3009,10 +3009,21 @@ static int possible_parents_show(struct seq_file = *s, void *data) > =20 > return 0; > } > DEFINE_SHOW_ATTRIBUTE(possible_parents); > =20 > +static int current_parent_show(struct seq_file *s, void *data) > +{ > + struct clk_core *core =3D s->private; > + > + if (core->parent) > + seq_printf(s, "%s\n", core->parent->name); > + > + return 0; > +} > +DEFINE_SHOW_ATTRIBUTE(current_parent); Looks OK. > + > static int clk_duty_cycle_show(struct seq_file *s, void *data) > { > struct clk_core *core =3D s->private; > struct clk_duty *duty =3D &core->duty; > =20 > @@ -3040,10 +3051,11 @@ static void clk_debug_create_one(struct clk_core = *core, struct dentry *pdentry) > debugfs_create_u32("clk_enable_count", 0444, root, &core->enable_= count); > debugfs_create_u32("clk_protect_count", 0444, root, &core->protec= t_count); > debugfs_create_u32("clk_notifier_count", 0444, root, &core->notif= ier_count); > debugfs_create_file("clk_duty_cycle", 0444, root, core, > &clk_duty_cycle_fops); > + debugfs_create_file("clk_parent", 0444, root, core, ¤t_pare= nt_fops); Shouldn't we skip creation of this file if core->num_parents =3D=3D 0? So put this under the if condition below? > =20 > if (core->num_parents > 1) > debugfs_create_file("clk_possible_parents", 0444, root, c= ore, > &possible_parents_fops); > =20 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=-4.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH autolearn=ham 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 D5925C2BCA1 for ; Fri, 7 Jun 2019 19:05:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AED5820868 for ; Fri, 7 Jun 2019 19:05:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Bg+30V/x"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="DO3KFOM6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AED5820868 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:From:To: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=05/iuRu+vFX+yuR8hB1u5v6RPqgkBr0h9r8T2gqwUeU=; b=Bg+30V/xbyIrpy PVwnmZX1unhVUMqQXtoX6qiturUFI1fNy37G/77nXBLOrr0V0qox1+fxV6JZsVJcK+UQOyfy1m+qJ t7Qpht2hTYwlqtNfTS5htliSbqzkfhMeyiwpU7JemQgFAvCGnyOws8JyTedsZCn0fLWkVOlYhESUs 4oIfHuw3/8j5uFJ4sSjywHXxyq2zxUrwucB9PQ7X/GsVx/FFDyi8s4NMRBgkBUd1zLO9rg7wzQd8O jHfEqLAb9lGqPmxul4fbAoh5Q/8aKUbFmpy77DSRQmeFfPAryXFvovEMXwjjgF3npB460q/KlReY4 e9zVVljthpRghTo/NMgw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZKB3-0004Ca-VF; Fri, 07 Jun 2019 19:05:25 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hZKB1-0004C8-7M for linux-arm-kernel@lists.infradead.org; Fri, 07 Jun 2019 19:05:24 +0000 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D276520868; Fri, 7 Jun 2019 19:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559934322; bh=TxSMtx6lLGs98uGXIiVyUk0DVMENnYc/2yJw23Hmcd8=; h=In-Reply-To:References:To:From:Subject:Cc:Date:From; b=DO3KFOM6eAnUf9YpBWbM86cXXPo/lHeb4x74qBQ43Qyrc9+tJCGSgMhZZVs3VaBfv HmLWGzcJ50XbgMn9cGFyKSReHWy2/oC6smGjWIczLbtn0cz+ko5Kf2eopNN/cOkwan G9nYHPrtmjpO2Sy9lwJmh2kHarxQCIQcE1FwL7Lo= MIME-Version: 1.0 In-Reply-To: <057720844e78e615e46de34a73b16ffaf7dbfc10.1558686047.git.leonard.crestez@nxp.com> References: <057720844e78e615e46de34a73b16ffaf7dbfc10.1558686047.git.leonard.crestez@nxp.com> To: Leonard Crestez From: Stephen Boyd Subject: Re: [PATCH] clk: Add clk_parent entry in debugfs User-Agent: alot/0.8.1 Date: Fri, 07 Jun 2019 12:05:22 -0700 Message-Id: <20190607190522.D276520868@mail.kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_120523_285965_47A0F151 X-CRM114-Status: GOOD ( 10.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Geert Uytterhoeven , "Rafael J. Wysocki" , Greg Kroah-Hartman , Michael Turquette , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Quoting Leonard Crestez (2019-05-24 01:25:25) > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index aa51756fd4d6..94a93b07dd37 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -3009,10 +3009,21 @@ static int possible_parents_show(struct seq_file *s, void *data) > > return 0; > } > DEFINE_SHOW_ATTRIBUTE(possible_parents); > > +static int current_parent_show(struct seq_file *s, void *data) > +{ > + struct clk_core *core = s->private; > + > + if (core->parent) > + seq_printf(s, "%s\n", core->parent->name); > + > + return 0; > +} > +DEFINE_SHOW_ATTRIBUTE(current_parent); Looks OK. > + > static int clk_duty_cycle_show(struct seq_file *s, void *data) > { > struct clk_core *core = s->private; > struct clk_duty *duty = &core->duty; > > @@ -3040,10 +3051,11 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) > debugfs_create_u32("clk_enable_count", 0444, root, &core->enable_count); > debugfs_create_u32("clk_protect_count", 0444, root, &core->protect_count); > debugfs_create_u32("clk_notifier_count", 0444, root, &core->notifier_count); > debugfs_create_file("clk_duty_cycle", 0444, root, core, > &clk_duty_cycle_fops); > + debugfs_create_file("clk_parent", 0444, root, core, ¤t_parent_fops); Shouldn't we skip creation of this file if core->num_parents == 0? So put this under the if condition below? > > if (core->num_parents > 1) > debugfs_create_file("clk_possible_parents", 0444, root, core, > &possible_parents_fops); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel