Thread (11 messages) flat view 11 messages, 5 authors, 2020-07-07

Re: [PATCH net-next v2 3/3] net: ethtool: Remove PHYLIB direct dependency

From: Jakub Kicinski <kuba@kernel.org>
Date: 2020-07-06 18:54:31
Also in: lkml

On Mon, 6 Jul 2020 11:45:38 -0700 Florian Fainelli wrote:
On 7/6/2020 11:40 AM, Jakub Kicinski wrote:
quoted
On Sun,  5 Jul 2020 21:27:58 -0700 Florian Fainelli wrote:  
quoted
+	ops = ethtool_phy_ops;
+	if (!ops || !ops->start_cable_test) {  
nit: don't think member-by-member checking is necessary. We don't
expect there to be any alternative versions of the ops, right?  
There could be, a network device driver not using PHYLIB could register
its own operations and only implement a subset of these operations.
I'd strongly prefer drivers did not insert themselves into
subsys-to-subsys glue :S
quoted
We could even risk a direct call:

#if IS_REACHABLE(CONFIG_PHYLIB)
static inline int do_x()
{
	return __do_x();
}
#else
static inline int do_x()
{
	if (!ops)
		return -EOPNOTSUPP;
	return ops->do_x();
}
#endif

But that's perhaps doing too much...  
Fine either way with me, let us see what Michal and Andrew think about that.
Ack, let's hear it :)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help