Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp783593ybt; Sat, 13 Jun 2020 23:08:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo5Yq51288Ir1sI6tFDtnIO9s8HJAtN4IrLirtSnP9QPf3WmgwxNsgM2cJb9YOK4cn1VyD X-Received: by 2002:a17:906:5418:: with SMTP id q24mr20037379ejo.266.1592114888813; Sat, 13 Jun 2020 23:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592114888; cv=none; d=google.com; s=arc-20160816; b=Yo1Vh3KGY/SJmKwSVQ4nZWzO3E1iWbUonCdQ6f+l97uaumkFBsfgvMl3aR1ED4gSZC aOADbbnOfMzOqn7YtspqILPpvfeXRBnP62/NB2hdWZV143q5GKhQt/BJB6gdtJWqkgea fTPlU17DtDVRvUvcHtAcdbvIrU1YM0kJKDnzz52fst1V/sKCYeyo3E4rutxwx2bcBOaO Vpa5+omW2NaHhfcfAdWZwsNSelEsyqEFKgzNc2W8eTFUaQM8B9/1JPbvZO4xQEb5ejQF 5GJBiFVnCekTiduiqGBN0j1E/83timklzay6Tj+NPjFN2NJbJEHz+e095THw81laaVUd MBlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RzN0iAP/vxPtflvlqx6cBHM1z9G0MGhfe9IbL5YuzMQ=; b=mdAROAtuYnOoZorfSV4IFLmqAR1eDu5EGmFjmTp5dR1KV+xsvnYFTg1PHzuYfAda7Q DPRMw1OnqzYE2EausUr0gNQRhp97bdeGe7t3bgMSwfQm410KZl/hM5nsaA5Xe++HI7gI NeWYZRPPZgj6RbBRJ9O8zUWzmC1yBPT5SyErivI9TZCjT6CAB/0sChagqGgncVqra7z+ EssTRNDIAe1g3NilX2PRpjI+UCdgiwRnhBLyfIYaaToJLJevvwTnvNa7W5zK2kppxuih zKZ+OuoVsEZ845A4PpQbUb4scfMCHySOCslDtx5qDjzxjiNhiWg1bIgLllBoly44wnY7 cDuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ny5UCHwd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bn18si7262698ejb.82.2020.06.13.23.07.46; Sat, 13 Jun 2020 23:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ny5UCHwd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726499AbgFNGFF (ORCPT + 99 others); Sun, 14 Jun 2020 02:05:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:38842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725265AbgFNGFF (ORCPT ); Sun, 14 Jun 2020 02:05:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 EACD72068E; Sun, 14 Jun 2020 06:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592114704; bh=2CSDwCSzFnYCIB4Swm1XflYFwYFE1DwSm8DZiH5VAhs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ny5UCHwdApcnokCBTdXFaf8W81qxPwwfMoUizDWdc4hk1khnsFFu242s8gWg2LBnL NbcSXX/Qz90BOZFKIbKeGkAfnjdlPx16AroAv8AuGsA17DOTDChKwppgGzwvldeiRB le2OLPDPpo//8fAVkDlsTYu8lR3OPAd9QVe+yghM= Date: Sun, 14 Jun 2020 08:05:01 +0200 From: Greg KH To: Jim Cromie Cc: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, linux@rasmusvillemoes.dk Subject: Re: [PATCH v2 23/24] kset-example: add pr_debug()s for easy visibility of its operation Message-ID: <20200614060501.GB2608744@kroah.com> References: <20200613155738.2249399-1-jim.cromie@gmail.com> <20200613155738.2249399-24-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200613155738.2249399-24-jim.cromie@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 13, 2020 at 09:57:37AM -0600, Jim Cromie wrote: > put pr_debug()s into most functions, to easily see code operate when > module is loaded and used. > > #> dmesg -w & > #> modprobe kset-example dyndbg=+pfml > #> cat /sys/kernel/kset-example/*/* > --- > samples/kobject/kset-example.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c > index c8010f126808..27c9b1beec28 100644 > --- a/samples/kobject/kset-example.c > +++ b/samples/kobject/kset-example.c > @@ -56,6 +56,7 @@ static ssize_t foo_attr_show(struct kobject *kobj, > struct foo_attribute *attribute; > struct foo_obj *foo; > > + pr_debug("called"); > attribute = to_foo_attr(attr); > foo = to_foo_obj(kobj); > > @@ -76,6 +77,7 @@ static ssize_t foo_attr_store(struct kobject *kobj, > struct foo_attribute *attribute; > struct foo_obj *foo; > > + pr_debug("called"); > attribute = to_foo_attr(attr); > foo = to_foo_obj(kobj); > > @@ -102,6 +104,7 @@ static void foo_release(struct kobject *kobj) > { > struct foo_obj *foo; > > + pr_debug("called"); > foo = to_foo_obj(kobj); > kfree(foo); > } > @@ -112,6 +115,7 @@ static void foo_release(struct kobject *kobj) > static ssize_t foo_show(struct foo_obj *foo_obj, struct foo_attribute *attr, > char *buf) > { > + pr_debug("called"); > return sprintf(buf, "%d\n", foo_obj->foo); > } > > @@ -120,6 +124,7 @@ static ssize_t foo_store(struct foo_obj *foo_obj, struct foo_attribute *attr, > { > int ret; > > + pr_debug("called"); > ret = kstrtoint(buf, 10, &foo_obj->foo); > if (ret < 0) > return ret; > @@ -140,6 +145,7 @@ static ssize_t b_show(struct foo_obj *foo_obj, struct foo_attribute *attr, > { > int var; > > + pr_debug("called"); > if (strcmp(attr->attr.name, "baz") == 0) > var = foo_obj->baz; > else > @@ -152,6 +158,7 @@ static ssize_t b_store(struct foo_obj *foo_obj, struct foo_attribute *attr, > { > int var, ret; > > + pr_debug("called"); > ret = kstrtoint(buf, 10, &var); > if (ret < 0) > return ret; > @@ -201,6 +208,7 @@ static struct foo_obj *create_foo_obj(const char *name) > struct foo_obj *foo; > int retval; > > + pr_debug("called"); > /* allocate the memory for the whole object */ > foo = kzalloc(sizeof(*foo), GFP_KERNEL); > if (!foo) > @@ -235,11 +243,13 @@ static struct foo_obj *create_foo_obj(const char *name) > > static void destroy_foo_obj(struct foo_obj *foo) > { > + pr_debug("called"); > kobject_put(&foo->kobj); > } > > static int __init example_init(void) > { > + pr_debug("called"); Why??? If you want to do something like this, use ftrace, that is what it is for. thanks, greg k-h