Received: by 10.223.164.202 with SMTP id h10csp1937234wrb; Thu, 16 Nov 2017 06:51:37 -0800 (PST) X-Google-Smtp-Source: AGs4zMaXOQbXx5dX+9z8On2SRiPHR2zO/HskTh4svMbPpHeWW6onY/CYSVbCv4TcDp1yIxwG2X14 X-Received: by 10.101.71.205 with SMTP id f13mr1943943pgs.112.1510843897352; Thu, 16 Nov 2017 06:51:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510843897; cv=none; d=google.com; s=arc-20160816; b=WT3nUO5na0CriSt+/mA1vQ0u5LS8pf5SZO88QLcL2TAx/MvIAovXQTCu9neNLBl3XD 6IXRVV1r5IP+3plat8qWQIo9rPpf7Olk7E//BJSngjpf01vD8LUy36fWSA7dhCiNR4Cx EN2YY4t5O4uRkpePhvtOWbp4drkMNBlQV0kPb9OMtJcneEvp6l7KnhPLZFMgfEk1W5op fGC/Yc5HnQZHDUjci2C338PNgLyUtFzrhtzW16wdQS0VjVKB9sUnC1bB/DVZAQsHHogT nxzEozCaqYSdYBs0EllQhKaEekRFw3qnyL36GOMCTYtyaIUY9DajPyutKMxob4ZqiaBf ovKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter:arc-authentication-results; bh=UGWuuXOVVDMBDAyuvLQuBLVtD9GWN11CK+BKJvNAbYE=; b=PrYb3k61SjTQDycEGf95aPPxLscLwzMq5/x3MBWmPix55QQF0+W/WB/BC96KR3miuc rC6u3gQkuXRYqqEbW2w4OmjUR4DIMBHwWO22czYCI1EZmcN16yWseHWLljdIHiAh87Ou wzCtgqNuWoiw91NnBYV4g9zZBa8fdikUCdASKJ6WGP+IlbrZExm3mWKKKYJh9XuMK7lZ U4GeixppalWHnA9JG5ivuVpN8S2DXLBJ1ZJpeLvge2flOVH601FFYuLUQNwUMBqWRNAO XI3/SX0hKHGU9d1I5RrBVbAXvutt6i7RQVekYJsFN0MOmylCPjCT0Oco5Waa/MCiOHiX vfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=q2dBQ1um; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k26si1096405pfj.372.2017.11.16.06.51.23; Thu, 16 Nov 2017 06:51:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=q2dBQ1um; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934751AbdKPMkF (ORCPT + 91 others); Thu, 16 Nov 2017 07:40:05 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:46827 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934484AbdKPMj6 (ORCPT ); Thu, 16 Nov 2017 07:39:58 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171116123956euoutp02f1ffa0ed8f9a60105ee982392d12dbe0~3kVV_5ip40659606596euoutp02D; Thu, 16 Nov 2017 12:39:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171116123956euoutp02f1ffa0ed8f9a60105ee982392d12dbe0~3kVV_5ip40659606596euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1510835996; bh=UGWuuXOVVDMBDAyuvLQuBLVtD9GWN11CK+BKJvNAbYE=; h=Subject:To:Cc:From:Date:In-reply-to:References:From; b=q2dBQ1umWu6s2yvl+Pop4o/zSz0OQMn7L25AHCYvjmXasusGwG0/6WtXzm8C4MvDa OdaE7ylmIQzt88jK/koC5YhF8gQTm2gzZKE2NxINc4/tEAu+elx9ZkB0ut5rxWSXCp oYSclddMqXekOWwfVtJIAv0PZ9+5b/8ufg4CR6oE= Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171116123955eucas1p2ddf4d053811efe45ff20388537efa899~3kVVQJUeM0474404744eucas1p2f; Thu, 16 Nov 2017 12:39:55 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 0F.F4.12944.B178D0A5; Thu, 16 Nov 2017 12:39:55 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171116123954eucas1p188df045df68dcb26b2115d7894fd928d~3kVUmtuiR1252912529eucas1p1D; Thu, 16 Nov 2017 12:39:54 +0000 (GMT) X-AuditID: cbfec7f4-f79ab6d000003290-4c-5a0d871b3c02 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F8.16.18832.A178D0A5; Thu, 16 Nov 2017 12:39:54 +0000 (GMT) Received: from [106.120.51.25] by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OZI00HDIGIII940@eusync4.samsung.com>; Thu, 16 Nov 2017 12:39:54 +0000 (GMT) Subject: Re: [PATCH v2] component: add debugfs support To: Greg Kroah-Hartman , Russell King Cc: linux-kernel@vger.kernel.org, Marek Szyprowski From: Maciej Purski Message-id: <7642de97-981f-643c-bdff-b4be5c0effc5@samsung.com> Date: Thu, 16 Nov 2017 13:39:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-version: 1.0 In-reply-to: <20171115140131.GB21840@kroah.com> Content-type: text/plain; charset="utf-8"; format="flowed" Content-language: en-US Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnleLIzCtJLcpLzFFi42LZduznOV3pdt4ogxlfhCyaF69ns7i8aw6b xdojd9ktLvVPZHJg8bh87SKzx/65a9g9+rasYvT4vEkugCWKyyYlNSezLLVI3y6BK+P110cs BTMUKy52rWduYLwl1cXIySEhYCLxuP8RM4QtJnHh3no2EFtIYCmjxM55MV2MXED2Z0aJpd1r mGEaTvycyQKRWMYo8ffLD2YI5xmjxIWVa4DaOTiEBcwkLm+tB2kQEUiQmNIyixXEZhbwl1j2 vYsJpIRNQEtiTXs8SJhXwE7iwrSbYCUsAqoSj7p/g9miAhESxw8vZ4SoEZT4MfkeC4jNKaAv MfPMJ6iRVhLP/rVC2eISza03WSBseYnNa96CnSYhsIVN4t6ez0wQD7hIvJ36gB3CFpZ4dXwL lC0j0dlxEKqmWuLi111sEHaNROPtDVA11hKfJ21hhljAJzFp23RmkF8kBHglOtqEIEo8JLpb ZzFC2I4Ss25tZ4cEz15GientlxknMMrPQvLPLCQ/zELywywkPyxgZFnFKJJaWpybnlpsolec mFtcmpeul5yfu4kRmDxO/zv+ZQfj4mNWhxgFOBiVeHgbUniihFgTy4orcw8xSnAwK4nwuqfx RgnxpiRWVqUW5ccXleakFh9ilOZgURLntY1qixQSSE8sSc1OTS1ILYLJMnFwSjUw2j2typ9z /v1Xw2Cbq8VbtW/KR7zlvFN7cbXQBo3IhfKTFnCHTr9fvoxz4one23VP3KY++nPS7ImFkYFy 17H70U+2HNnzf/q5O4GGvYViYn2HXnjW9+TVr31+8dzrUNcbIo4/A9u57JoNtTaf1Lvq2XMx ofBQpPEc/gvqmjwqV3xv/rbblcl7U4mlOCPRUIu5qDgRACwTmQAaAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHLMWRmVeSWpSXmKPExsVy+t/xa7pS7bxRBq3HzSyaF69ns7i8aw6b xdojd9ktLvVPZHJg8bh87SKzx/65a9g9+rasYvT4vEkugCWKyyYlNSezLLVI3y6BK+P110cs BTMUKy52rWduYLwl1cXIySEhYCJx4udMFghbTOLCvfVsXYxcHEICSxglfv84COU8Y5SYf6qf uYuRg0NYwEzi8tZ6kAYRgQSJlZt2MYLYzAK+EnderWKBqN/PKPFhzXN2kHo2AS2JNe3xIDW8 AnYSF6bdZAWxWQRUJR51/wazRQUiJJ43v2eFqBGU+DH5HthBnAL6EjPPfGKFmG8m8eXlYShb XKK59SYLhC0vsXnNW+YJjIKzkLTPQtIyC0nLLCQtCxhZVjGKpJYW56bnFhvqFSfmFpfmpesl 5+duYgSG+rZjPzfvYLy0MfgQowAHoxIPr0YST5QQa2JZcWXuIUYJDmYlEV73NN4oId6UxMqq 1KL8+KLSnNTiQ4zSHCxK4ry9e1ZHCgmkJ5akZqemFqQWwWSZODilGhjzsvbeW2D6m6+TWTjs ybLYHxcyBR94f7kQpBm+VPju5kd1v81V2piiMgoWyn/excR0elZfgsvZvHs/f3bVr2Hal9vM V6EQf3j/6UsbL7B/zhL0TJw+30RqK8f/8maG6B9bJs96/9sg4HrMD5cLXpFS22VrNN7NnX8+ 3H3+22l8WyZMud1Zzr1FiaU4I9FQi7moOBEAPWqOjXECAAA= X-CMS-MailID: 20171116123954eucas1p188df045df68dcb26b2115d7894fd928d X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171115120534eucas1p25315c9e71abea9b7be93d66f97406523 X-RootMTR: 20171115120534eucas1p25315c9e71abea9b7be93d66f97406523 References: <1510747526-24831-1-git-send-email-m.purski@samsung.com> <20171115140131.GB21840@kroah.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/15/2017 03:01 PM, Greg Kroah-Hartman wrote: > On Wed, Nov 15, 2017 at 01:05:26PM +0100, Maciej Purski wrote: >> Add 'component' directory to debugfs. Create a new file for each master, >> when a master is added. Remove it on a master deletion. >> >> Show a list of devices matched with master and indicate if >> master's components were successfully added and if the whole master is >> bound. >> >> Signed-off-by: Maciej Purski >> --- >> Changes in v2: >> - use seq_printf() instead of seq_puts() when printing headers >> - move whole debugfs code to the file beginning in order to avoid >> forward declarations or using multiple ifdefs >> --- >> drivers/base/component.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 83 insertions(+) >> >> diff --git a/drivers/base/component.c b/drivers/base/component.c >> index 89b032f..8745ad9 100644 >> --- a/drivers/base/component.c >> +++ b/drivers/base/component.c >> @@ -17,6 +17,7 @@ >> #include >> #include >> #include >> +#include >> >> struct component; >> >> @@ -41,6 +42,7 @@ struct master { >> const struct component_master_ops *ops; >> struct device *dev; >> struct component_match *match; >> + struct dentry *dentry; >> }; >> >> struct component { >> @@ -56,6 +58,85 @@ static DEFINE_MUTEX(component_mutex); >> static LIST_HEAD(component_list); >> static LIST_HEAD(masters); >> >> +#ifdef CONFIG_DEBUG_FS >> + >> +static struct dentry *component_debugfs_dir; >> + >> +static int component_devices_show(struct seq_file *s, void *data) >> +{ >> + struct master *m = s->private; >> + struct component_match *match = m->match; >> + size_t i; >> + >> + mutex_lock(&component_mutex); >> + seq_printf(s, "%-40s %20s\n", "master name", "status"); >> + seq_puts(s, "-------------------------------------------------------------\n"); >> + seq_printf(s, "%-40s %20s\n\n", >> + dev_name(m->dev), m->bound ? "bound" : "not bound"); >> + >> + seq_printf(s, "%-40s %20s\n", "device name", "status"); >> + seq_puts(s, "-------------------------------------------------------------\n"); >> + for (i = 0; i < match->num; i++) { >> + struct device *d = (struct device *)match->compare[i].data; >> + >> + seq_printf(s, "%-40s %20s\n", dev_name(d), >> + match->compare[i].component ? >> + "registered" : "not registered"); >> + } >> + mutex_unlock(&component_mutex); >> + >> + return 0; >> +} >> + >> +static int component_devices_open(struct inode *inode, struct file *file) >> +{ >> + return single_open(file, component_devices_show, inode->i_private); >> +} >> + >> +static const struct file_operations component_devices_fops = { >> + .open = component_devices_open, >> + .read = seq_read, >> + .llseek = seq_lseek, >> + .release = single_release, >> +}; >> + >> +static int __init component_debug_init(void) >> +{ >> + component_debugfs_dir = debugfs_create_dir("component", NULL); >> + >> + if (!component_debugfs_dir) >> + return -ENOMEM; > > No need to test this at all, you should never fail anything if debugfs > is not working properly, just continue and move on. The result of any > debugfs call can be fed back into any other debugfs call without any > problems. > >> + >> + return 0; >> +} >> + >> +core_initcall(component_debug_init); >> + >> +static void component_master_debugfs_add(struct master *m) >> +{ >> + m->dentry = debugfs_create_file(dev_name(m->dev), 0444, >> + component_debugfs_dir, >> + m, &component_devices_fops); > > See, you do it well here, do the same thing when you create the initial > debugfs directory. I'll to this the way you suggest. Thanks. > > Also, "component" is very vague, can you think of a better term for > this? "device_component"? "dev_component"? Something else? But I > don't care, if you really like "component", that's fine. > I'm not really attached to that name, so I can change it to one that you suggested. Maybe Russell King has some preference on that? Best regards, Maciej Purski > thanks, > > greg k-h > > > From 1584141624745800256@xxx Wed Nov 15 14:13:01 +0000 2017 X-GM-THRID: 1584141046216679769 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread