From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 945DFC6FD1C for ; Thu, 23 Mar 2023 15:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbjCWPXe (ORCPT ); Thu, 23 Mar 2023 11:23:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232109AbjCWPXe (ORCPT ); Thu, 23 Mar 2023 11:23:34 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C478E1B574; Thu, 23 Mar 2023 08:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q02dgDTZnKhUjHALrPflsrfzjCe90yPs2MlkZua0PAM=; b=qTYFy6CfiPjnMSYYQTt9XWi6BN QYRMb0DlP/471Fujd7JRxlYxBZUbxzKSYQAwzIelpIyKQX9IEVCoQbL5t2e3v3KUDww1Q7Eud0nAJ vkchgqSKoag0TcHsaWfyBg/73W5HLurSCz/D106NlOW9QJpJa0bbqm6yTaA+HaNeYqly3i9XM8Djw tzGObO0U+oiUuuoJFH8B96nQi+H/QP7e2otClRR5YXqgonkAMEHkcefX5LZKW+lA0OzIzJJNi9rKK Duq9nQ2KRqAxzlUUz9R2S7cEr4cA3uceh2xzMDIvCLQIwZYSvPksQHTDmztVg7gPR4GWtn+ZREy7w XO5mhNdg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:37482) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pfMmY-0005MF-LX; Thu, 23 Mar 2023 15:23:16 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pfMmW-0001UO-A7; Thu, 23 Mar 2023 15:23:12 +0000 Date: Thu, 23 Mar 2023 15:23:12 +0000 From: "Russell King (Oracle)" To: Andy Shevchenko Cc: Andrew Lunn , Heiner Kallweit , Daniel Scally , "David S. Miller" , Eric Dumazet , Florian Fainelli , Greg Kroah-Hartman , Heikki Krogerus , Jakub Kicinski , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, Paolo Abeni , "Rafael J. Wysocki" , Sakari Ailus , Vladimir Oltean Subject: Re: [PATCH RFC net-next 3/7] net: dsa: use fwnode_get_phy_mode() to get phy interface mode Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Thu, Mar 23, 2023 at 05:00:08PM +0200, Andy Shevchenko wrote: > On Thu, Mar 23, 2023 at 02:49:01PM +0000, Russell King (Oracle) wrote: > > On Thu, Mar 23, 2023 at 04:38:29PM +0200, Andy Shevchenko wrote: > > > On Thu, Mar 23, 2023 at 02:31:04PM +0000, Russell King (Oracle) wrote: > > > > On Thu, Mar 23, 2023 at 04:03:05PM +0200, Andy Shevchenko wrote: > > > > > On Wed, Mar 22, 2023 at 12:00:06PM +0000, Russell King (Oracle) wrote: > > ... > > > > > > > + struct fwnode_handle *fwnode; > > > > > > > > > > > + fwnode = of_fwnode_handle(dp->dn); > > > > > > > > > > const struct fwnode_handle *fwnode = of_fwnode_handle(dp->dn); > > > > > > > > > > ? > > > > > > > > Why const? > > > > > > Do you modify its content on the fly? > > > > Do you want to litter code with casts to get rid of the const? > > > > > For fwnode as a basic object type we want to reduce the scope of the possible > > > modifications. If you don't modify and APIs you call do not require non-const > > > object, use const for fwnode. > > > > Let's start here. We pass this fwnode to fwnode_get_phy_mode(): > > > > include/linux/property.h:int fwnode_get_phy_mode(struct fwnode_handle *fwnode); > > > > Does fwnode_get_phy_mode() alter the contents of the fwnode? Probably > > not, but it doesn't take a const pointer. Therefore, to declare my > > fwnode as const, I'd need to cast the const-ness away before calling > > this. > > So, fix the fwnode_get_phy_mode(). Is it a problem? No, I refuse. That's for a different patch set. > > Then there's phylink_create(). Same problem. > > So, fix that. Is it a problem? No for the same reason. > > So NAK to this const - until such time that we have a concerted effort > > to making functions we call which do not modify the "fwnode" argument > > constify that argument. Otherwise it's just rediculously crazy to > > declare a variable const only to then litter the code with casts to get > > rid of it at every call site. > > > > Please do a bit of research before making suggestions. Thanks. > > So, MAK to your patch. You can fix that, and you know that. Sorry, I don't accept your NAK. While you have a valid point about these things being const, that is not the fault of this patch series, and is something that should be addressed separately. The lack of const-ness that has been there for quite some time is no reason to NAK a patch that has nothing to do with this. > P.S. Please, move that phy thingy away from property.h, it doesn't belong > there. Again, that's a subject for a separate patch. I will re-post this in due course and ignore your NAK (due to your lack of research, and confrontational nature.) Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!