Received: by 2002:a05:7208:13ca:b0:7f:395a:35b6 with SMTP id r10csp17773rbe; Wed, 28 Feb 2024 09:13:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVfGvHGgBiKFe8V0D+TdG4CLAiUbohictwjYmjljNYRbC2RMN2RfqyHibmGDFoXV0/zyHpiweEyXOUdm/SfML6hoReZI1uTyOkXqYX8uQ== X-Google-Smtp-Source: AGHT+IFf0VSDMGeYy13XpVS6ZdjWtvWeEP3Yybw4dqHccsqtZpyn1zF6jucLJJ4nnpfOUVt/McRg X-Received: by 2002:a5e:da49:0:b0:7c4:9375:71a5 with SMTP id o9-20020a5eda49000000b007c4937571a5mr78723iop.16.1709140419647; Wed, 28 Feb 2024 09:13:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709140419; cv=pass; d=google.com; s=arc-20160816; b=UzGK5Sxi2uhs6ETcJ3YsuTAMa9JmlAWjpPmg74z8/OuY3heyC3f82T38F/EW63FHvP hxJXXcZiwkbPsVyo9nifECPvIAbdyOh4EL1FhJAvnrMUcRpor0ZqYVvmwWWwlISUobqd AOEDieI5TiPMEXh99dQgYH9Z1JxNj5DC+D+VeAMFjTZFmjkFZWmjYcSPiwHB2YnSz0Em u7BEDnCS97H9IHDNYI4lNzO/2Y0RYMeeJMR8ObPM1YJThbfO03Uo+VJ8ulWGrjpx8HJV xpG1eDURxAMoKCGH2o3dnL3+bKkYz4SszUDu8+DkbJMSfyIxJhaKJdtaIleQdP3N0vsx FZpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ATTunrxx8mfo9iaJ9GmqVqGlssdQqFA0a4Hs7ZDBupc=; fh=a5QWMM9qtBQ96A/XT1v6G6Uaydfx/PmXPzHdHUmfJIY=; b=o9i8/Tb/mtvFC1lHos9rRdDYeILMLKKkGto0iQynEkwB/PGIes6cfyDicFLUadsSA6 2LwQOjsay/wACE5e4ApCc2sFoaEVgr+AoOzEIwIGF3+1dHDPro/FUDpmGqHv2LX2pgX+ Q4/C1JD70jxX8N/DrcoiXta4+b2RIxvVmYFqU3TSxTY+CD8DxcY1v1FXdOKEih6QGeMj le43X1gO5xWNjfhe2pAHWZGPwdSrpVrJTBn//P9rXF1RuNcc5vdFwubQjdV1vM9pzHt3 Mo/Doe4LXi66NoJ8ETIbSuXdSPmPa5cxpCgx+fjxPVe4ZM0uyAE+/2arbHykl39QwhTG KUDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=6bBKFRXx; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-85420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z14-20020a63e10e000000b005cdfa589cfbsi7659306pgh.148.2024.02.28.09.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 09:13:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=6bBKFRXx; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-85420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 556BB28B132 for ; Wed, 28 Feb 2024 17:13:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A23C3FBB8; Wed, 28 Feb 2024 17:13:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="6bBKFRXx" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AB743FB82; Wed, 28 Feb 2024 17:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709140411; cv=none; b=ClO0myvsuqZgmVc0u9gsqCFTxvXgm6nyTXdfGDpfSWq7CBGiHOCUQVUoihDjbZcfhrH7+4AjcyqhAI9qXBn6t1wjXAwOxcQkrRm90iGlTyKZOMaovCc6XjmqZ9woxX6P82aDakCwnZEbxxiqAGfPEF2YBpbEWJ3eDi2DsvZTKaI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709140411; c=relaxed/simple; bh=PJaF6gSLkw7fAhbaAIUur5cxQrm9SOr3pOGCt3bL4vA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AOpqoAF6MdU+NSxl8ClOhjqKCSBfzUR5XMKddZ20U4SToiw26UuJsQ8CHUooZu/lVK3/BqTY9XJX2JkiCARWxqiNCUxv+FcWuwhimxuDF8zcx8sl0DneeIqYh4vaiHybYWfn4EghbZjimghR76dImM3JgcTBNWag1SVpj8/OJJw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=6bBKFRXx; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ATTunrxx8mfo9iaJ9GmqVqGlssdQqFA0a4Hs7ZDBupc=; b=6bBKFRXxjEiCu7kcsw3VMRPN5n xBvNiwuUbparGW7+QR0EnlnbjdfeSvIY7RXmz5ZF1zYydM3MkMiLIAYQLj7wubDb/40GYy9HhrX6N GAj9YPafFbxysI0XV15P7X77QF3HnM+y0QJPIF3DPxeGQIKALSykkYFEcOO500d9fQAA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rfNUS-008yBO-7q; Wed, 28 Feb 2024 18:13:08 +0100 Date: Wed, 28 Feb 2024 18:13:08 +0100 From: Andrew Lunn To: Lukasz Majewski Cc: Oleksij Rempel , Eric Dumazet , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, Tristram.Ha@microchip.com, Sebastian Andrzej Siewior , Paolo Abeni , Ravi Gunasekaran , Simon Horman , Wojciech Drewek , Nikita Zhandarovich , Murali Karicheri , Dan Carpenter , Ziyang Xuan , Kristian Overskeid , Matthieu Baerts , linux-kernel@vger.kernel.org Subject: Re: [RFC] net: hsr: Provide RedBox support Message-ID: <608850a9-966e-420b-8d16-1ab6baa65025@lunn.ch> References: <20240228150735.3647892-1-lukma@denx.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240228150735.3647892-1-lukma@denx.de> > void hsr_debugfs_rename(struct net_device *dev) > { > @@ -95,6 +114,19 @@ void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev) > priv->node_tbl_root = NULL; > return; > } > + > + if (!priv->redbox) > + return; > + > + de = debugfs_create_file("proxy_node_table", S_IFREG | 0444, > + priv->node_tbl_root, priv, > + &hsr_proxy_node_table_fops); > + if (IS_ERR(de)) { > + pr_err("Cannot create hsr proxy node_table file\n"); > + debugfs_remove(priv->node_tbl_root); > + priv->node_tbl_root = NULL; > + return; You should not be checking return values from debugfs and not printing error messages etc. debugfs is totally option, so you should just keep going. The debugfs API should not explode because of a previous failure. > --- a/net/hsr/hsr_device.c > +++ b/net/hsr/hsr_device.c > @@ -142,30 +142,32 @@ static int hsr_dev_open(struct net_device *dev) > { > struct hsr_priv *hsr; > struct hsr_port *port; > - char designation; > + char *designation = NULL; Revere christmas tree place. When you go from RFC to a real submission, issues like this need fixing. For an RFC its not so bad. > hsr = netdev_priv(dev); > - designation = '\0'; > > hsr_for_each_port(hsr, port) { > if (port->type == HSR_PT_MASTER) > continue; > switch (port->type) { > case HSR_PT_SLAVE_A: > - designation = 'A'; > + designation = "Slave A"; > break; > case HSR_PT_SLAVE_B: > - designation = 'B'; > + designation = "Slave B"; > + break; > + case HSR_PT_INTERLINK: > + designation = "Interlink"; > break; > default: > - designation = '?'; > + designation = "Unknown"; > } > if (!is_slave_up(port->dev)) > - netdev_warn(dev, "Slave %c (%s) is not up; please bring it up to get a fully working HSR network\n", > + netdev_warn(dev, "%s (%s) is not up; please bring it up to get a fully working HSR network\n", > designation, port->dev->name); > } > > - if (designation == '\0') > + if (designation == NULL) > netdev_warn(dev, "No slave devices configured\n"); It would be good to split this into multiple patches. Do the A to Slave A, B to Slave B, etc as one patch. Then add Interlink. Ideally you want lots of simple patches which are obviously correct, each with a good commit message explaining why the change is being made. Andrew