Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp432964ybt; Sat, 13 Jun 2020 09:01:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZcqRL9NpXRzgMcGacNdw78PR7P8v2Unc5m8j/wSZPHYgSE6v34BdvFJTu3cJKMudUpy5v X-Received: by 2002:a05:6402:2070:: with SMTP id bd16mr16256343edb.35.1592064079097; Sat, 13 Jun 2020 09:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592064079; cv=none; d=google.com; s=arc-20160816; b=Ba3vysybpkEjz1CE1aoKs04bB6Qun++JTxsDBKB7WizXICjoNkIxMva1YsCuo+fCD8 WSJubIapgcXDuAC56SWHqZxnZoQP44SK33o/kYbKfJfqj5nyAY3WH7H3pNG9CvSqg0d8 qyujQQoFMALP5U6vNH9WCFP1LXbPaTmHZW8qGtwpmnsMk9QUwzSAP+Ltcl27898sTEPS 6xj2JwUs7imriGyrKv/RYJuzArVDFMmDW2q6PuK4QzJLx50PxwpuHSSP9fexvmiK+5gq m672GCPRdVcVPT9qXB9A5KdIi04SUNltcW7EzP5tekhkQLXUfsxMuf3L3UGljFteNT1V aMsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Sjkczbkul9NKVPRH/wDQS0yGqzaoqVkIPgvS0BYIbb8=; b=SiQpHQmMJ3gQRDwsLcZCe9cFjtiAtCyJi3c5b1p7uFduGoH+oo8t52mF9U/Bfop8RV 9SDvxVQniO3VYS3E3wRplWACgdS7w5cGSbyKsRhmnlk0YFhTy8btudKvoRttU863XeGy kcIh36SdJg+wor2NZPVuR5uYIo9cc6n+6onIYpGtIx/rSRmbmbQDS4GfDlt92ipZwCDD e8mrc+WJ3++dEuw5Fak2NX0AI9762Y1elceJHesHbwYYLQoVKF82pQyTm3ZLYrb3svdD vgJNayQ8/3i0tzWg750jo52bUjeaDhelSxGVGi5y1W864P6aPRCJx/kHX3hYnbibMiIV M/Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VerhtY5s; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt12si8299308ejc.46.2020.06.13.09.00.56; Sat, 13 Jun 2020 09:01:19 -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=@gmail.com header.s=20161025 header.b=VerhtY5s; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726708AbgFMP6t (ORCPT + 99 others); Sat, 13 Jun 2020 11:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726682AbgFMP6l (ORCPT ); Sat, 13 Jun 2020 11:58:41 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 996D9C03E96F for ; Sat, 13 Jun 2020 08:58:40 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id e5so9734579ote.11 for ; Sat, 13 Jun 2020 08:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Sjkczbkul9NKVPRH/wDQS0yGqzaoqVkIPgvS0BYIbb8=; b=VerhtY5soLDoYsNEIsDmrkV7PUpF7PNRDJYCcrKpgZmGmJNn/NuT3r9Ei62e1PJ2XD yuB1Vb0+pxMxBokqj4uGEhrk2WXiWHbHcI+5I/nUjD2E4AY1WQ14veoYagahcL5p345X PiNwdGBf2aVRief1i/MZ+QLtmIgEmeDb6TCRkoMr69DnY05rYD0FCUuipvFEpFWJNVQd FJRzRaZGkjNGLXR/HJjC/eiN6E1EFXi8jlO2WDz6cpmLINRPuqNiMR9Mymo2Q725qmEq QoVdoja0cVu7ChA9fQZQvGcSCr2PLcGu1wo99zKiQ+KOl6ZKQQbADCjAoDyxGgXxvAuN aceA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Sjkczbkul9NKVPRH/wDQS0yGqzaoqVkIPgvS0BYIbb8=; b=Y2OnTQKtaggchZVQzbedSsUi/gSOu5vrneZJaAgnhl7zBWiIvhp4SaRgQUAoFMenoY eFpwDb0y7X1gn0fV6PVIjo2sHK0MGWc653CO4PgPVl5yzFXmmj8xc9waFSEpmrwMrVUd hLwsdk46khiEwuosoodefRIYo8OO3Ku+qwMwt+uQJV6eSwhNs5iKP4NGBs9ETpOUy4Rr /2dH1rZCAw/SHK6acj2Agxv940S/fWHR3EXRd6FJ0E6evHHx2YelvRZdX94RfzJHtBMX 1o/KRDgX2OxrD4WrXgkGuI6J0x3AyjycdUQC3YjJKON4M8qpwh1TJ1R/LG3rXKv6yrix XqZw== X-Gm-Message-State: AOAM533vAtRnRb8EhRarOJLyzvMXuY9aGjOUVeU9p6vnvNriZ4BFcYcO ojGglJ44sigX6m/dHL9JueKpzuIg/os= X-Received: by 2002:a05:6830:1ad7:: with SMTP id r23mr14155703otc.96.1592063920023; Sat, 13 Jun 2020 08:58:40 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::aaac]) by smtp.googlemail.com with ESMTPSA id 53sm2105565otv.22.2020.06.13.08.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 08:58:39 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org Cc: linux@rasmusvillemoes.dk, Jim Cromie Subject: [PATCH v2 23/24] kset-example: add pr_debug()s for easy visibility of its operation Date: Sat, 13 Jun 2020 09:57:37 -0600 Message-Id: <20200613155738.2249399-24-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200613155738.2249399-1-jim.cromie@gmail.com> References: <20200613155738.2249399-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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"); /* * Create a kset with the name of "kset_example", * located under /sys/kernel/ @@ -276,6 +286,7 @@ static int __init example_init(void) static void __exit example_exit(void) { + pr_debug("called"); destroy_foo_obj(baz_obj); destroy_foo_obj(bar_obj); destroy_foo_obj(foo_obj); -- 2.26.2