All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Daniel Scally <djrscally@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-acpi@vger.kernel.org, netdev@vger.kernel.org,
	Paolo Abeni <pabeni@redhat.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Vladimir Oltean <olteanv@gmail.com>
Subject: Re: [PATCH RFC net-next 3/7] net: dsa: use fwnode_get_phy_mode() to get phy interface mode
Date: Thu, 23 Mar 2023 15:23:12 +0000	[thread overview]
Message-ID: <ZBxu4FvyO2JDwmMq@shell.armlinux.org.uk> (raw)
In-Reply-To: <ZBxpeLOmTMzqVTRV@smile.fi.intel.com>

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!

  reply	other threads:[~2023-03-23 15:23 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 11:59 [PATCH RFC net-next 0/7] Another attempt at moving mv88e6xxx forward Russell King (Oracle)
2023-03-22 11:59 ` [PATCH RFC net-next 1/7] software node: allow named software node to be created Russell King
2023-03-23 13:59   ` Andy Shevchenko
2023-03-23 14:29     ` Russell King (Oracle)
2023-03-23 14:39       ` Andy Shevchenko
2023-03-22 12:00 ` [PATCH RFC net-next 2/7] net: phylink: provide phylink_find_max_speed() Russell King (Oracle)
2023-03-22 18:44   ` Andrew Lunn
2023-03-22 12:00 ` [PATCH RFC net-next 3/7] net: dsa: use fwnode_get_phy_mode() to get phy interface mode Russell King (Oracle)
2023-03-22 18:42   ` Andrew Lunn
2023-03-23 14:03   ` Andy Shevchenko
2023-03-23 14:31     ` Russell King (Oracle)
2023-03-23 14:38       ` Andy Shevchenko
2023-03-23 14:49         ` Russell King (Oracle)
2023-03-23 15:00           ` Andy Shevchenko
2023-03-23 15:23             ` Russell King (Oracle) [this message]
2023-03-23 15:33               ` Andy Shevchenko
2023-03-23 16:29                 ` Russell King (Oracle)
2023-03-23 16:18               ` Russell King (Oracle)
2023-03-23 16:34                 ` Andy Shevchenko
2023-03-23 16:39                   ` Andy Shevchenko
2023-03-23 17:06                   ` Russell King (Oracle)
2023-03-23 17:28                     ` Andy Shevchenko
2023-03-23 17:53             ` Russell King (Oracle)
2023-03-23 18:04               ` Andy Shevchenko
2023-03-23 20:46                 ` Russell King (Oracle)
2023-03-22 12:00 ` [PATCH RFC net-next 4/7] net: dsa: add ability for switch driver to provide a swnode Russell King (Oracle)
2023-03-22 12:00 ` [PATCH RFC net-next 5/7] net: dsa: avoid DT validation for drivers which provide default config Russell King (Oracle)
2023-03-22 18:51   ` Andrew Lunn
2023-03-22 20:09     ` Russell King (Oracle)
2023-03-22 20:14       ` Andrew Lunn
2023-03-22 20:20         ` Russell King (Oracle)
2023-03-22 12:00 ` [PATCH RFC net-next 6/7] net: dsa: mv88e6xxx: provide software node for default settings Russell King (Oracle)
2023-03-22 18:57   ` Andrew Lunn
2023-03-22 20:13     ` Russell King (Oracle)
2023-03-22 20:17       ` Andrew Lunn
2023-03-22 20:22         ` Russell King (Oracle)
2023-03-22 21:40           ` Andrew Lunn
2023-03-23  8:41             ` Russell King (Oracle)
2023-03-23 18:17               ` Andrew Lunn
2023-03-23 18:25                 ` Russell King (Oracle)
2023-03-23 18:34                   ` Andrew Lunn
2023-03-24 14:49   ` Heikki Krogerus
2023-03-24 17:04     ` Russell King (Oracle)
2023-03-27 10:28       ` Heikki Krogerus
2023-03-27 10:55         ` Russell King (Oracle)
2023-03-27 14:13           ` Heikki Krogerus
2023-03-27 14:32             ` Russell King (Oracle)
2023-03-27 15:45               ` Russell King (Oracle)
2023-03-28 12:09                 ` Heikki Krogerus
2023-03-28 13:23                   ` Russell King (Oracle)
2023-03-29 14:07                     ` Heikki Krogerus
2023-03-29 14:33                       ` Russell King (Oracle)
2023-03-30 13:54                         ` Heikki Krogerus
2023-04-03 13:02                           ` Russell King (Oracle)
2023-04-05 17:51                             ` Greg Kroah-Hartman
2023-03-22 12:00 ` [PATCH RFC net-next 7/7] net: dsa: mv88e6xxx: remove handling for DSA and CPU ports Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBxu4FvyO2JDwmMq@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=djrscally@gmail.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.