Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1868063lqa; Tue, 30 Apr 2024 01:17:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6chj3YC586YQyO6iNGzf/1yQd1JUGFt5aBt/sjXY7Ne+D2nvVd4ot/fQGG7qz2KX0It/Amgdgp2/8n51X6tKSbriQMEUsv3NEb8iagQ== X-Google-Smtp-Source: AGHT+IEnLOdX8iNIQAFiBnneT6f9hX2aYhZe0pwqXGdKgGXhkpS5CAt4pdeR4bd7t7QIiSRHoBib X-Received: by 2002:a05:6a21:8909:b0:1ae:42ad:b571 with SMTP id tc9-20020a056a21890900b001ae42adb571mr6888328pzc.24.1714465071200; Tue, 30 Apr 2024 01:17:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714465071; cv=pass; d=google.com; s=arc-20160816; b=sH+Z/GssS0yLLP5gFjIeW5QTQRiivGobbG/MxH340yOVTO5pAeCk9BRgQT2k966cN0 nMWPYGImt3EHDblXAe2wm31zop3suPUuEx7IavycoIN/aPKr4RTxxqcQvtGFA209Z0d4 szXvJhuLomj8+dDR6HQy6MZ2tY7R9kmIXGwvXINjlKBNfVtmh/molGlQ5moHKFXak2oE Iv3xzGdVnJT+AM343gyJltOATqVXwhrpATtr0e86oYzs+dHAFj0JNVtiS5upcGoRRAAj cqnapkSzwoDqQ246HAVSVPIPFhXsmaBEIJI8z0d9laF6bttMyWPFkAI/jxlbqAuo1wEB iHoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=PH0Batl+gs5Yuh+XIezJLPA4axJaz6P5q73VACFrshI=; fh=2InyAcbvz6xdRBDPH2Smfy4Kco4aj2tvysWrq9UP5yw=; b=q3RwroqjWj/hlyiaJu0DAm3ZAUEjSAn0/MD9XODLu4xrwcdFxslB23j5oWnlFLSeL3 8gFgvUuWJV/+I6UOvbxbkF8MdVB1Det4N3k62eu9nomOON6iMONqSWXbUSuvB2mS2xs2 yvNHUH3fDydWcrrl1oRkoNIsGPIJ8vgBAp7lK76+9jHo1UtCiKXnZPR1pl7e29veYmSb MljN7NaVZKBrbegw5Bp5x4DvJ77i67X/4VXmptqs40ESzq4mD9CL85JVKlejKqM1ig97 qEbPU5ZVRUi/04ezS5d8wM/lkA4G3FZME6FPSDHAY0x7hYBsg0EwxkPC5pnjpgQYpO/g QgrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="d/n6GZpT"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163529-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q4-20020a17090311c400b001e89487bdb0si21633808plh.377.2024.04.30.01.17.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 01:17:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163529-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="d/n6GZpT"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163529-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E25CFB2176B for ; Tue, 30 Apr 2024 08:17:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 037F17BAE4; Tue, 30 Apr 2024 08:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d/n6GZpT" Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EC1446551; Tue, 30 Apr 2024 08:17:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714465056; cv=none; b=Czq4oYKUaDGxNnGFwG1I+mmlIiIcPnwPZvhtNAfYiMsefoXk4fq67ur4xnbcLzF+DUBr8eZHWsXzHiTA+aviHXZetwmtoPJNQ8fOoPJw9517L9gOjSoPO7TaQ88UawUuznKHKgVVGH7zPV1aVIwBJ+PvzWBnDCJLJVMnG7ZkCSw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714465056; c=relaxed/simple; bh=YSqyhxPuvbdbj5MmnbzYb3hGGCWtH8HIJtWnxHySCkg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OQzrTNo5h0mv+BdIoDepVaT5aZr7kTeDNBQJM5bZdLYhoRaMxpipz4dCDW5eRRBzlvwkQiuQ2d7agWyIFtgPcR24Eeu+MxSdfeEq/gjq65rSTM4NNTvx0My7am6sZL6U4cysbtSEy68mP5NqPoW45tttbps2uKvs+Xul44Vtbt0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d/n6GZpT; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-34c8f393195so2354780f8f.0; Tue, 30 Apr 2024 01:17:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714465053; x=1715069853; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=PH0Batl+gs5Yuh+XIezJLPA4axJaz6P5q73VACFrshI=; b=d/n6GZpTIwHYPURsBfbEb0lbhsS47/D6Q6HHkaVyPgnMYszwBrC3HuwdRPuFrkJJiX VroUbGAhtTNFW2OpxMgWVm7UwwFdl8433hWdn9TU4PIxwnxDED7pZniFcazi2JgSn3OV 4v4z0NlclQXUqj75IkFEjyYcsepqn981M9f0ARIc3LYS0FqQ0uZ7o+1pD8EsivODNULw B7y/d63dmO9anl+KESWkCgNwqZrgcA1/1ZN64DX8wHLg+rQZ97UBhNz7uKcTQwfm8cg1 A3wR7Hn63E445hoiFRJ0llULHx/c3Jiqk+Bmv1OO+r+49pAVyN9GjNkxtCupOCncl1Uy ZiCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714465053; x=1715069853; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PH0Batl+gs5Yuh+XIezJLPA4axJaz6P5q73VACFrshI=; b=DcCwAs4/8XL+ICF4wrl+xjOjvb+3EqCyOfGcgdRKM8GHHxLkrZoz/nfG8feb0Tlvad mNCviLToCkZcLC/QssOupHXQiFiGzHsEWcfzfvD7y9MwLmL7YpdVEm5seeGfOAQTyJeW hujSTHJpUQ/ljqciG+XWPPpwl4hzWh7pXXHQ3EKfot3zUeQFtgR47rOe3ZycvNtlWQvM K4ODFBdtG/sIYshV/JquT9WmrRyOsjVXjABT0lJ2taHeaKi3S2FgoRYI2G+ucTJDoOdF 9rqquPQIB2wWFKVci9q3ikEM98iY0F1qSFubH3LbsC/8uTN5uQ2jHDlomWTv1tULeBut toGw== X-Forwarded-Encrypted: i=1; AJvYcCXKpu5doVj4I0aDpb7plh9/jDtLTK2di4GXyMdbxMSSHJGOfdqY/smxXd9TqzPw9S+x8/vA6bqY3qcAnmBBuJtKCBettBVHgRKjlOb8 X-Gm-Message-State: AOJu0YxZpdYLO/BWO8RHSNtLWLJyjXoGOD5j1saTKpiZbSPAbZFHr2nt 7HodF2H+QQPjImH4ao5XEpmUQOx3rPGQPzT6xDCI6A4alkthRBY+ X-Received: by 2002:a5d:6b8d:0:b0:34c:5af8:e491 with SMTP id n13-20020a5d6b8d000000b0034c5af8e491mr7941736wrx.33.1714465053081; Tue, 30 Apr 2024 01:17:33 -0700 (PDT) Received: from ?IPV6:2a01:c22:72f1:1900:5c1e:d798:1e97:a293? (dynamic-2a01-0c22-72f1-1900-5c1e-d798-1e97-a293.c22.pool.telefonica.de. [2a01:c22:72f1:1900:5c1e:d798:1e97:a293]) by smtp.googlemail.com with ESMTPSA id m7-20020a5d64a7000000b0034a710b6360sm28685651wrp.6.2024.04.30.01.17.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Apr 2024 01:17:32 -0700 (PDT) Message-ID: <1ed5b8cb-c79b-44b9-8dbe-f78d7505b3b4@gmail.com> Date: Tue, 30 Apr 2024 10:17:31 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next] net: phy: Don't conditionally compile the phy_link_topology creation To: Maxime Chevallier , davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?Q?K=C3=B6ry_Maincent?= , Jesse Brandeburg , =?UTF-8?Q?Marek_Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?Q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart References: <20240429131008.439231-1-maxime.chevallier@bootlin.com> Content-Language: en-US From: Heiner Kallweit Autocrypt: addr=hkallweit1@gmail.com; keydata= xsFNBF/0ZFUBEAC0eZyktSE7ZNO1SFXL6cQ4i4g6Ah3mOUIXSB4pCY5kQ6OLKHh0FlOD5/5/ sY7IoIouzOjyFdFPnz4Bl3927ClT567hUJJ+SNaFEiJ9vadI6vZm2gcY4ExdIevYHWe1msJF MVE4yNwdS+UsPeCF/6CQQTzHc+n7DomE7fjJD5J1hOJjqz2XWe71fTvYXzxCFLwXXbBiqDC9 dNqOe5odPsa4TsWZ09T33g5n2nzTJs4Zw8fCy8rLqix/raVsqr8fw5qM66MVtdmEljFaJ9N8 /W56qGCp+H8Igk/F7CjlbWXiOlKHA25mPTmbVp7VlFsvsmMokr/imQr+0nXtmvYVaKEUwY2g 86IU6RAOuA8E0J5bD/BeyZdM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6pwMPJXLMsI0ii/2k3YPEJPv+yJf90MbYyQSbkTwZhrsokjQEaIfjrIk3 rQRjTve/J62WIO28IbY/mENuGgWehRlTAbhC4BLTZ5uYS0YMQCR7v9UGMWdNWXFyrOB6PjSu Trn9MsPoUc8qI72mVpxEXQDLlrd2ijEWm7Nrf52YMD7hL6rXXuis7R6zY8WnnBhW0uCfhajx q+KuARXC0sDLztcjaS3ayXonpoCPZep2Bd5xqE4Ln8/COCslP7E92W1uf1EcdXXIrx1acg21 H/0Z53okMykVs3a8tECPHIxnre2UxKdTbCEkjkR4V6JyplTS47oWMw3zyI7zkaadfzVFBxk2 lo/Tny+FX1Azea3Ce7oOnRUEZtWSsUidtIjmL8YUQFZYm+JUIgfRmSpMFq8JP4VH43GXpB/S OCrl+/xujzvoUBFV/cHKjEQYBxo+MaiQa1U54ykM2W4DnHb1UiEf5xDkFd4= In-Reply-To: <20240429131008.439231-1-maxime.chevallier@bootlin.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 29.04.2024 15:10, Maxime Chevallier wrote: > The core of the phy_link_topology isn't directly tied to phylib, and at > the moment it's initialized, phylib might not be loaded yet. Move the > initialization of the topology to the phy_link_topology_core header, > which contains the bare minimum so that we can initialize it at netdev > creation. > The change fixes the issue for me, but according to my personal taste the code isn't intuitive and still error-prone. Also there's no good reason to inline a function like phy_link_topo_create() and make it publicly available. Do you expect it to be ever used outside net core? In general it may make sense to add a config symbol for the topology extension, there seem to be very few, specialized use cases for it. > Signed-off-by: Maxime Chevallier > Closes: https://lore.kernel.org/netdev/2e11b89d-100f-49e7-9c9a-834cc0b82f97@gmail.com/ > Closes: https://lore.kernel.org/netdev/20240409201553.GA4124869@dev-arch.thelio-3990X/ > --- > drivers/net/phy/phy_link_topology.c | 23 -------------------- > include/linux/phy_link_topology.h | 5 ----- > include/linux/phy_link_topology_core.h | 30 +++++++++++++++++--------- > 3 files changed, 20 insertions(+), 38 deletions(-) > > diff --git a/drivers/net/phy/phy_link_topology.c b/drivers/net/phy/phy_link_topology.c > index 985941c5c558..960aedd73308 100644 > --- a/drivers/net/phy/phy_link_topology.c > +++ b/drivers/net/phy/phy_link_topology.c > @@ -12,29 +12,6 @@ > #include > #include > > -struct phy_link_topology *phy_link_topo_create(struct net_device *dev) > -{ > - struct phy_link_topology *topo; > - > - topo = kzalloc(sizeof(*topo), GFP_KERNEL); > - if (!topo) > - return ERR_PTR(-ENOMEM); > - > - xa_init_flags(&topo->phys, XA_FLAGS_ALLOC1); > - topo->next_phy_index = 1; > - > - return topo; > -} > - > -void phy_link_topo_destroy(struct phy_link_topology *topo) > -{ > - if (!topo) > - return; > - > - xa_destroy(&topo->phys); > - kfree(topo); > -} > - > int phy_link_topo_add_phy(struct phy_link_topology *topo, > struct phy_device *phy, > enum phy_upstream upt, void *upstream) > diff --git a/include/linux/phy_link_topology.h b/include/linux/phy_link_topology.h > index 6b79feb607e7..ad72d7881257 100644 > --- a/include/linux/phy_link_topology.h > +++ b/include/linux/phy_link_topology.h > @@ -32,11 +32,6 @@ struct phy_device_node { > struct phy_device *phy; > }; > > -struct phy_link_topology { > - struct xarray phys; > - u32 next_phy_index; > -}; > - > static inline struct phy_device * > phy_link_topo_get_phy(struct phy_link_topology *topo, u32 phyindex) > { > diff --git a/include/linux/phy_link_topology_core.h b/include/linux/phy_link_topology_core.h > index 0a6479055745..0116ec49cd1b 100644 > --- a/include/linux/phy_link_topology_core.h > +++ b/include/linux/phy_link_topology_core.h > @@ -2,24 +2,34 @@ > #ifndef __PHY_LINK_TOPOLOGY_CORE_H > #define __PHY_LINK_TOPOLOGY_CORE_H > > -struct phy_link_topology; > +#include > > -#if IS_REACHABLE(CONFIG_PHYLIB) > - > -struct phy_link_topology *phy_link_topo_create(struct net_device *dev); > -void phy_link_topo_destroy(struct phy_link_topology *topo); > - > -#else > +struct phy_link_topology { > + struct xarray phys; > + u32 next_phy_index; > +}; > > static inline struct phy_link_topology *phy_link_topo_create(struct net_device *dev) > { > - return NULL; > + struct phy_link_topology *topo; > + > + topo = kzalloc(sizeof(*topo), GFP_KERNEL); > + if (!topo) > + return ERR_PTR(-ENOMEM); > + > + xa_init_flags(&topo->phys, XA_FLAGS_ALLOC1); > + topo->next_phy_index = 1; > + > + return topo; > } > > static inline void phy_link_topo_destroy(struct phy_link_topology *topo) > { > -} > + if (!topo) > + return; > > -#endif > + xa_destroy(&topo->phys); > + kfree(topo); > +} > > #endif /* __PHY_LINK_TOPOLOGY_CORE_H */