Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbdHOR3I (ORCPT ); Tue, 15 Aug 2017 13:29:08 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33381 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751819AbdHOR3H (ORCPT ); Tue, 15 Aug 2017 13:29:07 -0400 Subject: Re: [PATCH net-next 02/11] net: dsa: add debugfs interface To: Vivien Didelot , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn , Egil Hjelmeland , John Crispin , Woojung Huh , Sean Wang , Volodymyr Bendiuga , Nikita Yushchenko , Maxime Hadjinlian , Chris Healy , Maxim Uvarov , Stefan Eichenberger , Jason Cobham , Juergen Borleis , Tobias Waldekranz References: <20170814222242.10643-1-vivien.didelot@savoirfairelinux.com> <20170814222242.10643-3-vivien.didelot@savoirfairelinux.com> From: Florian Fainelli Message-ID: <2c13f5a3-0cc6-fe1a-86fc-c5bfd8cc2263@gmail.com> Date: Tue, 15 Aug 2017 10:29:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170814222242.10643-3-vivien.didelot@savoirfairelinux.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1494 Lines: 53 On 08/14/2017 03:22 PM, Vivien Didelot wrote: > This commit adds a DEBUG_FS dependent DSA core file creating a generic > debug filesystem interface for the DSA switch devices. > > The interface can be mounted with: > > # mount -t debugfs none /sys/kernel/debug > > The dsa directory contains one directory per switch chip: > > # cd /sys/kernel/debug/dsa/ > # ls > switch0 switch1 switch2 > > Each chip directory contains one directory per port: > > # ls -l switch0/ > drwxr-xr-x 2 root root 0 Jan 1 00:00 port0 > drwxr-xr-x 2 root root 0 Jan 1 00:00 port1 > drwxr-xr-x 2 root root 0 Jan 1 00:00 port2 > drwxr-xr-x 2 root root 0 Jan 1 00:00 port5 > drwxr-xr-x 2 root root 0 Jan 1 00:00 port6 > > Future patches will add entry files to these directories. > > Signed-off-by: Vivien Didelot > --- > +static int dsa_debugfs_create_switch(struct dsa_switch *ds) > +{ > + char name[32]; > + int i; > + > + /* skip if there is no debugfs support */ > + if (!dsa_debugfs_dir) > + return 0; > + > + snprintf(name, sizeof(name), DSA_SWITCH_FMT, ds->index); > + > + ds->debugfs_dir = debugfs_create_dir(name, dsa_debugfs_dir); > + if (IS_ERR_OR_NULL(ds->debugfs_dir)) > + return -EFAULT; > + > + for (i = 0; i < ds->num_ports; i++) { > + if (!ds->ports[i].dn) > + continue; This won't create port directories when using platform data, can you check for BIT(i) & ds->enabled_port_mask instead? -- Florian