From nobody Thu Nov 14 04:44:16 2024 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 A86627E59E; Sat, 17 Feb 2024 19:41:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198900; cv=none; b=RrcopweXG0scvL83hf5XJ5BycrdGXd2q24xugC+nBmuWn3/Ot9F3dXIDQQXgGVzaw9dc+bLokS39WI/yao/xW4PnnSUDPhdOIRdqrIoq2odIWC3ol0FVR/BVIpnrlyIRgA4npN5z6Ww/ASbNR9ylgzqYxFsfYLl75vuwAKIEwZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198900; c=relaxed/simple; bh=GxrCgNiuseMm6ZnabLCX2TWr815rQNSl+Kt+kibMH2k=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MCDNcHMdChCaQtrvBF8d+w98KBbYF7TOx1PgiEjKyhZGUdUGDgjTPiuEzxB99kwrpa/Ar0/iRMGFpyK3txvT5kSD5YtlMOC7Mfhbb60DrgxK0P+V52+RgLt5BbsRBPqzaeGeN3fToP1eA+2T/zHuyocQWMS310S506ulseSvWBg= 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=kudhV7Y6; arc=none smtp.client-ip=209.85.221.43 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kudhV7Y6" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-33d153254b7so1242348f8f.0; Sat, 17 Feb 2024 11:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708198892; x=1708803692; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=kiP+1vOsL9ZENAgwFxyDI6lf6XbrCUud7RXafPoEdX0=; b=kudhV7Y6Sd1LTi28tZyvBr0RV6er71jbro6mBALww+BniNV23am9aDXQapJZrBclr4 ImUaI8LQ0Ikk2wA9FMoJlp1g/QiO8MFkQR7lp0qz2cjhuo/x6A7I/rqi1wrE2T7wpgi0 VF+gDaGllgMYshdV7+8MBDhbBB5U5O1oh/lpcM3BRkWvQE66KX3EnSaIOpf6RGYKYyA+ fv6h1u79Bn1h1z04jKpk6F72hr0RQbMFbvixChSmPGoQgHIWJMMyC0EdEzcrokCMByOA U+wF/FZsXy+mwZlFrsVzXVtFDqQpIwpRBttMI5qik1XyTMVnKnMWO+srWm1Dq1bex6Jx 0d9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708198892; x=1708803692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kiP+1vOsL9ZENAgwFxyDI6lf6XbrCUud7RXafPoEdX0=; b=ruzT+lYnCxFEYL0l3N6e4fAWGbduUe0OXbMmc8r70anuavuesulO9+zvd6m/SGNS58 09v2xk7wgdke4N+tNwMF+QbCjfMjxQ18t5vI/bNzwrlKCM0vJdzfRm9WRdSHsnQG5Efm wo8E0tTD+8s3Y69SyO8AwJaHzuW74786G8fGZ666B40gW8jr4jqJ9cZRrqjYc2LE/bGs 6MM6cLVrB+YXmGJpNiPtCEyiR4TzZDOSRDeOYB4V5U0eI+WM8QmDllxE5+K0XfUbi/h0 3aapzSryNuVVJznzlbYwI2AL5ft1yyxvqev2JwEcjAy9RHzGrWnaDYA8qWqRPXIlPZRm hqkQ== X-Forwarded-Encrypted: i=1; AJvYcCXOx02R+6t16b89gdm3A++4cRZ3jBudtd2jT9DqBlm+1kt/Q/JYpVAAq/MXfsRQ8c3bvrbSKnIOVMUUh8XfDuEggTuErMoyyYsRpiMpDtdiPY8jM6MkMmOuAtA4RpwodokWbyAAd5sBsRRynCYE5gUTrcMrPKTCkd0hrnsTTVt74TMwK2WwB14d4GrZSqSl1u4YguFS5870NFN6y2DqCw9LbO5+ X-Gm-Message-State: AOJu0YznzbQWEiNzDxpm3t6upV0/IhzR+vBVDjjBBR/rCvpI8tprQ+z6 qsbyJRocGUhKDN2rBrkvhqt6MxYYH9JFFY4Mht7ERk09rRX+pRwQ X-Google-Smtp-Source: AGHT+IHgTR1dEUhAmK9F7NgOvv3iDlbM1cCjX5vlVyKQPy9ZEXmOmYE9oKd5miiMN4VUYffmm9GY4w== X-Received: by 2002:a5d:62cc:0:b0:33d:3ad2:67ae with SMTP id o12-20020a5d62cc000000b0033d3ad267aemr413527wrv.57.1708198891493; Sat, 17 Feb 2024 11:41:31 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id b10-20020a5d40ca000000b0033ceca3a3dbsm5661169wrq.2.2024.02.17.11.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 11:41:30 -0800 (PST) From: Christian Marangi To: Michael Hennerich , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Richard Cochran , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Daniel Golle , Qingfang Deng , SkyLake Huang , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Arun Ramadoss , UNGLinuxDriver@microchip.com, Peter Geis , Frank , Xu Liang , Piergiorgio Beruto , Andrei Botila , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Michal Simek , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Vladimir Oltean , David Epping , Harini Katakam , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, rust-for-linux@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 1/3] net: phy: detach PHY driver OPs from phy_driver struct Date: Sat, 17 Feb 2024 20:41:12 +0100 Message-ID: <20240217194116.8565-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240217194116.8565-1-ansuelsmth@gmail.com> References: <20240217194116.8565-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Detach PHY driver OPs from phy_driver struct. This permits a strict separation between const OPs and PHY model/family specific values/flags. Many if not all PHYs driver currently have duplicated OPs for different PHY model/family where PHY_ID matching/mask can't be used. This limitation cause the side-effect of having to duplicate the PHY OPs for each PHY ID causing useless bloat/wasted space. To solve this problem, deatch PHY driver OPs from phy_driver so they can be declared statically and just be referenced by pointer. Each PHY driver is updated to this new phy_driver structure by simply declaring the OPs in a locally define struct inside phy_driver to reduce patch delta. Signed-off-by: Christian Marangi --- drivers/net/phy/adin.c | 4 ++ drivers/net/phy/adin1100.c | 2 + drivers/net/phy/amd.c | 4 ++ drivers/net/phy/aquantia/aquantia_main.c | 26 ++++++++ drivers/net/phy/ax88796b.c | 6 ++ drivers/net/phy/bcm-cygnus.c | 4 ++ drivers/net/phy/bcm54140.c | 2 + drivers/net/phy/bcm63xx.c | 4 ++ drivers/net/phy/bcm7xxx.c | 8 +++ drivers/net/phy/bcm84881.c | 2 + drivers/net/phy/bcm87xx.c | 4 ++ drivers/net/phy/broadcom.c | 42 ++++++++++++ drivers/net/phy/cicada.c | 4 ++ drivers/net/phy/cortina.c | 2 + drivers/net/phy/davicom.c | 8 +++ drivers/net/phy/dp83640.c | 2 + drivers/net/phy/dp83822.c | 8 ++- drivers/net/phy/dp83848.c | 2 + drivers/net/phy/dp83867.c | 2 + drivers/net/phy/dp83869.c | 2 + drivers/net/phy/dp83tc811.c | 2 + drivers/net/phy/dp83td510.c | 2 + drivers/net/phy/dp83tg720.c | 2 + drivers/net/phy/et1011c.c | 2 + drivers/net/phy/icplus.c | 8 +++ drivers/net/phy/intel-xway.c | 20 ++++++ drivers/net/phy/lxt.c | 8 +++ drivers/net/phy/marvell-88q2xxx.c | 2 + drivers/net/phy/marvell-88x2222.c | 2 + drivers/net/phy/marvell.c | 44 +++++++++++- drivers/net/phy/marvell10g.c | 16 +++-- drivers/net/phy/mediatek-ge-soc.c | 4 ++ drivers/net/phy/mediatek-ge.c | 4 ++ drivers/net/phy/meson-gxl.c | 4 ++ drivers/net/phy/micrel.c | 54 ++++++++++++--- drivers/net/phy/microchip.c | 2 + drivers/net/phy/microchip_t1.c | 4 ++ drivers/net/phy/microchip_t1s.c | 4 ++ drivers/net/phy/motorcomm.c | 8 +++ drivers/net/phy/mscc/mscc_main.c | 30 +++++++++ drivers/net/phy/mxl-gpy.c | 24 +++++++ drivers/net/phy/national.c | 2 + drivers/net/phy/ncn26000.c | 2 + drivers/net/phy/nxp-c45-tja11xx.c | 8 ++- drivers/net/phy/nxp-cbtx.c | 2 + drivers/net/phy/nxp-tja11xx.c | 16 +++-- drivers/net/phy/phy-c45.c | 2 + drivers/net/phy/phy-core.c | 18 ++--- drivers/net/phy/phy.c | 85 ++++++++++++------------ drivers/net/phy/phy_device.c | 79 +++++++++++----------- drivers/net/phy/qcom/at803x.c | 18 ++++- drivers/net/phy/qcom/qca807x.c | 4 ++ drivers/net/phy/qcom/qca808x.c | 2 + drivers/net/phy/qcom/qca83xx.c | 12 +++- drivers/net/phy/qsemi.c | 2 + drivers/net/phy/realtek.c | 46 ++++++++++++- drivers/net/phy/rockchip.c | 2 + drivers/net/phy/smsc.c | 14 ++++ drivers/net/phy/ste10Xp.c | 4 ++ drivers/net/phy/teranetics.c | 2 + drivers/net/phy/uPD60620.c | 2 + drivers/net/phy/vitesse.c | 22 ++++++ drivers/net/phy/xilinx_gmii2rgmii.c | 16 +++-- include/linux/phy.h | 57 +++++++++------- 64 files changed, 654 insertions(+), 147 deletions(-) diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c index 2e1a46e121d9..469fba4eb500 100644 --- a/drivers/net/phy/adin.c +++ b/drivers/net/phy/adin.c @@ -994,6 +994,7 @@ static struct phy_driver adin_driver[] =3D { PHY_ID_MATCH_MODEL(PHY_ID_ADIN1200), .name =3D "ADIN1200", .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D adin_probe, .config_init =3D adin_config_init, .soft_reset =3D adin_soft_reset, @@ -1012,11 +1013,13 @@ static struct phy_driver adin_driver[] =3D { .write_mmd =3D adin_write_mmd, .cable_test_start =3D adin_cable_test_start, .cable_test_get_status =3D adin_cable_test_get_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_ADIN1300), .name =3D "ADIN1300", .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D adin_probe, .config_init =3D adin_config_init, .soft_reset =3D adin_soft_reset, @@ -1035,6 +1038,7 @@ static struct phy_driver adin_driver[] =3D { .write_mmd =3D adin_write_mmd, .cable_test_start =3D adin_cable_test_start, .cable_test_get_status =3D adin_cable_test_get_status, + }, }, }; =20 diff --git a/drivers/net/phy/adin1100.c b/drivers/net/phy/adin1100.c index 85f910e2d4fb..0e85f177d4d8 100644 --- a/drivers/net/phy/adin1100.c +++ b/drivers/net/phy/adin1100.c @@ -323,6 +323,7 @@ static struct phy_driver adin_driver[] =3D { .phy_id =3D PHY_ID_ADIN1100, .phy_id_mask =3D 0xffffffcf, .name =3D "ADIN1100", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D adin_get_features, .soft_reset =3D adin_soft_reset, .probe =3D adin_probe, @@ -335,6 +336,7 @@ static struct phy_driver adin_driver[] =3D { .resume =3D adin_resume, .get_sqi =3D adin_get_sqi, .get_sqi_max =3D adin_get_sqi_max, + }, }, }; =20 diff --git a/drivers/net/phy/amd.c b/drivers/net/phy/amd.c index 930b15fa6ce9..7bf5031a8021 100644 --- a/drivers/net/phy/amd.c +++ b/drivers/net/phy/amd.c @@ -94,18 +94,22 @@ static struct phy_driver am79c_drivers[] =3D { .name =3D "AM79C874", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D am79c_config_init, .config_intr =3D am79c_config_intr, .handle_interrupt =3D am79c_handle_interrupt, + }, }, { .phy_id =3D PHY_ID_AC101L, .name =3D "AC101L", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D am79c_config_init, .config_intr =3D am79c_config_intr, .handle_interrupt =3D am79c_handle_interrupt, + }, }, }; =20 diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aqu= antia/aquantia_main.c index a6a7980585f5..2166370ccc82 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -772,40 +772,49 @@ static struct phy_driver aqr_driver[] =3D { { PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), .name =3D "Aquantia AQ1202", + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, .read_status =3D aqr_read_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQ2104), .name =3D "Aquantia AQ2104", + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, .read_status =3D aqr_read_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR105), .name =3D "Aquantia AQR105", + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, .read_status =3D aqr_read_status, .suspend =3D aqr107_suspend, .resume =3D aqr107_resume, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR106), .name =3D "Aquantia AQR106", + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, .read_status =3D aqr_read_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR107), .name =3D "Aquantia AQR107", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, .config_init =3D aqr107_config_init, @@ -821,10 +830,12 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), .name =3D "Aquantia AQCS109", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, .config_init =3D aqcs109_config_init, @@ -840,10 +851,12 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR111), .name =3D "Aquantia AQR111", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, .config_init =3D aqr111_config_init, @@ -859,10 +872,12 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0), .name =3D "Aquantia AQR111B0", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, .config_init =3D aqr111_config_init, @@ -878,18 +893,22 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR405), .name =3D "Aquantia AQR405", + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, .read_status =3D aqr_read_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR112), .name =3D "Aquantia AQR112", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, @@ -904,10 +923,12 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name =3D "Aquantia AQR412", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, @@ -922,10 +943,12 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113), .name =3D "Aquantia AQR113", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, .config_init =3D aqr113c_config_init, @@ -941,10 +964,12 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), .name =3D "Aquantia AQR113C", + .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, .config_init =3D aqr113c_config_init, @@ -960,6 +985,7 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, + }, }, }; =20 diff --git a/drivers/net/phy/ax88796b.c b/drivers/net/phy/ax88796b.c index eb74a8cf8df1..a89ffa5231c8 100644 --- a/drivers/net/phy/ax88796b.c +++ b/drivers/net/phy/ax88796b.c @@ -99,24 +99,30 @@ static struct phy_driver asix_driver[] =3D { PHY_ID_MATCH_EXACT(PHY_ID_ASIX_AX88772A), .name =3D "Asix Electronics AX88772A", .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .read_status =3D asix_ax88772a_read_status, .suspend =3D genphy_suspend, .resume =3D genphy_resume, .soft_reset =3D asix_soft_reset, .link_change_notify =3D asix_ax88772a_link_change_notify, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_ASIX_AX88772C), .name =3D "Asix Electronics AX88772C", .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .suspend =3D genphy_suspend, .resume =3D genphy_resume, .soft_reset =3D asix_soft_reset, + }, }, { .phy_id =3D PHY_ID_ASIX_AX88796B, .name =3D "Asix Electronics AX88796B", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D asix_soft_reset, + }, } }; =20 module_phy_driver(asix_driver); diff --git a/drivers/net/phy/bcm-cygnus.c b/drivers/net/phy/bcm-cygnus.c index da8f7cb41b44..0ba02757e578 100644 --- a/drivers/net/phy/bcm-cygnus.c +++ b/drivers/net/phy/bcm-cygnus.c @@ -255,17 +255,20 @@ static struct phy_driver bcm_cygnus_phy_driver[] =3D { .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom Cygnus PHY", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D bcm_cygnus_config_init, .config_intr =3D bcm_phy_config_intr, .handle_interrupt =3D bcm_phy_handle_interrupt, .suspend =3D genphy_suspend, .resume =3D bcm_cygnus_resume, + }, }, { .phy_id =3D PHY_ID_BCM_OMEGA, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom Omega Combo GPHY", /* PHY_GBIT_FEATURES */ .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D bcm_omega_config_init, .suspend =3D genphy_suspend, .resume =3D bcm_omega_resume, @@ -275,6 +278,7 @@ static struct phy_driver bcm_cygnus_phy_driver[] =3D { .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm_omega_get_phy_stats, .probe =3D bcm_omega_probe, + }, } }; =20 diff --git a/drivers/net/phy/bcm54140.c b/drivers/net/phy/bcm54140.c index 2eea3d09b1e6..62961334a4f2 100644 --- a/drivers/net/phy/bcm54140.c +++ b/drivers/net/phy/bcm54140.c @@ -868,6 +868,7 @@ static struct phy_driver bcm54140_drivers[] =3D { .name =3D "Broadcom BCM54140", .flags =3D PHY_POLL_CABLE_TEST, .features =3D PHY_GBIT_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D bcm54140_config_init, .handle_interrupt =3D bcm54140_handle_interrupt, .config_intr =3D bcm54140_config_intr, @@ -879,6 +880,7 @@ static struct phy_driver bcm54140_drivers[] =3D { .set_tunable =3D bcm54140_set_tunable, .cable_test_start =3D bcm_phy_cable_test_start_rdb, .cable_test_get_status =3D bcm_phy_cable_test_get_status_rdb, + }, }, }; module_phy_driver(bcm54140_drivers); diff --git a/drivers/net/phy/bcm63xx.c b/drivers/net/phy/bcm63xx.c index 0eb33be824f1..76bcde45c65b 100644 --- a/drivers/net/phy/bcm63xx.c +++ b/drivers/net/phy/bcm63xx.c @@ -76,9 +76,11 @@ static struct phy_driver bcm63xx_driver[] =3D { .name =3D "Broadcom BCM63XX (1)", /* PHY_BASIC_FEATURES */ .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D bcm63xx_config_init, .config_intr =3D bcm63xx_config_intr, .handle_interrupt =3D bcm_phy_handle_interrupt, + }, }, { /* same phy as above, with just a different OUI */ .phy_id =3D 0x002bdc00, @@ -86,9 +88,11 @@ static struct phy_driver bcm63xx_driver[] =3D { .name =3D "Broadcom BCM63XX (2)", /* PHY_BASIC_FEATURES */ .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D bcm63xx_config_init, .config_intr =3D bcm63xx_config_intr, .handle_interrupt =3D bcm_phy_handle_interrupt, + }, } }; =20 module_phy_driver(bcm63xx_driver); diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c index 97638ba7ae85..c820a94b30a4 100644 --- a/drivers/net/phy/bcm7xxx.c +++ b/drivers/net/phy/bcm7xxx.c @@ -847,6 +847,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name =3D _name, \ /* PHY_GBIT_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ + .ops =3D &(const struct phy_driver_ops){ \ .config_init =3D bcm7xxx_28nm_config_init, \ .resume =3D bcm7xxx_28nm_resume, \ .get_tunable =3D bcm7xxx_28nm_get_tunable, \ @@ -855,6 +856,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .get_strings =3D bcm_phy_get_strings, \ .get_stats =3D bcm7xxx_28nm_get_phy_stats, \ .probe =3D bcm7xxx_28nm_probe, \ + }, \ } =20 #define BCM7XXX_28NM_EPHY(_oui, _name) \ @@ -864,6 +866,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name =3D _name, \ /* PHY_BASIC_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ + .ops =3D &(const struct phy_driver_ops){ \ .config_init =3D bcm7xxx_28nm_ephy_config_init, \ .resume =3D bcm7xxx_28nm_ephy_resume, \ .get_sset_count =3D bcm_phy_get_sset_count, \ @@ -872,6 +875,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .probe =3D bcm7xxx_28nm_probe, \ .read_mmd =3D bcm7xxx_28nm_ephy_read_mmd, \ .write_mmd =3D bcm7xxx_28nm_ephy_write_mmd, \ + }, \ } =20 #define BCM7XXX_40NM_EPHY(_oui, _name) \ @@ -881,10 +885,12 @@ static int bcm7xxx_28nm_probe(struct phy_device *phyd= ev) .name =3D _name, \ /* PHY_BASIC_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ + .ops =3D &(const struct phy_driver_ops){ \ .soft_reset =3D genphy_soft_reset, \ .config_init =3D bcm7xxx_config_init, \ .suspend =3D bcm7xxx_suspend, \ .resume =3D bcm7xxx_config_init, \ + }, \ } =20 #define BCM7XXX_16NM_EPHY(_oui, _name) \ @@ -894,6 +900,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name =3D _name, \ /* PHY_BASIC_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ + .ops =3D &(const struct phy_driver_ops){ \ .get_sset_count =3D bcm_phy_get_sset_count, \ .get_strings =3D bcm_phy_get_strings, \ .get_stats =3D bcm7xxx_28nm_get_phy_stats, \ @@ -902,6 +909,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .config_aneg =3D genphy_config_aneg, \ .read_status =3D genphy_read_status, \ .resume =3D bcm7xxx_16nm_ephy_resume, \ + }, \ } =20 static struct phy_driver bcm7xxx_driver[] =3D { diff --git a/drivers/net/phy/bcm84881.c b/drivers/net/phy/bcm84881.c index f1d47c264058..12ced2b60519 100644 --- a/drivers/net/phy/bcm84881.c +++ b/drivers/net/phy/bcm84881.c @@ -240,12 +240,14 @@ static struct phy_driver bcm84881_drivers[] =3D { .phy_id =3D 0xae025150, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM84881", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D bcm84881_config_init, .probe =3D bcm84881_probe, .get_features =3D bcm84881_get_features, .config_aneg =3D bcm84881_config_aneg, .aneg_done =3D bcm84881_aneg_done, .read_status =3D bcm84881_read_status, + }, }, }; =20 diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c index e81404bf8994..d2f837c93d79 100644 --- a/drivers/net/phy/bcm87xx.c +++ b/drivers/net/phy/bcm87xx.c @@ -200,6 +200,7 @@ static struct phy_driver bcm87xx_driver[] =3D { .phy_id =3D PHY_ID_BCM8706, .phy_id_mask =3D 0xffffffff, .name =3D "Broadcom BCM8706", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D bcm87xx_get_features, .config_init =3D bcm87xx_config_init, .config_aneg =3D bcm87xx_config_aneg, @@ -207,10 +208,12 @@ static struct phy_driver bcm87xx_driver[] =3D { .config_intr =3D bcm87xx_config_intr, .handle_interrupt =3D bcm87xx_handle_interrupt, .match_phy_device =3D bcm8706_match_phy_device, + }, }, { .phy_id =3D PHY_ID_BCM8727, .phy_id_mask =3D 0xffffffff, .name =3D "Broadcom BCM8727", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D bcm87xx_get_features, .config_init =3D bcm87xx_config_init, .config_aneg =3D bcm87xx_config_aneg, @@ -218,6 +221,7 @@ static struct phy_driver bcm87xx_driver[] =3D { .config_intr =3D bcm87xx_config_intr, .handle_interrupt =3D bcm87xx_handle_interrupt, .match_phy_device =3D bcm8727_match_phy_device, + }, } }; =20 module_phy_driver(bcm87xx_driver); diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 370e4ed45098..48f4949d7f29 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -1068,6 +1068,7 @@ static struct phy_driver broadcom_drivers[] =3D { .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5411", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1076,11 +1077,13 @@ static struct phy_driver broadcom_drivers[] =3D { .config_intr =3D bcm_phy_config_intr, .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, + }, }, { .phy_id =3D PHY_ID_BCM5421, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5421", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1089,12 +1092,14 @@ static struct phy_driver broadcom_drivers[] =3D { .config_intr =3D bcm_phy_config_intr, .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, + }, }, { .phy_id =3D PHY_ID_BCM54210E, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM54210E", /* PHY_GBIT_FEATURES */ .flags =3D PHY_ALWAYS_CALL_SUSPEND, + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1108,11 +1113,13 @@ static struct phy_driver broadcom_drivers[] =3D { .get_wol =3D bcm54xx_phy_get_wol, .set_wol =3D bcm54xx_phy_set_wol, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM5461, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5461", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1122,11 +1129,13 @@ static struct phy_driver broadcom_drivers[] =3D { .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM54612E, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM54612E", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1138,11 +1147,13 @@ static struct phy_driver broadcom_drivers[] =3D { .led_brightness_set =3D bcm_phy_led_brightness_set, .suspend =3D bcm54xx_suspend, .resume =3D bcm54xx_resume, + }, }, { .phy_id =3D PHY_ID_BCM54616S, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM54616S", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D genphy_soft_reset, .config_init =3D bcm54xx_config_init, .config_aneg =3D bcm54616s_config_aneg, @@ -1152,11 +1163,13 @@ static struct phy_driver broadcom_drivers[] =3D { .probe =3D bcm54616s_probe, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM5464, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5464", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1168,11 +1181,13 @@ static struct phy_driver broadcom_drivers[] =3D { .resume =3D genphy_resume, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM5481, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5481", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1183,11 +1198,13 @@ static struct phy_driver broadcom_drivers[] =3D { .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM54810, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM54810", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1202,11 +1219,13 @@ static struct phy_driver broadcom_drivers[] =3D { .resume =3D bcm54xx_resume, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM54811, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM54811", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1219,11 +1238,13 @@ static struct phy_driver broadcom_drivers[] =3D { .resume =3D bcm54xx_resume, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM5482, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5482", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1233,11 +1254,13 @@ static struct phy_driver broadcom_drivers[] =3D { .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM50610, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM50610", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1249,11 +1272,13 @@ static struct phy_driver broadcom_drivers[] =3D { .suspend =3D bcm54xx_suspend, .resume =3D bcm54xx_resume, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM50610M, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM50610M", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1265,11 +1290,13 @@ static struct phy_driver broadcom_drivers[] =3D { .suspend =3D bcm54xx_suspend, .resume =3D bcm54xx_resume, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM57780, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM57780", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1279,31 +1306,37 @@ static struct phy_driver broadcom_drivers[] =3D { .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCMAC131, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCMAC131", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D brcm_fet_config_init, .config_intr =3D brcm_fet_config_intr, .handle_interrupt =3D brcm_fet_handle_interrupt, .suspend =3D brcm_fet_suspend, .resume =3D brcm_fet_config_init, + }, }, { .phy_id =3D PHY_ID_BCM5241, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5241", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D brcm_fet_config_init, .config_intr =3D brcm_fet_config_intr, .handle_interrupt =3D brcm_fet_handle_interrupt, .suspend =3D brcm_fet_suspend, .resume =3D brcm_fet_config_init, + }, }, { .phy_id =3D PHY_ID_BCM5221, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5221", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D brcm_fet_config_init, .config_intr =3D brcm_fet_config_intr, .handle_interrupt =3D brcm_fet_handle_interrupt, @@ -1311,24 +1344,28 @@ static struct phy_driver broadcom_drivers[] =3D { .resume =3D brcm_fet_config_init, .config_aneg =3D bcm5221_config_aneg, .read_status =3D bcm5221_read_status, + }, }, { .phy_id =3D PHY_ID_BCM5395, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM5395", .flags =3D PHY_IS_INTERNAL, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, .probe =3D bcm54xx_phy_probe, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM53125, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM53125", .flags =3D PHY_IS_INTERNAL, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1338,12 +1375,14 @@ static struct phy_driver broadcom_drivers[] =3D { .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM53128, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM53128", .flags =3D PHY_IS_INTERNAL, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1353,11 +1392,13 @@ static struct phy_driver broadcom_drivers[] =3D { .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, .led_brightness_set =3D bcm_phy_led_brightness_set, + }, }, { .phy_id =3D PHY_ID_BCM89610, .phy_id_mask =3D 0xfffffff0, .name =3D "Broadcom BCM89610", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .get_sset_count =3D bcm_phy_get_sset_count, .get_strings =3D bcm_phy_get_strings, .get_stats =3D bcm54xx_get_stats, @@ -1366,6 +1407,7 @@ static struct phy_driver broadcom_drivers[] =3D { .config_intr =3D bcm_phy_config_intr, .handle_interrupt =3D bcm_phy_handle_interrupt, .link_change_notify =3D bcm54xx_link_change_notify, + }, } }; =20 module_phy_driver(broadcom_drivers); diff --git a/drivers/net/phy/cicada.c b/drivers/net/phy/cicada.c index ef5f412e101f..77269c11d305 100644 --- a/drivers/net/phy/cicada.c +++ b/drivers/net/phy/cicada.c @@ -130,17 +130,21 @@ static struct phy_driver cis820x_driver[] =3D { .name =3D "Cicada Cis8201", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &cis820x_config_init, .config_intr =3D &cis820x_config_intr, .handle_interrupt =3D &cis820x_handle_interrupt, + }, }, { .phy_id =3D 0x000fc440, .name =3D "Cicada Cis8204", .phy_id_mask =3D 0x000fffc0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &cis820x_config_init, .config_intr =3D &cis820x_config_intr, .handle_interrupt =3D &cis820x_handle_interrupt, + }, } }; =20 module_phy_driver(cis820x_driver); diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c index 40514a94e6ff..8e76865533fa 100644 --- a/drivers/net/phy/cortina.c +++ b/drivers/net/phy/cortina.c @@ -79,9 +79,11 @@ static struct phy_driver cortina_driver[] =3D { .phy_id_mask =3D 0xffffffff, .name =3D "Cortina CS4340", .features =3D PHY_10GBIT_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D gen10g_config_aneg, .read_status =3D cortina_read_status, .probe =3D cortina_probe, + }, }, }; =20 diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index 4ac4bce1bf32..874ef7c947e3 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c @@ -176,35 +176,43 @@ static struct phy_driver dm91xx_driver[] =3D { .name =3D "Davicom DM9161E", .phy_id_mask =3D 0x0ffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D dm9161_config_init, .config_aneg =3D dm9161_config_aneg, .config_intr =3D dm9161_config_intr, .handle_interrupt =3D dm9161_handle_interrupt, + }, }, { .phy_id =3D 0x0181b8b0, .name =3D "Davicom DM9161B/C", .phy_id_mask =3D 0x0ffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D dm9161_config_init, .config_aneg =3D dm9161_config_aneg, .config_intr =3D dm9161_config_intr, .handle_interrupt =3D dm9161_handle_interrupt, + }, }, { .phy_id =3D 0x0181b8a0, .name =3D "Davicom DM9161A", .phy_id_mask =3D 0x0ffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D dm9161_config_init, .config_aneg =3D dm9161_config_aneg, .config_intr =3D dm9161_config_intr, .handle_interrupt =3D dm9161_handle_interrupt, + }, }, { .phy_id =3D 0x00181b80, .name =3D "Davicom DM9131", .phy_id_mask =3D 0x0ffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_intr =3D dm9161_config_intr, .handle_interrupt =3D dm9161_handle_interrupt, + }, } }; =20 module_phy_driver(dm91xx_driver); diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 5c42c47dc564..3c601608d713 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -1520,12 +1520,14 @@ static struct phy_driver dp83640_driver =3D { .phy_id_mask =3D 0xfffffff0, .name =3D "NatSemi DP83640", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D dp83640_probe, .remove =3D dp83640_remove, .soft_reset =3D dp83640_soft_reset, .config_init =3D dp83640_config_init, .config_intr =3D dp83640_config_intr, .handle_interrupt =3D dp83640_handle_interrupt, + }, }; =20 static int __init dp83640_init(void) diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c index 30f2616ab1c2..7e12c89586c2 100644 --- a/drivers/net/phy/dp83822.c +++ b/drivers/net/phy/dp83822.c @@ -544,7 +544,7 @@ static int dp83822_phy_reset(struct phy_device *phydev) if (err < 0) return err; =20 - return phydev->drv->config_init(phydev); + return phydev->drv->ops->config_init(phydev); } =20 #ifdef CONFIG_OF_MDIO @@ -704,6 +704,7 @@ static int dp83822_resume(struct phy_device *phydev) PHY_ID_MATCH_MODEL(_id), \ .name =3D (_name), \ /* PHY_BASIC_FEATURES */ \ + .ops =3D &(const struct phy_driver_ops){\ .probe =3D dp83822_probe, \ .soft_reset =3D dp83822_phy_reset, \ .config_init =3D dp83822_config_init, \ @@ -714,6 +715,7 @@ static int dp83822_resume(struct phy_device *phydev) .handle_interrupt =3D dp83822_handle_interrupt, \ .suspend =3D dp83822_suspend, \ .resume =3D dp83822_resume, \ + }, \ } =20 #define DP83826_PHY_DRIVER(_id, _name) \ @@ -721,6 +723,7 @@ static int dp83822_resume(struct phy_device *phydev) PHY_ID_MATCH_MODEL(_id), \ .name =3D (_name), \ /* PHY_BASIC_FEATURES */ \ + .ops =3D &(const struct phy_driver_ops){\ .probe =3D dp83826_probe, \ .soft_reset =3D dp83822_phy_reset, \ .config_init =3D dp83826_config_init, \ @@ -730,6 +733,7 @@ static int dp83822_resume(struct phy_device *phydev) .handle_interrupt =3D dp83822_handle_interrupt, \ .suspend =3D dp83822_suspend, \ .resume =3D dp83822_resume, \ + }, \ } =20 #define DP8382X_PHY_DRIVER(_id, _name) \ @@ -737,6 +741,7 @@ static int dp83822_resume(struct phy_device *phydev) PHY_ID_MATCH_MODEL(_id), \ .name =3D (_name), \ /* PHY_BASIC_FEATURES */ \ + .ops =3D &(const struct phy_driver_ops){\ .soft_reset =3D dp83822_phy_reset, \ .config_init =3D dp8382x_config_init, \ .get_wol =3D dp83822_get_wol, \ @@ -745,6 +750,7 @@ static int dp83822_resume(struct phy_device *phydev) .handle_interrupt =3D dp83822_handle_interrupt, \ .suspend =3D dp83822_suspend, \ .resume =3D dp83822_resume, \ + }, \ } =20 static struct phy_driver dp83822_driver[] =3D { diff --git a/drivers/net/phy/dp83848.c b/drivers/net/phy/dp83848.c index 937061acfc61..2d21614eab5e 100644 --- a/drivers/net/phy/dp83848.c +++ b/drivers/net/phy/dp83848.c @@ -139,6 +139,7 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl); .name =3D _name, \ /* PHY_BASIC_FEATURES */ \ \ + .ops =3D &(const struct phy_driver_ops){\ .soft_reset =3D genphy_soft_reset, \ .config_init =3D _config_init, \ .suspend =3D genphy_suspend, \ @@ -147,6 +148,7 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl); /* IRQ related */ \ .config_intr =3D dp83848_config_intr, \ .handle_interrupt =3D dp83848_handle_interrupt, \ + }, \ } =20 static struct phy_driver dp83848_driver[] =3D { diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 4120385c5a79..efd0bf47ee8d 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -1180,6 +1180,7 @@ static struct phy_driver dp83867_driver[] =3D { .name =3D "TI DP83867", /* PHY_GBIT_FEATURES */ =20 + .ops =3D &(const struct phy_driver_ops){ .probe =3D dp83867_probe, .config_init =3D dp83867_config_init, .soft_reset =3D dp83867_phy_reset, @@ -1206,6 +1207,7 @@ static struct phy_driver dp83867_driver[] =3D { .led_hw_control_set =3D dp83867_led_hw_control_set, .led_hw_control_get =3D dp83867_led_hw_control_get, .led_polarity_set =3D dp83867_led_polarity_set, + }, }, }; module_phy_driver(dp83867_driver); diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index fa8c6fdcf301..f9313483333d 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -893,6 +893,7 @@ static int dp83869_phy_reset(struct phy_device *phydev) { \ PHY_ID_MATCH_MODEL(_id), \ .name =3D (_name), \ + .ops =3D &(const struct phy_driver_ops){ \ .probe =3D dp83869_probe, \ .config_init =3D dp83869_config_init, \ .soft_reset =3D dp83869_phy_reset, \ @@ -905,6 +906,7 @@ static int dp83869_phy_reset(struct phy_device *phydev) .set_wol =3D dp83869_set_wol, \ .suspend =3D genphy_suspend, \ .resume =3D genphy_resume, \ + }, \ } =20 static struct phy_driver dp83869_driver[] =3D { diff --git a/drivers/net/phy/dp83tc811.c b/drivers/net/phy/dp83tc811.c index 7ea32fb77190..20ea42f1b753 100644 --- a/drivers/net/phy/dp83tc811.c +++ b/drivers/net/phy/dp83tc811.c @@ -390,6 +390,7 @@ static struct phy_driver dp83811_driver[] =3D { .phy_id_mask =3D 0xfffffff0, .name =3D "TI DP83TC811", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D dp83811_config_init, .config_aneg =3D dp83811_config_aneg, .soft_reset =3D dp83811_phy_reset, @@ -399,6 +400,7 @@ static struct phy_driver dp83811_driver[] =3D { .handle_interrupt =3D dp83811_handle_interrupt, .suspend =3D dp83811_suspend, .resume =3D dp83811_resume, + }, }, }; module_phy_driver(dp83811_driver); diff --git a/drivers/net/phy/dp83td510.c b/drivers/net/phy/dp83td510.c index d7616b13c594..354800718d66 100644 --- a/drivers/net/phy/dp83td510.c +++ b/drivers/net/phy/dp83td510.c @@ -221,6 +221,7 @@ static struct phy_driver dp83td510_driver[] =3D { PHY_ID_MATCH_MODEL(DP83TD510E_PHY_ID), .name =3D "TI DP83TD510E", =20 + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D dp83td510_config_aneg, .read_status =3D dp83td510_read_status, .get_features =3D dp83td510_get_features, @@ -231,6 +232,7 @@ static struct phy_driver dp83td510_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, } }; module_phy_driver(dp83td510_driver); =20 diff --git a/drivers/net/phy/dp83tg720.c b/drivers/net/phy/dp83tg720.c index 326c9770a6dc..216db7a8945e 100644 --- a/drivers/net/phy/dp83tg720.c +++ b/drivers/net/phy/dp83tg720.c @@ -165,6 +165,7 @@ static struct phy_driver dp83tg720_driver[] =3D { PHY_ID_MATCH_MODEL(DP83TG720S_PHY_ID), .name =3D "TI DP83TG720S", =20 + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D dp83tg720_config_aneg, .read_status =3D dp83tg720_read_status, .get_features =3D genphy_c45_pma_read_ext_abilities, @@ -174,6 +175,7 @@ static struct phy_driver dp83tg720_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, } }; module_phy_driver(dp83tg720_driver); =20 diff --git a/drivers/net/phy/et1011c.c b/drivers/net/phy/et1011c.c index be1b71d7cab7..9b570f6c1f3c 100644 --- a/drivers/net/phy/et1011c.c +++ b/drivers/net/phy/et1011c.c @@ -88,8 +88,10 @@ static struct phy_driver et1011c_driver[] =3D { { .name =3D "ET1011C", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D et1011c_config_aneg, .read_status =3D et1011c_read_status, + }, } }; =20 module_phy_driver(et1011c_driver); diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index a00a667454a9..37611df4705f 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c @@ -576,21 +576,26 @@ static struct phy_driver icplus_driver[] =3D { PHY_ID_MATCH_MODEL(IP175C_PHY_ID), .name =3D "ICPlus IP175C", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D ip175c_config_init, .config_aneg =3D ip175c_config_aneg, .read_status =3D ip175c_read_status, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { PHY_ID_MATCH_MODEL(IP1001_PHY_ID), .name =3D "ICPlus IP1001", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D ip1001_config_init, .soft_reset =3D genphy_soft_reset, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .name =3D "ICPlus IP101A", + .ops =3D &(const struct phy_driver_ops){ .match_phy_device =3D ip101a_match_phy_device, .probe =3D ip101a_g_probe, .read_page =3D ip101a_read_page, @@ -603,8 +608,10 @@ static struct phy_driver icplus_driver[] =3D { .soft_reset =3D genphy_soft_reset, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .name =3D "ICPlus IP101G", + .ops =3D &(const struct phy_driver_ops){ .match_phy_device =3D ip101g_match_phy_device, .probe =3D ip101a_g_probe, .read_page =3D ip101g_read_page, @@ -620,6 +627,7 @@ static struct phy_driver icplus_driver[] =3D { .get_stats =3D ip101g_get_stats, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, } }; =20 module_phy_driver(icplus_driver); diff --git a/drivers/net/phy/intel-xway.c b/drivers/net/phy/intel-xway.c index 3c032868ef04..ce22d89e92ec 100644 --- a/drivers/net/phy/intel-xway.c +++ b/drivers/net/phy/intel-xway.c @@ -353,105 +353,125 @@ static struct phy_driver xway_gphy[] =3D { .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.3", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .config_aneg =3D xway_gphy14_config_aneg, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY22F_1_3, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY22F (PEF 7061) v1.3", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .config_aneg =3D xway_gphy14_config_aneg, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY11G_1_4, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.4", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .config_aneg =3D xway_gphy14_config_aneg, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY22F_1_4, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY22F (PEF 7061) v1.4", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .config_aneg =3D xway_gphy14_config_aneg, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY11G_1_5, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.5 / v1.6", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY22F_1_5, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY11G_VR9_1_1, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY11G (xRX v1.1 integrated)", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY22F_VR9_1_1, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY22F (xRX v1.1 integrated)", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY11G_VR9_1_2, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY11G (xRX v1.2 integrated)", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_PHY22F_VR9_1_2, .phy_id_mask =3D 0xffffffff, .name =3D "Intel XWAY PHY22F (xRX v1.2 integrated)", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D xway_gphy_config_init, .handle_interrupt =3D xway_gphy_handle_interrupt, .config_intr =3D xway_gphy_config_intr, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, }; module_phy_driver(xway_gphy); diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index e3bf827b7959..b0bcb1b1bc4c 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c @@ -311,39 +311,47 @@ static struct phy_driver lxt97x_driver[] =3D { .name =3D "LXT970", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D lxt970_config_init, .config_intr =3D lxt970_config_intr, .handle_interrupt =3D lxt970_handle_interrupt, + }, }, { .phy_id =3D 0x001378e0, .name =3D "LXT971", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_intr =3D lxt971_config_intr, .handle_interrupt =3D lxt971_handle_interrupt, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D 0x00137a10, .name =3D "LXT973-A2", .phy_id_mask =3D 0xffffffff, /* PHY_BASIC_FEATURES */ .flags =3D 0, + .ops =3D &(const struct phy_driver_ops){ .probe =3D lxt973_probe, .config_aneg =3D lxt973_config_aneg, .read_status =3D lxt973a2_read_status, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D 0x00137a10, .name =3D "LXT973", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ .flags =3D 0, + .ops =3D &(const struct phy_driver_ops){ .probe =3D lxt973_probe, .config_aneg =3D lxt973_config_aneg, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, } }; =20 module_phy_driver(lxt97x_driver); diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88= q2xxx.c index 1c3ff77de56b..6ff13060cd2e 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -240,6 +240,7 @@ static struct phy_driver mv88q2xxx_driver[] =3D { .phy_id =3D MARVELL_PHY_ID_88Q2110, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "mv88q2110", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D mv88q2xxx_get_features, .config_aneg =3D mv88q2xxx_config_aneg, .config_init =3D mv88q2xxx_config_init, @@ -248,6 +249,7 @@ static struct phy_driver mv88q2xxx_driver[] =3D { .set_loopback =3D genphy_c45_loopback, .get_sqi =3D mv88q2xxxx_get_sqi, .get_sqi_max =3D mv88q2xxxx_get_sqi_max, + }, }, }; =20 diff --git a/drivers/net/phy/marvell-88x2222.c b/drivers/net/phy/marvell-88= x2222.c index e3aa30dad2e6..9de149fca07e 100644 --- a/drivers/net/phy/marvell-88x2222.c +++ b/drivers/net/phy/marvell-88x2222.c @@ -600,6 +600,7 @@ static struct phy_driver mv2222_drivers[] =3D { .phy_id =3D MARVELL_PHY_ID_88X2222, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88X2222", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D mv2222_get_features, .soft_reset =3D mv2222_soft_reset, .config_init =3D mv2222_config_init, @@ -609,6 +610,7 @@ static struct phy_driver mv2222_drivers[] =3D { .suspend =3D mv2222_suspend, .resume =3D mv2222_resume, .read_status =3D mv2222_read_status, + }, }, }; module_phy_driver(mv2222_drivers); diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 1faa22f58366..033c10c82c6a 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -3273,6 +3273,7 @@ static struct phy_driver marvell_drivers[] =3D { .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1101", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D marvell_config_init, .config_aneg =3D m88e1101_config_aneg, @@ -3285,12 +3286,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_sset_count =3D marvell_get_sset_count, .get_strings =3D marvell_get_strings, .get_stats =3D marvell_get_stats, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1112, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1112", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1112_config_init, .config_aneg =3D marvell_config_aneg, @@ -3305,12 +3308,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1011_get_tunable, .set_tunable =3D m88e1011_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1111, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1111", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1111gbe_config_init, .config_aneg =3D m88e1111_config_aneg, @@ -3326,12 +3331,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1111_get_tunable, .set_tunable =3D m88e1111_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1111_FINISAR, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1111 (Finisar)", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1111gbe_config_init, .config_aneg =3D m88e1111_config_aneg, @@ -3347,12 +3354,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1111_get_tunable, .set_tunable =3D m88e1111_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1118, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1118", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1118_config_init, .config_aneg =3D m88e1118_config_aneg, @@ -3365,6 +3374,7 @@ static struct phy_driver marvell_drivers[] =3D { .get_sset_count =3D marvell_get_sset_count, .get_strings =3D marvell_get_strings, .get_stats =3D marvell_get_stats, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1121R, @@ -3372,6 +3382,7 @@ static struct phy_driver marvell_drivers[] =3D { .name =3D "Marvell 88E1121R", .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e1121_hwmon_ops), /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D marvell_1011gbe_config_init, .config_aneg =3D m88e1121_config_aneg, @@ -3387,12 +3398,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1011_get_tunable, .set_tunable =3D m88e1011_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1318S, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1318S", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1318_config_init, .config_aneg =3D m88e1318_config_aneg, @@ -3413,12 +3426,14 @@ static struct phy_driver marvell_drivers[] =3D { .led_hw_is_supported =3D m88e1318_led_hw_is_supported, .led_hw_control_set =3D m88e1318_led_hw_control_set, .led_hw_control_get =3D m88e1318_led_hw_control_get, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1145, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1145", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1145_config_init, .config_aneg =3D m88e1101_config_aneg, @@ -3433,12 +3448,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1111_get_tunable, .set_tunable =3D m88e1111_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1149R, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1149R", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1149_config_init, .config_aneg =3D m88e1118_config_aneg, @@ -3451,12 +3468,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_sset_count =3D marvell_get_sset_count, .get_strings =3D marvell_get_strings, .get_stats =3D marvell_get_stats, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1240, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1240", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1112_config_init, .config_aneg =3D marvell_config_aneg, @@ -3471,12 +3490,14 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1011_get_tunable, .set_tunable =3D m88e1011_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1116R, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1116R", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e1116r_config_init, .config_intr =3D marvell_config_intr, @@ -3490,6 +3511,7 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1011_get_tunable, .set_tunable =3D m88e1011_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1510, @@ -3498,6 +3520,7 @@ static struct phy_driver marvell_drivers[] =3D { .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), .features =3D PHY_GBIT_FIBRE_FEATURES, .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D m88e1510_probe, .config_init =3D m88e1510_config_init, .config_aneg =3D m88e1510_config_aneg, @@ -3524,6 +3547,7 @@ static struct phy_driver marvell_drivers[] =3D { .led_hw_is_supported =3D m88e1318_led_hw_is_supported, .led_hw_control_set =3D m88e1318_led_hw_control_set, .led_hw_control_get =3D m88e1318_led_hw_control_get, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1540, @@ -3532,6 +3556,7 @@ static struct phy_driver marvell_drivers[] =3D { .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), /* PHY_GBIT_FEATURES */ .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D marvell_1011gbe_config_init, .config_aneg =3D m88e1510_config_aneg, @@ -3555,15 +3580,17 @@ static struct phy_driver marvell_drivers[] =3D { .led_hw_is_supported =3D m88e1318_led_hw_is_supported, .led_hw_control_set =3D m88e1318_led_hw_control_set, .led_hw_control_get =3D m88e1318_led_hw_control_get, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1545, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1545", .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), - .probe =3D marvell_probe, /* PHY_GBIT_FEATURES */ .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ + .probe =3D marvell_probe, .config_init =3D marvell_1011gbe_config_init, .config_aneg =3D m88e1510_config_aneg, .read_status =3D marvell_read_status, @@ -3586,12 +3613,14 @@ static struct phy_driver marvell_drivers[] =3D { .led_hw_is_supported =3D m88e1318_led_hw_is_supported, .led_hw_control_set =3D m88e1318_led_hw_control_set, .led_hw_control_get =3D m88e1318_led_hw_control_get, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E3016, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E3016", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D m88e3016_config_init, .aneg_done =3D marvell_aneg_done, @@ -3605,6 +3634,7 @@ static struct phy_driver marvell_drivers[] =3D { .get_sset_count =3D marvell_get_sset_count, .get_strings =3D marvell_get_strings, .get_stats =3D marvell_get_stats, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E6341_FAMILY, @@ -3613,6 +3643,7 @@ static struct phy_driver marvell_drivers[] =3D { .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), /* PHY_GBIT_FEATURES */ .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D marvell_1011gbe_config_init, .config_aneg =3D m88e6390_config_aneg, @@ -3631,6 +3662,7 @@ static struct phy_driver marvell_drivers[] =3D { .cable_test_start =3D marvell_vct7_cable_test_start, .cable_test_tdr_start =3D marvell_vct5_cable_test_tdr_start, .cable_test_get_status =3D marvell_vct7_cable_test_get_status, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E6390_FAMILY, @@ -3639,6 +3671,7 @@ static struct phy_driver marvell_drivers[] =3D { .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e6390_hwmon_ops), /* PHY_GBIT_FEATURES */ .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D marvell_1011gbe_config_init, .config_aneg =3D m88e6390_config_aneg, @@ -3657,6 +3690,7 @@ static struct phy_driver marvell_drivers[] =3D { .cable_test_start =3D marvell_vct7_cable_test_start, .cable_test_tdr_start =3D marvell_vct5_cable_test_tdr_start, .cable_test_get_status =3D marvell_vct7_cable_test_get_status, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E6393_FAMILY, @@ -3665,6 +3699,7 @@ static struct phy_driver marvell_drivers[] =3D { .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e6393_hwmon_ops), /* PHY_GBIT_FEATURES */ .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, .config_init =3D marvell_1011gbe_config_init, .config_aneg =3D m88e1510_config_aneg, @@ -3683,12 +3718,14 @@ static struct phy_driver marvell_drivers[] =3D { .cable_test_start =3D marvell_vct7_cable_test_start, .cable_test_tdr_start =3D marvell_vct5_cable_test_tdr_start, .cable_test_get_status =3D marvell_vct7_cable_test_get_status, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1340S, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1340S", .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), + .ops =3D &(const struct phy_driver_ops){ .probe =3D marvell_probe, /* PHY_GBIT_FEATURES */ .config_init =3D marvell_1011gbe_config_init, @@ -3705,14 +3742,16 @@ static struct phy_driver marvell_drivers[] =3D { .get_stats =3D marvell_get_stats, .get_tunable =3D m88e1540_get_tunable, .set_tunable =3D m88e1540_set_tunable, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E1548P, .phy_id_mask =3D MARVELL_PHY_ID_MASK, .name =3D "Marvell 88E1548P", .driver_data =3D DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), - .probe =3D marvell_probe, .features =3D PHY_GBIT_FIBRE_FEATURES, + .ops =3D &(const struct phy_driver_ops){ + .probe =3D marvell_probe, .config_init =3D marvell_1011gbe_config_init, .config_aneg =3D m88e1510_config_aneg, .read_status =3D marvell_read_status, @@ -3732,6 +3771,7 @@ static struct phy_driver marvell_drivers[] =3D { .led_hw_is_supported =3D m88e1318_led_hw_is_supported, .led_hw_control_set =3D m88e1318_led_hw_control_set, .led_hw_control_get =3D m88e1318_led_hw_control_get, + }, }, }; =20 diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index ad43e280930c..9681c0083ca4 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -1403,9 +1403,10 @@ static struct phy_driver mv3310_drivers[] =3D { { .phy_id =3D MARVELL_PHY_ID_88X3310, .phy_id_mask =3D MARVELL_PHY_ID_MASK, - .match_phy_device =3D mv3310_match_phy_device, .name =3D "mv88x3310", .driver_data =3D &mv3310_type, + .ops =3D &(const struct phy_driver_ops){ + .match_phy_device =3D mv3310_match_phy_device, .get_features =3D mv3310_get_features, .config_init =3D mv3310_config_init, .probe =3D mv3310_probe, @@ -1420,13 +1421,15 @@ static struct phy_driver mv3310_drivers[] =3D { .set_loopback =3D genphy_c45_loopback, .get_wol =3D mv3110_get_wol, .set_wol =3D mv3110_set_wol, + }, }, { .phy_id =3D MARVELL_PHY_ID_88X3310, .phy_id_mask =3D MARVELL_PHY_ID_MASK, - .match_phy_device =3D mv3340_match_phy_device, .name =3D "mv88x3340", .driver_data =3D &mv3340_type, + .ops =3D &(const struct phy_driver_ops){ + .match_phy_device =3D mv3340_match_phy_device, .get_features =3D mv3310_get_features, .config_init =3D mv3310_config_init, .probe =3D mv3310_probe, @@ -1439,13 +1442,15 @@ static struct phy_driver mv3310_drivers[] =3D { .set_tunable =3D mv3310_set_tunable, .remove =3D mv3310_remove, .set_loopback =3D genphy_c45_loopback, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E2110, .phy_id_mask =3D MARVELL_PHY_ID_MASK, - .match_phy_device =3D mv2110_match_phy_device, .name =3D "mv88e2110", .driver_data =3D &mv2110_type, + .ops =3D &(const struct phy_driver_ops){ + .match_phy_device =3D mv2110_match_phy_device, .probe =3D mv3310_probe, .suspend =3D mv3310_suspend, .resume =3D mv3310_resume, @@ -1459,13 +1464,15 @@ static struct phy_driver mv3310_drivers[] =3D { .set_loopback =3D genphy_c45_loopback, .get_wol =3D mv3110_get_wol, .set_wol =3D mv3110_set_wol, + }, }, { .phy_id =3D MARVELL_PHY_ID_88E2110, .phy_id_mask =3D MARVELL_PHY_ID_MASK, - .match_phy_device =3D mv2111_match_phy_device, .name =3D "mv88e2111", .driver_data =3D &mv2111_type, + .ops =3D &(const struct phy_driver_ops){ + .match_phy_device =3D mv2111_match_phy_device, .probe =3D mv3310_probe, .suspend =3D mv3310_suspend, .resume =3D mv3310_resume, @@ -1477,6 +1484,7 @@ static struct phy_driver mv3310_drivers[] =3D { .set_tunable =3D mv3310_set_tunable, .remove =3D mv3310_remove, .set_loopback =3D genphy_c45_loopback, + }, }, }; =20 diff --git a/drivers/net/phy/mediatek-ge-soc.c b/drivers/net/phy/mediatek-g= e-soc.c index 0f3a1538a8b8..f24dc1e37ea1 100644 --- a/drivers/net/phy/mediatek-ge-soc.c +++ b/drivers/net/phy/mediatek-ge-soc.c @@ -1497,6 +1497,7 @@ static struct phy_driver mtk_socphy_driver[] =3D { { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), .name =3D "MediaTek MT7981 PHY", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D mt798x_phy_config_init, .config_intr =3D genphy_no_config_intr, .handle_interrupt =3D genphy_handle_interrupt_no_ack, @@ -1510,10 +1511,12 @@ static struct phy_driver mtk_socphy_driver[] =3D { .led_hw_is_supported =3D mt798x_phy_led_hw_is_supported, .led_hw_control_set =3D mt798x_phy_led_hw_control_set, .led_hw_control_get =3D mt798x_phy_led_hw_control_get, + }, }, { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988), .name =3D "MediaTek MT7988 PHY", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D mt798x_phy_config_init, .config_intr =3D genphy_no_config_intr, .handle_interrupt =3D genphy_handle_interrupt_no_ack, @@ -1527,6 +1530,7 @@ static struct phy_driver mtk_socphy_driver[] =3D { .led_hw_is_supported =3D mt798x_phy_led_hw_is_supported, .led_hw_control_set =3D mt798x_phy_led_hw_control_set, .led_hw_control_get =3D mt798x_phy_led_hw_control_get, + }, }, }; =20 diff --git a/drivers/net/phy/mediatek-ge.c b/drivers/net/phy/mediatek-ge.c index a493ae01b267..9ac1d02b0b96 100644 --- a/drivers/net/phy/mediatek-ge.c +++ b/drivers/net/phy/mediatek-ge.c @@ -72,6 +72,7 @@ static struct phy_driver mtk_gephy_driver[] =3D { { PHY_ID_MATCH_EXACT(0x03a29412), .name =3D "MediaTek MT7530 PHY", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D mt7530_phy_config_init, /* Interrupts are handled by the switch, not the PHY * itself. @@ -82,10 +83,12 @@ static struct phy_driver mtk_gephy_driver[] =3D { .resume =3D genphy_resume, .read_page =3D mtk_gephy_read_page, .write_page =3D mtk_gephy_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x03a29441), .name =3D "MediaTek MT7531 PHY", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D mt7531_phy_config_init, /* Interrupts are handled by the switch, not the PHY * itself. @@ -96,6 +99,7 @@ static struct phy_driver mtk_gephy_driver[] =3D { .resume =3D genphy_resume, .read_page =3D mtk_gephy_read_page, .write_page =3D mtk_gephy_write_page, + }, }, }; =20 diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index bb9b33b6bce2..6e839ea7c74b 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c @@ -190,6 +190,7 @@ static struct phy_driver meson_gxl_phy[] =3D { .name =3D "Meson GXL Internal PHY", /* PHY_BASIC_FEATURES */ .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D genphy_soft_reset, .config_init =3D meson_gxl_config_init, .read_status =3D meson_gxl_read_status, @@ -199,11 +200,13 @@ static struct phy_driver meson_gxl_phy[] =3D { .resume =3D genphy_resume, .read_mmd =3D genphy_read_mmd_unsupported, .write_mmd =3D genphy_write_mmd_unsupported, + }, }, { PHY_ID_MATCH_EXACT(0x01803301), .name =3D "Meson G12A Internal PHY", /* PHY_BASIC_FEATURES */ .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .probe =3D smsc_phy_probe, .config_init =3D smsc_phy_config_init, .soft_reset =3D genphy_soft_reset, @@ -218,6 +221,7 @@ static struct phy_driver meson_gxl_phy[] =3D { .resume =3D genphy_resume, .read_mmd =3D genphy_read_mmd_unsupported, .write_mmd =3D genphy_write_mmd_unsupported, + }, }, }; =20 diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 9b6973581989..4ae508e87040 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1502,8 +1502,8 @@ static int ksz9031_read_status(struct phy_device *phy= dev) if ((regval & 0xFF) =3D=3D 0xFF) { phy_init_hw(phydev); phydev->link =3D 0; - if (phydev->drv->config_intr && phy_interrupt_is_valid(phydev)) - phydev->drv->config_intr(phydev); + if (phydev->drv->ops->config_intr && phy_interrupt_is_valid(phydev)) + phydev->drv->ops->config_intr(phydev); return genphy_config_aneg(phydev); } =20 @@ -1940,8 +1940,8 @@ static int kszphy_suspend(struct phy_device *phydev) /* Disable PHY Interrupts */ if (phy_interrupt_is_valid(phydev)) { phydev->interrupts =3D PHY_INTERRUPT_DISABLED; - if (phydev->drv->config_intr) - phydev->drv->config_intr(phydev); + if (phydev->drv->ops->config_intr) + phydev->drv->ops->config_intr(phydev); } =20 return genphy_suspend(phydev); @@ -1990,8 +1990,8 @@ static int kszphy_resume(struct phy_device *phydev) /* Enable PHY Interrupts */ if (phy_interrupt_is_valid(phydev)) { phydev->interrupts =3D PHY_INTERRUPT_ENABLED; - if (phydev->drv->config_intr) - phydev->drv->config_intr(phydev); + if (phydev->drv->ops->config_intr) + phydev->drv->ops->config_intr(phydev); } =20 return 0; @@ -4633,18 +4633,21 @@ static struct phy_driver ksphy_driver[] =3D { .name =3D "Micrel KS8737", /* PHY_BASIC_FEATURES */ .driver_data =3D &ks8737_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D kszphy_config_init, .config_intr =3D kszphy_config_intr, .handle_interrupt =3D kszphy_handle_interrupt, .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ8021, .phy_id_mask =3D 0x00ffffff, .name =3D "Micrel KSZ8021 or KSZ8031", /* PHY_BASIC_FEATURES */ .driver_data =3D &ksz8021_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D kszphy_config_init, .config_intr =3D kszphy_config_intr, @@ -4654,12 +4657,14 @@ static struct phy_driver ksphy_driver[] =3D { .get_stats =3D kszphy_get_stats, .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ8031, .phy_id_mask =3D 0x00ffffff, .name =3D "Micrel KSZ8031", /* PHY_BASIC_FEATURES */ .driver_data =3D &ksz8021_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D kszphy_config_init, .config_intr =3D kszphy_config_intr, @@ -4669,12 +4674,14 @@ static struct phy_driver ksphy_driver[] =3D { .get_stats =3D kszphy_get_stats, .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ8041, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Micrel KSZ8041", /* PHY_BASIC_FEATURES */ .driver_data =3D &ksz8041_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D ksz8041_config_init, .config_aneg =3D ksz8041_config_aneg, @@ -4686,12 +4693,14 @@ static struct phy_driver ksphy_driver[] =3D { /* No suspend/resume callbacks because of errata DS80000700A, * receiver error following software power down. */ + }, }, { .phy_id =3D PHY_ID_KSZ8041RNLI, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Micrel KSZ8041RNLI", /* PHY_BASIC_FEATURES */ .driver_data =3D &ksz8041_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D kszphy_config_init, .config_intr =3D kszphy_config_intr, @@ -4701,10 +4710,12 @@ static struct phy_driver ksphy_driver[] =3D { .get_stats =3D kszphy_get_stats, .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, + }, }, { .name =3D "Micrel KSZ8051", /* PHY_BASIC_FEATURES */ .driver_data =3D &ksz8051_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D kszphy_config_init, .config_intr =3D kszphy_config_intr, @@ -4715,12 +4726,14 @@ static struct phy_driver ksphy_driver[] =3D { .match_phy_device =3D ksz8051_match_phy_device, .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ8001, .name =3D "Micrel KSZ8001 or KS8721", .phy_id_mask =3D 0x00fffffc, /* PHY_BASIC_FEATURES */ .driver_data =3D &ksz8041_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D kszphy_config_init, .config_intr =3D kszphy_config_intr, @@ -4730,6 +4743,7 @@ static struct phy_driver ksphy_driver[] =3D { .get_stats =3D kszphy_get_stats, .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ8081, .name =3D "Micrel KSZ8081 or KSZ8091", @@ -4737,6 +4751,7 @@ static struct phy_driver ksphy_driver[] =3D { .flags =3D PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ .driver_data =3D &ksz8081_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D ksz8081_config_init, .soft_reset =3D genphy_soft_reset, @@ -4751,23 +4766,27 @@ static struct phy_driver ksphy_driver[] =3D { .resume =3D kszphy_resume, .cable_test_start =3D ksz886x_cable_test_start, .cable_test_get_status =3D ksz886x_cable_test_get_status, + }, }, { .phy_id =3D PHY_ID_KSZ8061, .name =3D "Micrel KSZ8061", .phy_id_mask =3D MICREL_PHY_ID_MASK, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .config_init =3D ksz8061_config_init, .config_intr =3D kszphy_config_intr, .handle_interrupt =3D kszphy_handle_interrupt, .suspend =3D kszphy_suspend, .resume =3D kszphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ9021, .phy_id_mask =3D 0x000ffffe, .name =3D "Micrel KSZ9021 Gigabit PHY", /* PHY_GBIT_FEATURES */ .driver_data =3D &ksz9021_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .get_features =3D ksz9031_get_features, .config_init =3D ksz9021_config_init, @@ -4780,12 +4799,14 @@ static struct phy_driver ksphy_driver[] =3D { .resume =3D kszphy_resume, .read_mmd =3D genphy_read_mmd_unsupported, .write_mmd =3D genphy_write_mmd_unsupported, + }, }, { .phy_id =3D PHY_ID_KSZ9031, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Micrel KSZ9031 Gigabit PHY", .flags =3D PHY_POLL_CABLE_TEST, .driver_data =3D &ksz9021_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .get_features =3D ksz9031_get_features, .config_init =3D ksz9031_config_init, @@ -4800,13 +4821,15 @@ static struct phy_driver ksphy_driver[] =3D { .resume =3D kszphy_resume, .cable_test_start =3D ksz9x31_cable_test_start, .cable_test_get_status =3D ksz9x31_cable_test_get_status, + }, }, { .phy_id =3D PHY_ID_LAN8814, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Microchip INDY Gigabit Quad PHY", .flags =3D PHY_POLL_CABLE_TEST, - .config_init =3D lan8814_config_init, .driver_data =3D &lan8814_type, + .ops =3D &(const struct phy_driver_ops){ + .config_init =3D lan8814_config_init, .probe =3D lan8814_probe, .soft_reset =3D genphy_soft_reset, .read_status =3D ksz9031_read_status, @@ -4819,12 +4842,14 @@ static struct phy_driver ksphy_driver[] =3D { .handle_interrupt =3D lan8814_handle_interrupt, .cable_test_start =3D lan8814_cable_test_start, .cable_test_get_status =3D ksz886x_cable_test_get_status, + }, }, { .phy_id =3D PHY_ID_LAN8804, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Microchip LAN966X Gigabit PHY", - .config_init =3D lan8804_config_init, .driver_data =3D &ksz9021_type, + .ops =3D &(const struct phy_driver_ops){ + .config_init =3D lan8804_config_init, .probe =3D kszphy_probe, .soft_reset =3D genphy_soft_reset, .read_status =3D ksz9031_read_status, @@ -4835,12 +4860,14 @@ static struct phy_driver ksphy_driver[] =3D { .resume =3D kszphy_resume, .config_intr =3D lan8804_config_intr, .handle_interrupt =3D lan8804_handle_interrupt, + }, }, { .phy_id =3D PHY_ID_LAN8841, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Microchip LAN8841 Gigabit PHY", .flags =3D PHY_POLL_CABLE_TEST, .driver_data =3D &lan8841_type, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D lan8841_config_init, .probe =3D lan8841_probe, .soft_reset =3D genphy_soft_reset, @@ -4853,6 +4880,7 @@ static struct phy_driver ksphy_driver[] =3D { .resume =3D genphy_resume, .cable_test_start =3D lan8814_cable_test_start, .cable_test_get_status =3D ksz886x_cable_test_get_status, + }, }, { .phy_id =3D PHY_ID_KSZ9131, .phy_id_mask =3D MICREL_PHY_ID_MASK, @@ -4860,6 +4888,7 @@ static struct phy_driver ksphy_driver[] =3D { /* PHY_GBIT_FEATURES */ .flags =3D PHY_POLL_CABLE_TEST, .driver_data =3D &ksz9131_type, + .ops =3D &(const struct phy_driver_ops){ .probe =3D kszphy_probe, .soft_reset =3D genphy_soft_reset, .config_init =3D ksz9131_config_init, @@ -4875,16 +4904,19 @@ static struct phy_driver ksphy_driver[] =3D { .cable_test_start =3D ksz9x31_cable_test_start, .cable_test_get_status =3D ksz9x31_cable_test_get_status, .get_features =3D ksz9477_get_features, + }, }, { .phy_id =3D PHY_ID_KSZ8873MLL, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Micrel KSZ8873MLL Switch", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D kszphy_config_init, .config_aneg =3D ksz8873mll_config_aneg, .read_status =3D ksz8873mll_read_status, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ886X, .phy_id_mask =3D MICREL_PHY_ID_MASK, @@ -4892,6 +4924,7 @@ static struct phy_driver ksphy_driver[] =3D { .driver_data =3D &ksz886x_type, /* PHY_BASIC_FEATURES */ .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D kszphy_config_init, .config_aneg =3D ksz886x_config_aneg, .read_status =3D ksz886x_read_status, @@ -4899,24 +4932,29 @@ static struct phy_driver ksphy_driver[] =3D { .resume =3D genphy_resume, .cable_test_start =3D ksz886x_cable_test_start, .cable_test_get_status =3D ksz886x_cable_test_get_status, + }, }, { .name =3D "Micrel KSZ87XX Switch", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D kszphy_config_init, .match_phy_device =3D ksz8795_match_phy_device, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D PHY_ID_KSZ9477, .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Microchip KSZ9477", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D ksz9477_config_init, .config_intr =3D kszphy_config_intr, .handle_interrupt =3D kszphy_handle_interrupt, .suspend =3D genphy_suspend, .resume =3D genphy_resume, .get_features =3D ksz9477_get_features, + }, } }; =20 module_phy_driver(ksphy_driver); diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c index 0b88635f4fbc..aa0e720cfb6b 100644 --- a/drivers/net/phy/microchip.c +++ b/drivers/net/phy/microchip.c @@ -384,6 +384,7 @@ static struct phy_driver microchip_phy_driver[] =3D { .name =3D "Microchip LAN88xx", =20 /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D lan88xx_probe, .remove =3D lan88xx_remove, @@ -400,6 +401,7 @@ static struct phy_driver microchip_phy_driver[] =3D { .set_wol =3D lan88xx_set_wol, .read_page =3D lan88xx_read_page, .write_page =3D lan88xx_write_page, + }, } }; =20 module_phy_driver(microchip_phy_driver); diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c index a838b61cd844..df9eb70c998e 100644 --- a/drivers/net/phy/microchip_t1.c +++ b/drivers/net/phy/microchip_t1.c @@ -866,6 +866,7 @@ static struct phy_driver microchip_t1_phy_driver[] =3D { .name =3D "Microchip LAN87xx T1", .flags =3D PHY_POLL_CABLE_TEST, .features =3D PHY_BASIC_T1_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D lan87xx_config_init, .config_intr =3D lan87xx_phy_config_intr, .handle_interrupt =3D lan87xx_handle_interrupt, @@ -877,12 +878,14 @@ static struct phy_driver microchip_t1_phy_driver[] = =3D { .get_sqi_max =3D lan87xx_get_sqi_max, .cable_test_start =3D lan87xx_cable_test_start, .cable_test_get_status =3D lan87xx_cable_test_get_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_LAN937X), .name =3D "Microchip LAN937x T1", .flags =3D PHY_POLL_CABLE_TEST, .features =3D PHY_BASIC_T1_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D lan87xx_config_init, .config_intr =3D lan87xx_phy_config_intr, .handle_interrupt =3D lan87xx_handle_interrupt, @@ -894,6 +897,7 @@ static struct phy_driver microchip_t1_phy_driver[] =3D { .get_sqi_max =3D lan87xx_get_sqi_max, .cable_test_start =3D lan87xx_cable_test_start, .cable_test_get_status =3D lan87xx_cable_test_get_status, + }, } }; =20 diff --git a/drivers/net/phy/microchip_t1s.c b/drivers/net/phy/microchip_t1= s.c index 534ca7d1b061..17b99f1ed090 100644 --- a/drivers/net/phy/microchip_t1s.c +++ b/drivers/net/phy/microchip_t1s.c @@ -273,21 +273,25 @@ static struct phy_driver microchip_t1s_driver[] =3D { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1), .name =3D "LAN867X Rev.B1", .features =3D PHY_BASIC_T1S_P2MP_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D lan867x_revb1_config_init, .read_status =3D lan86xx_read_status, .get_plca_cfg =3D genphy_c45_plca_get_cfg, .set_plca_cfg =3D genphy_c45_plca_set_cfg, .get_plca_status =3D genphy_c45_plca_get_status, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_LAN865X_REVB0), .name =3D "LAN865X Rev.B0 Internal Phy", .features =3D PHY_BASIC_T1S_P2MP_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D lan865x_revb0_config_init, .read_status =3D lan86xx_read_status, .get_plca_cfg =3D genphy_c45_plca_get_cfg, .set_plca_cfg =3D genphy_c45_plca_set_cfg, .get_plca_status =3D genphy_c45_plca_get_status, + }, }, }; =20 diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c index 7a11fdb687cc..22d6bbc876e7 100644 --- a/drivers/net/phy/motorcomm.c +++ b/drivers/net/phy/motorcomm.c @@ -2256,15 +2256,18 @@ static struct phy_driver motorcomm_phy_drvs[] =3D { { PHY_ID_MATCH_EXACT(PHY_ID_YT8511), .name =3D "YT8511 Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D yt8511_config_init, .suspend =3D genphy_suspend, .resume =3D genphy_resume, .read_page =3D yt8511_read_page, .write_page =3D yt8511_write_page, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_YT8521), .name =3D "YT8521 Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D yt8521_get_features, .probe =3D yt8521_probe, .read_page =3D yt8521_read_page, @@ -2278,10 +2281,12 @@ static struct phy_driver motorcomm_phy_drvs[] =3D { .soft_reset =3D yt8521_soft_reset, .suspend =3D yt8521_suspend, .resume =3D yt8521_resume, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_YT8531), .name =3D "YT8531 Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .probe =3D yt8531_probe, .config_init =3D yt8531_config_init, .suspend =3D genphy_suspend, @@ -2289,10 +2294,12 @@ static struct phy_driver motorcomm_phy_drvs[] =3D { .get_wol =3D ytphy_get_wol, .set_wol =3D yt8531_set_wol, .link_change_notify =3D yt8531_link_change_notify, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_YT8531S), .name =3D "YT8531S Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D yt8521_get_features, .probe =3D yt8521_probe, .read_page =3D yt8521_read_page, @@ -2306,6 +2313,7 @@ static struct phy_driver motorcomm_phy_drvs[] =3D { .soft_reset =3D yt8521_soft_reset, .suspend =3D yt8521_suspend, .resume =3D yt8521_resume, + }, }, }; =20 diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_m= ain.c index 6f74ce0ab1aa..923aa45a61f7 100644 --- a/drivers/net/phy/mscc/mscc_main.c +++ b/drivers/net/phy/mscc/mscc_main.c @@ -2342,6 +2342,7 @@ static struct phy_driver vsc85xx_driver[] =3D { .name =3D "Microsemi GE VSC8501 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc85xx_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2360,12 +2361,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8502, .name =3D "Microsemi GE VSC8502 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc85xx_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2384,12 +2387,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8504, .name =3D "Microsemi GE VSC8504 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2409,11 +2414,13 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8514, .name =3D "Microsemi GE VSC8514 SyncE", .phy_id_mask =3D 0xfffffff0, + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8514_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2432,12 +2439,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8530, .name =3D "Microsemi FE VSC8530", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc85xx_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2456,12 +2465,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8531, .name =3D "Microsemi VSC8531", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc85xx_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2480,12 +2491,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8540, .name =3D "Microsemi FE VSC8540 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc85xx_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2504,12 +2517,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8541, .name =3D "Microsemi VSC8541 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc85xx_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2528,12 +2543,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8552, .name =3D "Microsemi GE VSC8552 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2552,12 +2569,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC856X, .name =3D "Microsemi GE VSC856X SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2574,12 +2593,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8572, .name =3D "Microsemi GE VSC8572 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2599,12 +2620,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8574, .name =3D "Microsemi GE VSC8574 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2624,12 +2647,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8575, .name =3D "Microsemi GE VSC8575 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2647,12 +2672,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8582, .name =3D "Microsemi GE VSC8582 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2670,12 +2697,14 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_sset_count =3D &vsc85xx_get_sset_count, .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, + }, }, { .phy_id =3D PHY_ID_VSC8584, .name =3D "Microsemi GE VSC8584 SyncE", .phy_id_mask =3D 0xfffffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D &genphy_soft_reset, .config_init =3D &vsc8584_config_init, .config_aneg =3D &vsc85xx_config_aneg, @@ -2694,6 +2723,7 @@ static struct phy_driver vsc85xx_driver[] =3D { .get_strings =3D &vsc85xx_get_strings, .get_stats =3D &vsc85xx_get_stats, .link_change_notify =3D &vsc85xx_link_change_notify, + }, } =20 }; diff --git a/drivers/net/phy/mxl-gpy.c b/drivers/net/phy/mxl-gpy.c index ea1073adc5a1..5ac5f03fb7ce 100644 --- a/drivers/net/phy/mxl-gpy.c +++ b/drivers/net/phy/mxl-gpy.c @@ -813,6 +813,7 @@ static struct phy_driver gpy_drivers[] =3D { { PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx), .name =3D "Maxlinear Ethernet GPY2xx", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -826,11 +827,13 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { .phy_id =3D PHY_ID_GPY115B, .phy_id_mask =3D PHY_ID_GPYx15B_MASK, .name =3D "Maxlinear Ethernet GPY115B", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -844,10 +847,12 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy115_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY115C), .name =3D "Maxlinear Ethernet GPY115C", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -861,11 +866,13 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy115_loopback, + }, }, { .phy_id =3D PHY_ID_GPY211B, .phy_id_mask =3D PHY_ID_GPY21xB_MASK, .name =3D "Maxlinear Ethernet GPY211B", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -879,10 +886,12 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY211C), .name =3D "Maxlinear Ethernet GPY211C", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -896,11 +905,13 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { .phy_id =3D PHY_ID_GPY212B, .phy_id_mask =3D PHY_ID_GPY21xB_MASK, .name =3D "Maxlinear Ethernet GPY212B", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -914,10 +925,12 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY212C), .name =3D "Maxlinear Ethernet GPY212C", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -931,11 +944,13 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { .phy_id =3D PHY_ID_GPY215B, .phy_id_mask =3D PHY_ID_GPYx15B_MASK, .name =3D "Maxlinear Ethernet GPY215B", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -949,10 +964,12 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY215C), .name =3D "Maxlinear Ethernet GPY215C", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -966,10 +983,12 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY241B), .name =3D "Maxlinear Ethernet GPY241B", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -983,10 +1002,12 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM), .name =3D "Maxlinear Ethernet GPY241BM", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -1000,10 +1021,12 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY245B), .name =3D "Maxlinear Ethernet GPY245B", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_c45_pma_read_abilities, .config_init =3D gpy_config_init, .probe =3D gpy_probe, @@ -1017,6 +1040,7 @@ static struct phy_driver gpy_drivers[] =3D { .set_wol =3D gpy_set_wol, .get_wol =3D gpy_get_wol, .set_loopback =3D gpy_loopback, + }, }, }; module_phy_driver(gpy_drivers); diff --git a/drivers/net/phy/national.c b/drivers/net/phy/national.c index 9ae9cc6b23c2..acdf6477b304 100644 --- a/drivers/net/phy/national.c +++ b/drivers/net/phy/national.c @@ -162,9 +162,11 @@ static struct phy_driver dp83865_driver[] =3D { { .phy_id_mask =3D 0xfffffff0, .name =3D "NatSemi DP83865", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D ns_config_init, .config_intr =3D ns_config_intr, .handle_interrupt =3D ns_handle_interrupt, + }, } }; =20 module_phy_driver(dp83865_driver); diff --git a/drivers/net/phy/ncn26000.c b/drivers/net/phy/ncn26000.c index 5680584f659e..56fae7e36611 100644 --- a/drivers/net/phy/ncn26000.c +++ b/drivers/net/phy/ncn26000.c @@ -145,6 +145,7 @@ static struct phy_driver ncn26000_driver[] =3D { PHY_ID_MATCH_MODEL(PHY_ID_NCN26000), .name =3D "NCN26000", .features =3D PHY_BASIC_T1S_P2MP_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D ncn26000_config_init, .config_intr =3D ncn26000_config_intr, .config_aneg =3D ncn26000_config_aneg, @@ -154,6 +155,7 @@ static struct phy_driver ncn26000_driver[] =3D { .set_plca_cfg =3D genphy_c45_plca_set_cfg, .get_plca_status =3D genphy_c45_plca_get_status, .soft_reset =3D genphy_soft_reset, + }, }, }; =20 diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tj= a11xx.c index 3cf614b4cd52..4cd410d56277 100644 --- a/drivers/net/phy/nxp-c45-tja11xx.c +++ b/drivers/net/phy/nxp-c45-tja11xx.c @@ -1929,8 +1929,9 @@ static struct phy_driver nxp_c45_driver[] =3D { { PHY_ID_MATCH_MODEL(PHY_ID_TJA_1103), .name =3D "NXP C45 TJA1103", - .get_features =3D nxp_c45_get_features, .driver_data =3D &tja1103_phy_data, + .ops =3D &(const struct phy_driver_ops){ + .get_features =3D nxp_c45_get_features, .probe =3D nxp_c45_probe, .soft_reset =3D nxp_c45_soft_reset, .config_aneg =3D genphy_c45_config_aneg, @@ -1949,12 +1950,14 @@ static struct phy_driver nxp_c45_driver[] =3D { .get_sqi =3D nxp_c45_get_sqi, .get_sqi_max =3D nxp_c45_get_sqi_max, .remove =3D nxp_c45_remove, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_TJA_1120), .name =3D "NXP C45 TJA1120", - .get_features =3D nxp_c45_get_features, .driver_data =3D &tja1120_phy_data, + .ops =3D &(const struct phy_driver_ops){ + .get_features =3D nxp_c45_get_features, .probe =3D nxp_c45_probe, .soft_reset =3D nxp_c45_soft_reset, .config_aneg =3D genphy_c45_config_aneg, @@ -1974,6 +1977,7 @@ static struct phy_driver nxp_c45_driver[] =3D { .get_sqi =3D nxp_c45_get_sqi, .get_sqi_max =3D nxp_c45_get_sqi_max, .remove =3D nxp_c45_remove, + }, }, }; =20 diff --git a/drivers/net/phy/nxp-cbtx.c b/drivers/net/phy/nxp-cbtx.c index 145703f0a406..5f2b6513d2ad 100644 --- a/drivers/net/phy/nxp-cbtx.c +++ b/drivers/net/phy/nxp-cbtx.c @@ -199,6 +199,7 @@ static struct phy_driver cbtx_driver[] =3D { PHY_ID_MATCH_MODEL(PHY_ID_CBTX_SJA1110), .name =3D "NXP CBTX (SJA1110)", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D cbtx_soft_reset, .config_init =3D cbtx_config_init, .suspend =3D genphy_suspend, @@ -210,6 +211,7 @@ static struct phy_driver cbtx_driver[] =3D { .get_sset_count =3D cbtx_get_sset_count, .get_strings =3D cbtx_get_strings, .get_stats =3D cbtx_get_stats, + }, }, }; =20 diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 2c263ae44b4f..66e0f9fca2da 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -205,22 +205,22 @@ static int tja11xx_config_aneg_cable_test(struct phy_= device *phydev) if (phydev->link) return 0; =20 - if (!phydev->drv->cable_test_start || - !phydev->drv->cable_test_get_status) + if (!phydev->drv->ops->cable_test_start || + !phydev->drv->ops->cable_test_get_status) return 0; =20 ret =3D ethnl_cable_test_alloc(phydev, ETHTOOL_MSG_CABLE_TEST_NTF); if (ret) return ret; =20 - ret =3D phydev->drv->cable_test_start(phydev); + ret =3D phydev->drv->ops->cable_test_start(phydev); if (ret) return ret; =20 /* According to the documentation this test takes 100 usec */ usleep_range(100, 200); =20 - ret =3D phydev->drv->cable_test_get_status(phydev, &finished); + ret =3D phydev->drv->ops->cable_test_get_status(phydev, &finished); if (ret) return ret; =20 @@ -805,6 +805,7 @@ static struct phy_driver tja11xx_driver[] =3D { PHY_ID_MATCH_MODEL(PHY_ID_TJA1100), .name =3D "NXP TJA1100", .features =3D PHY_BASIC_T1_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .probe =3D tja11xx_probe, .soft_reset =3D tja11xx_soft_reset, .config_aneg =3D tja11xx_config_aneg, @@ -819,10 +820,12 @@ static struct phy_driver tja11xx_driver[] =3D { .get_sset_count =3D tja11xx_get_sset_count, .get_strings =3D tja11xx_get_strings, .get_stats =3D tja11xx_get_stats, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_TJA1101), .name =3D "NXP TJA1101", .features =3D PHY_BASIC_T1_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .probe =3D tja11xx_probe, .soft_reset =3D tja11xx_soft_reset, .config_aneg =3D tja11xx_config_aneg, @@ -837,10 +840,12 @@ static struct phy_driver tja11xx_driver[] =3D { .get_sset_count =3D tja11xx_get_sset_count, .get_strings =3D tja11xx_get_strings, .get_stats =3D tja11xx_get_stats, + }, }, { .name =3D "NXP TJA1102 Port 0", .features =3D PHY_BASIC_T1_FEATURES, .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D tja1102_p0_probe, .soft_reset =3D tja11xx_soft_reset, .config_aneg =3D tja11xx_config_aneg, @@ -860,11 +865,13 @@ static struct phy_driver tja11xx_driver[] =3D { .handle_interrupt =3D tja11xx_handle_interrupt, .cable_test_start =3D tja11xx_cable_test_start, .cable_test_get_status =3D tja11xx_cable_test_get_status, + }, }, { .name =3D "NXP TJA1102 Port 1", .features =3D PHY_BASIC_T1_FEATURES, .flags =3D PHY_POLL_CABLE_TEST, /* currently no probe for Port 1 is need */ + .ops =3D &(const struct phy_driver_ops){ .soft_reset =3D tja11xx_soft_reset, .config_aneg =3D tja11xx_config_aneg, .config_init =3D tja11xx_config_init, @@ -883,6 +890,7 @@ static struct phy_driver tja11xx_driver[] =3D { .handle_interrupt =3D tja11xx_handle_interrupt, .cable_test_start =3D tja11xx_cable_test_start, .cable_test_get_status =3D tja11xx_cable_test_get_status, + }, } }; =20 diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 46c87a903efd..9e7e72062335 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -1522,5 +1522,7 @@ struct phy_driver genphy_c45_driver =3D { .phy_id =3D 0xffffffff, .phy_id_mask =3D 0xffffffff, .name =3D "Generic Clause 45 PHY", + .ops =3D &(const struct phy_driver_ops){ .read_status =3D genphy_c45_read_status, + }, }; diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 15f349e5995a..0dcd8d5934ef 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -576,8 +576,8 @@ int __phy_read_mmd(struct phy_device *phydev, int devad= , u32 regnum) if (regnum > (u16)~0 || devad > 32) return -EINVAL; =20 - if (phydev->drv && phydev->drv->read_mmd) - return phydev->drv->read_mmd(phydev, devad, regnum); + if (phydev->drv && phydev->drv->ops && phydev->drv->ops->read_mmd) + return phydev->drv->ops->read_mmd(phydev, devad, regnum); =20 return mmd_phy_read(phydev->mdio.bus, phydev->mdio.addr, phydev->is_c45, devad, regnum); @@ -620,8 +620,8 @@ int __phy_write_mmd(struct phy_device *phydev, int deva= d, u32 regnum, u16 val) if (regnum > (u16)~0 || devad > 32) return -EINVAL; =20 - if (phydev->drv && phydev->drv->write_mmd) - return phydev->drv->write_mmd(phydev, devad, regnum, val); + if (phydev->drv && phydev->drv->ops && phydev->drv->ops->write_mmd) + return phydev->drv->ops->write_mmd(phydev, devad, regnum, val); =20 return mmd_phy_write(phydev->mdio.bus, phydev->mdio.addr, phydev->is_c45, devad, regnum, val); @@ -968,18 +968,20 @@ EXPORT_SYMBOL_GPL(phy_modify_mmd); =20 static int __phy_read_page(struct phy_device *phydev) { - if (WARN_ONCE(!phydev->drv->read_page, "read_page callback not available,= PHY driver not loaded?\n")) + if (WARN_ONCE(!phydev->drv->ops || !phydev->drv->ops->read_page, + "read_page callback not available, PHY driver not loaded?\n")) return -EOPNOTSUPP; =20 - return phydev->drv->read_page(phydev); + return phydev->drv->ops->read_page(phydev); } =20 static int __phy_write_page(struct phy_device *phydev, int page) { - if (WARN_ONCE(!phydev->drv->write_page, "write_page callback not availabl= e, PHY driver not loaded?\n")) + if (WARN_ONCE(!phydev->drv->ops || !phydev->drv->ops->write_page, + "write_page callback not available, PHY driver not loaded?\n")) return -EOPNOTSUPP; =20 - return phydev->drv->write_page(phydev, page); + return phydev->drv->ops->write_page(phydev, page); } =20 /** diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 14224e06d69f..185a8c60de54 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -65,8 +65,9 @@ static void phy_process_state_change(struct phy_device *p= hydev, phydev_dbg(phydev, "PHY state change %s -> %s\n", phy_state_to_str(old_state), phy_state_to_str(phydev->state)); - if (phydev->drv && phydev->drv->link_change_notify) - phydev->drv->link_change_notify(phydev); + if (phydev->drv && phydev->drv->ops && + phydev->drv->ops->link_change_notify) + phydev->drv->ops->link_change_notify(phydev); } } =20 @@ -145,9 +146,9 @@ int phy_get_rate_matching(struct phy_device *phydev, { int ret =3D RATE_MATCH_NONE; =20 - if (phydev->drv->get_rate_matching) { + if (phydev->drv->ops && phydev->drv->ops->get_rate_matching) { mutex_lock(&phydev->lock); - ret =3D phydev->drv->get_rate_matching(phydev, iface); + ret =3D phydev->drv->ops->get_rate_matching(phydev, iface); mutex_unlock(&phydev->lock); } =20 @@ -165,8 +166,8 @@ EXPORT_SYMBOL_GPL(phy_get_rate_matching); static int phy_config_interrupt(struct phy_device *phydev, bool interrupts) { phydev->interrupts =3D interrupts ? 1 : 0; - if (phydev->drv->config_intr) - return phydev->drv->config_intr(phydev); + if (phydev->drv->ops && phydev->drv->ops->config_intr) + return phydev->drv->ops->config_intr(phydev); =20 return 0; } @@ -201,8 +202,8 @@ EXPORT_SYMBOL_GPL(phy_restart_aneg); */ int phy_aneg_done(struct phy_device *phydev) { - if (phydev->drv && phydev->drv->aneg_done) - return phydev->drv->aneg_done(phydev); + if (phydev->drv && phydev->drv->ops && phydev->drv->ops->aneg_done) + return phydev->drv->ops->aneg_done(phydev); else if (phydev->is_c45) return genphy_c45_aneg_done(phydev); else @@ -552,11 +553,11 @@ static void phy_abort_cable_test(struct phy_device *p= hydev) */ int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data) { - if (!phydev->drv) + if (!phydev->drv || !phydev->drv->ops) return -EIO; =20 mutex_lock(&phydev->lock); - phydev->drv->get_strings(phydev, data); + phydev->drv->ops->get_strings(phydev, data); mutex_unlock(&phydev->lock); =20 return 0; @@ -572,14 +573,14 @@ int phy_ethtool_get_sset_count(struct phy_device *phy= dev) { int ret; =20 - if (!phydev->drv) + if (!phydev->drv || !phydev->drv->ops) return -EIO; =20 - if (phydev->drv->get_sset_count && - phydev->drv->get_strings && - phydev->drv->get_stats) { + if (phydev->drv->ops->get_sset_count && + phydev->drv->ops->get_strings && + phydev->drv->ops->get_stats) { mutex_lock(&phydev->lock); - ret =3D phydev->drv->get_sset_count(phydev); + ret =3D phydev->drv->ops->get_sset_count(phydev); mutex_unlock(&phydev->lock); =20 return ret; @@ -599,11 +600,11 @@ EXPORT_SYMBOL(phy_ethtool_get_sset_count); int phy_ethtool_get_stats(struct phy_device *phydev, struct ethtool_stats *stats, u64 *data) { - if (!phydev->drv) + if (!phydev->drv || !phydev->drv->ops) return -EIO; =20 mutex_lock(&phydev->lock); - phydev->drv->get_stats(phydev, stats, data); + phydev->drv->ops->get_stats(phydev, stats, data); mutex_unlock(&phydev->lock); =20 return 0; @@ -628,13 +629,13 @@ int phy_ethtool_get_plca_cfg(struct phy_device *phyde= v, goto out; } =20 - if (!phydev->drv->get_plca_cfg) { + if (!phydev->drv->ops || phydev->drv->ops->get_plca_cfg) { ret =3D -EOPNOTSUPP; goto out; } =20 mutex_lock(&phydev->lock); - ret =3D phydev->drv->get_plca_cfg(phydev, plca_cfg); + ret =3D phydev->drv->ops->get_plca_cfg(phydev, plca_cfg); =20 mutex_unlock(&phydev->lock); out: @@ -691,8 +692,9 @@ int phy_ethtool_set_plca_cfg(struct phy_device *phydev, goto out; } =20 - if (!phydev->drv->set_plca_cfg || - !phydev->drv->get_plca_cfg) { + if (!phydev->drv->ops || + !phydev->drv->ops->set_plca_cfg || + !phydev->drv->ops->get_plca_cfg) { ret =3D -EOPNOTSUPP; goto out; } @@ -705,7 +707,7 @@ int phy_ethtool_set_plca_cfg(struct phy_device *phydev, =20 mutex_lock(&phydev->lock); =20 - ret =3D phydev->drv->get_plca_cfg(phydev, curr_plca_cfg); + ret =3D phydev->drv->ops->get_plca_cfg(phydev, curr_plca_cfg); if (ret) goto out_drv; =20 @@ -762,7 +764,7 @@ int phy_ethtool_set_plca_cfg(struct phy_device *phydev, goto out_drv; } =20 - ret =3D phydev->drv->set_plca_cfg(phydev, plca_cfg); + ret =3D phydev->drv->ops->set_plca_cfg(phydev, plca_cfg); =20 out_drv: kfree(curr_plca_cfg); @@ -789,13 +791,14 @@ int phy_ethtool_get_plca_status(struct phy_device *ph= ydev, goto out; } =20 - if (!phydev->drv->get_plca_status) { + if (!phydev->drv->ops || + !phydev->drv->ops->get_plca_status) { ret =3D -EOPNOTSUPP; goto out; } =20 mutex_lock(&phydev->lock); - ret =3D phydev->drv->get_plca_status(phydev, plca_st); + ret =3D phydev->drv->ops->get_plca_status(phydev, plca_st); =20 mutex_unlock(&phydev->lock); out: @@ -814,9 +817,9 @@ int phy_start_cable_test(struct phy_device *phydev, struct net_device *dev =3D phydev->attached_dev; int err =3D -ENOMEM; =20 - if (!(phydev->drv && - phydev->drv->cable_test_start && - phydev->drv->cable_test_get_status)) { + if (!(phydev->drv && phydev->drv->ops && + phydev->drv->ops->cable_test_start && + phydev->drv->ops->cable_test_get_status)) { NL_SET_ERR_MSG(extack, "PHY driver does not support cable testing"); return -EOPNOTSUPP; @@ -846,7 +849,7 @@ int phy_start_cable_test(struct phy_device *phydev, phy_link_down(phydev); =20 netif_testing_on(dev); - err =3D phydev->drv->cable_test_start(phydev); + err =3D phydev->drv->ops->cable_test_start(phydev); if (err) { netif_testing_off(dev); phy_link_up(phydev); @@ -885,9 +888,9 @@ int phy_start_cable_test_tdr(struct phy_device *phydev, struct net_device *dev =3D phydev->attached_dev; int err =3D -ENOMEM; =20 - if (!(phydev->drv && - phydev->drv->cable_test_tdr_start && - phydev->drv->cable_test_get_status)) { + if (!(phydev->drv && phydev->drv->ops && + phydev->drv->ops->cable_test_tdr_start && + phydev->drv->ops->cable_test_get_status)) { NL_SET_ERR_MSG(extack, "PHY driver does not support cable test TDR"); return -EOPNOTSUPP; @@ -917,7 +920,7 @@ int phy_start_cable_test_tdr(struct phy_device *phydev, phy_link_down(phydev); =20 netif_testing_on(dev); - err =3D phydev->drv->cable_test_tdr_start(phydev, config); + err =3D phydev->drv->ops->cable_test_tdr_start(phydev, config); if (err) { netif_testing_off(dev); phy_link_up(phydev); @@ -944,8 +947,8 @@ EXPORT_SYMBOL(phy_start_cable_test_tdr); =20 int phy_config_aneg(struct phy_device *phydev) { - if (phydev->drv->config_aneg) - return phydev->drv->config_aneg(phydev); + if (phydev->drv->ops && phydev->drv->ops->config_aneg) + return phydev->drv->ops->config_aneg(phydev); =20 /* Clause 45 PHYs that don't implement Clause 22 registers are not * allowed to call genphy_config_aneg() @@ -1315,7 +1318,7 @@ static irqreturn_t phy_interrupt(int irq, void *phy_d= at) } =20 mutex_lock(&phydev->lock); - ret =3D phydev->drv->handle_interrupt(phydev); + ret =3D phydev->drv->ops->handle_interrupt(phydev); mutex_unlock(&phydev->lock); =20 return ret; @@ -1401,7 +1404,7 @@ static enum phy_state_work _phy_state_machine(struct = phy_device *phydev) func =3D &phy_check_link_status; break; case PHY_CABLETEST: - err =3D phydev->drv->cable_test_get_status(phydev, &finished); + err =3D phydev->drv->ops->cable_test_get_status(phydev, &finished); if (err) { phy_abort_cable_test(phydev); netif_testing_off(dev); @@ -1683,9 +1686,9 @@ int phy_ethtool_set_wol(struct phy_device *phydev, st= ruct ethtool_wolinfo *wol) { int ret; =20 - if (phydev->drv && phydev->drv->set_wol) { + if (phydev->drv && phydev->drv->ops && phydev->drv->ops->set_wol) { mutex_lock(&phydev->lock); - ret =3D phydev->drv->set_wol(phydev, wol); + ret =3D phydev->drv->ops->set_wol(phydev, wol); mutex_unlock(&phydev->lock); =20 return ret; @@ -1703,9 +1706,9 @@ EXPORT_SYMBOL(phy_ethtool_set_wol); */ void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo= *wol) { - if (phydev->drv && phydev->drv->get_wol) { + if (phydev->drv && phydev->drv->ops && phydev->drv->ops->get_wol) { mutex_lock(&phydev->lock); - phydev->drv->get_wol(phydev, wol); + phydev->drv->ops->get_wol(phydev, wol); mutex_unlock(&phydev->lock); } } diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index d63dca535746..2f4e28416726 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -274,7 +274,7 @@ static bool mdio_bus_phy_may_suspend(struct phy_device = *phydev) struct phy_driver *phydrv =3D to_phy_driver(drv); struct net_device *netdev =3D phydev->attached_dev; =20 - if (!drv || !phydrv->suspend) + if (!drv || !phydrv->ops || !phydrv->ops->suspend) return false; =20 /* PHY not attached? May suspend if the PHY has not already been @@ -532,8 +532,8 @@ static int phy_bus_match(struct device *dev, struct dev= ice_driver *drv) if (!(phydrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY)) return 0; =20 - if (phydrv->match_phy_device) - return phydrv->match_phy_device(phydev); + if (phydrv->ops && phydrv->ops->match_phy_device) + return phydrv->ops->match_phy_device(phydev); =20 if (phydev->is_c45) { for (i =3D 1; i < num_ids; i++) { @@ -1235,11 +1235,11 @@ int phy_init_hw(struct phy_device *phydev) /* Deassert the reset signal */ phy_device_reset(phydev, 0); =20 - if (!phydev->drv) + if (!phydev->drv || !phydev->drv->ops) return 0; =20 - if (phydev->drv->soft_reset) { - ret =3D phydev->drv->soft_reset(phydev); + if (phydev->drv->ops->soft_reset) { + ret =3D phydev->drv->ops->soft_reset(phydev); if (ret < 0) return ret; =20 @@ -1253,14 +1253,14 @@ int phy_init_hw(struct phy_device *phydev) =20 phy_interface_zero(phydev->possible_interfaces); =20 - if (phydev->drv->config_init) { - ret =3D phydev->drv->config_init(phydev); + if (phydev->drv->ops->config_init) { + ret =3D phydev->drv->ops->config_init(phydev); if (ret < 0) return ret; } =20 - if (phydev->drv->config_intr) { - ret =3D phydev->drv->config_intr(phydev); + if (phydev->drv->ops->config_intr) { + ret =3D phydev->drv->ops->config_intr(phydev); if (ret < 0) return ret; } @@ -1419,7 +1419,7 @@ EXPORT_SYMBOL(phy_sfp_probe); =20 static bool phy_drv_supports_irq(const struct phy_driver *phydrv) { - return phydrv->config_intr && phydrv->handle_interrupt; + return phydrv->ops && phydrv->ops->config_intr && phydrv->ops->handle_int= errupt; } =20 /** @@ -1978,10 +1978,10 @@ int phy_suspend(struct phy_device *phydev) if (phydev->wol_enabled && !(phydrv->flags & PHY_ALWAYS_CALL_SUSPEND)) return -EBUSY; =20 - if (!phydrv || !phydrv->suspend) + if (!phydrv || !phydrv->ops || !phydrv->ops->suspend) return 0; =20 - ret =3D phydrv->suspend(phydev); + ret =3D phydrv->ops->suspend(phydev); if (!ret) phydev->suspended =3D true; =20 @@ -1996,10 +1996,10 @@ int __phy_resume(struct phy_device *phydev) =20 lockdep_assert_held(&phydev->lock); =20 - if (!phydrv || !phydrv->resume) + if (!phydrv || !phydrv->ops || !phydrv->ops->resume) return 0; =20 - ret =3D phydrv->resume(phydev); + ret =3D phydrv->ops->resume(phydev); if (!ret) phydev->suspended =3D false; =20 @@ -2038,8 +2038,8 @@ int phy_loopback(struct phy_device *phydev, bool enab= le) goto out; } =20 - if (phydev->drv->set_loopback) - ret =3D phydev->drv->set_loopback(phydev, enable); + if (phydev->drv->ops && phydev->drv->ops->set_loopback) + ret =3D phydev->drv->ops->set_loopback(phydev, enable); else ret =3D genphy_loopback(phydev, enable); =20 @@ -3130,7 +3130,7 @@ static int phy_led_set_brightness(struct led_classdev= *led_cdev, int err; =20 mutex_lock(&phydev->lock); - err =3D phydev->drv->led_brightness_set(phydev, phyled->index, value); + err =3D phydev->drv->ops->led_brightness_set(phydev, phyled->index, value= ); mutex_unlock(&phydev->lock); =20 return err; @@ -3145,8 +3145,8 @@ static int phy_led_blink_set(struct led_classdev *led= _cdev, int err; =20 mutex_lock(&phydev->lock); - err =3D phydev->drv->led_blink_set(phydev, phyled->index, - delay_on, delay_off); + err =3D phydev->drv->ops->led_blink_set(phydev, phyled->index, + delay_on, delay_off); mutex_unlock(&phydev->lock); =20 return err; @@ -3172,7 +3172,7 @@ phy_led_hw_control_get(struct led_classdev *led_cdev, int err; =20 mutex_lock(&phydev->lock); - err =3D phydev->drv->led_hw_control_get(phydev, phyled->index, rules); + err =3D phydev->drv->ops->led_hw_control_get(phydev, phyled->index, rules= ); mutex_unlock(&phydev->lock); =20 return err; @@ -3187,7 +3187,7 @@ phy_led_hw_control_set(struct led_classdev *led_cdev, int err; =20 mutex_lock(&phydev->lock); - err =3D phydev->drv->led_hw_control_set(phydev, phyled->index, rules); + err =3D phydev->drv->ops->led_hw_control_set(phydev, phyled->index, rules= ); mutex_unlock(&phydev->lock); =20 return err; @@ -3201,7 +3201,7 @@ static __maybe_unused int phy_led_hw_is_supported(str= uct led_classdev *led_cdev, int err; =20 mutex_lock(&phydev->lock); - err =3D phydev->drv->led_hw_is_supported(phydev, phyled->index, rules); + err =3D phydev->drv->ops->led_hw_is_supported(phydev, phyled->index, rule= s); mutex_unlock(&phydev->lock); =20 return err; @@ -3247,24 +3247,25 @@ static int of_phy_led(struct phy_device *phydev, =20 if (modes) { /* Return error if asked to set polarity modes but not supported */ - if (!phydev->drv->led_polarity_set) + if (phydev->drv->ops && !phydev->drv->ops->led_polarity_set) return -EINVAL; =20 - err =3D phydev->drv->led_polarity_set(phydev, index, modes); + err =3D phydev->drv->ops->led_polarity_set(phydev, index, modes); if (err) return err; } =20 phyled->index =3D index; - if (phydev->drv->led_brightness_set) + if (phydev->drv->ops && phydev->drv->ops->led_brightness_set) cdev->brightness_set_blocking =3D phy_led_set_brightness; - if (phydev->drv->led_blink_set) + if (phydev->drv->ops && phydev->drv->ops->led_blink_set) cdev->blink_set =3D phy_led_blink_set; =20 #ifdef CONFIG_LEDS_TRIGGERS - if (phydev->drv->led_hw_is_supported && - phydev->drv->led_hw_control_set && - phydev->drv->led_hw_control_get) { + if (phydev->drv->ops && + phydev->drv->ops->led_hw_is_supported && + phydev->drv->ops->led_hw_control_set && + phydev->drv->ops->led_hw_control_get) { cdev->hw_control_is_supported =3D phy_led_hw_is_supported; cdev->hw_control_set =3D phy_led_hw_control_set; cdev->hw_control_get =3D phy_led_hw_control_get; @@ -3426,8 +3427,8 @@ static int phy_probe(struct device *dev) /* Deassert the reset signal */ phy_device_reset(phydev, 0); =20 - if (phydev->drv->probe) { - err =3D phydev->drv->probe(phydev); + if (phydev->drv->ops && phydev->drv->ops->probe) { + err =3D phydev->drv->ops->probe(phydev); if (err) goto out; } @@ -3441,9 +3442,8 @@ static int phy_probe(struct device *dev) if (phydrv->features) { linkmode_copy(phydev->supported, phydrv->features); genphy_c45_read_eee_abilities(phydev); - } - else if (phydrv->get_features) - err =3D phydrv->get_features(phydev); + } else if (phydev->drv->ops && phydrv->ops->get_features) + err =3D phydrv->ops->get_features(phydev); else if (phydev->is_c45) err =3D genphy_c45_pma_read_abilities(phydev); else @@ -3540,8 +3540,9 @@ static int phy_remove(struct device *dev) sfp_bus_del_upstream(phydev->sfp_bus); phydev->sfp_bus =3D NULL; =20 - if (phydev->drv && phydev->drv->remove) - phydev->drv->remove(phydev); + if (phydev->drv && phydev->drv->ops && + phydev->drv->ops->remove) + phydev->drv->ops->remove(phydev); =20 /* Assert the reset signal */ phy_device_reset(phydev, 1); @@ -3563,7 +3564,7 @@ int phy_driver_register(struct phy_driver *new_driver= , struct module *owner) /* Either the features are hard coded, or dynamically * determined. It cannot be both. */ - if (WARN_ON(new_driver->features && new_driver->get_features)) { + if (WARN_ON(new_driver->features && new_driver->ops && new_driver->ops->g= et_features)) { pr_err("%s: features and get_features must not both be set\n", new_driver->name); return -EINVAL; @@ -3637,10 +3638,12 @@ static struct phy_driver genphy_driver =3D { .phy_id =3D 0xffffffff, .phy_id_mask =3D 0xffffffff, .name =3D "Generic PHY", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D genphy_read_abilities, .suspend =3D genphy_suspend, .resume =3D genphy_resume, .set_loopback =3D genphy_loopback, + }, }; =20 static const struct ethtool_phy_ops phy_ethtool_phy_ops =3D { diff --git a/drivers/net/phy/qcom/at803x.c b/drivers/net/phy/qcom/at803x.c index 4717c59d51d0..96666c5d58e0 100644 --- a/drivers/net/phy/qcom/at803x.c +++ b/drivers/net/phy/qcom/at803x.c @@ -988,6 +988,7 @@ static struct phy_driver at803x_driver[] =3D { PHY_ID_MATCH_EXACT(ATH8035_PHY_ID), .name =3D "Qualcomm Atheros AR8035", .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D at8035_probe, .config_aneg =3D at803x_config_aneg, .config_init =3D at803x_config_init, @@ -1004,11 +1005,13 @@ static struct phy_driver at803x_driver[] =3D { .set_tunable =3D at803x_set_tunable, .cable_test_start =3D at8031_cable_test_start, .cable_test_get_status =3D at8031_cable_test_get_status, + }, }, { /* Qualcomm Atheros AR8030 */ .phy_id =3D ATH8030_PHY_ID, .name =3D "Qualcomm Atheros AR8030", .phy_id_mask =3D AT8030_PHY_ID_MASK, + .ops =3D &(const struct phy_driver_ops){ .probe =3D at8035_probe, .config_init =3D at803x_config_init, .link_change_notify =3D at803x_link_change_notify, @@ -1019,11 +1022,13 @@ static struct phy_driver at803x_driver[] =3D { /* PHY_BASIC_FEATURES */ .config_intr =3D at803x_config_intr, .handle_interrupt =3D at803x_handle_interrupt, + }, }, { /* Qualcomm Atheros AR8031/AR8033 */ PHY_ID_MATCH_EXACT(ATH8031_PHY_ID), .name =3D "Qualcomm Atheros AR8031/AR8033", .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D at8031_probe, .config_init =3D at8031_config_init, .config_aneg =3D at803x_config_aneg, @@ -1042,12 +1047,14 @@ static struct phy_driver at803x_driver[] =3D { .set_tunable =3D at803x_set_tunable, .cable_test_start =3D at8031_cable_test_start, .cable_test_get_status =3D at8031_cable_test_get_status, + }, }, { /* Qualcomm Atheros AR8032 */ PHY_ID_MATCH_EXACT(ATH8032_PHY_ID), .name =3D "Qualcomm Atheros AR8032", - .probe =3D at803x_probe, .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ + .probe =3D at803x_probe, .config_init =3D at803x_config_init, .link_change_notify =3D at803x_link_change_notify, .suspend =3D at803x_suspend, @@ -1057,14 +1064,16 @@ static struct phy_driver at803x_driver[] =3D { .handle_interrupt =3D at803x_handle_interrupt, .cable_test_start =3D at803x_cable_test_start, .cable_test_get_status =3D at8032_cable_test_get_status, + }, }, { /* ATHEROS AR9331 */ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID), .name =3D "Qualcomm Atheros AR9331 built-in PHY", + .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D at803x_probe, .suspend =3D at803x_suspend, .resume =3D at803x_resume, - .flags =3D PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ .config_intr =3D at803x_config_intr, .handle_interrupt =3D at803x_handle_interrupt, @@ -1073,14 +1082,16 @@ static struct phy_driver at803x_driver[] =3D { .read_status =3D at803x_read_status, .soft_reset =3D genphy_soft_reset, .config_aneg =3D at803x_config_aneg, + }, }, { /* Qualcomm Atheros QCA9561 */ PHY_ID_MATCH_EXACT(QCA9561_PHY_ID), .name =3D "Qualcomm Atheros QCA9561 built-in PHY", + .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D at803x_probe, .suspend =3D at803x_suspend, .resume =3D at803x_resume, - .flags =3D PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ .config_intr =3D at803x_config_intr, .handle_interrupt =3D at803x_handle_interrupt, @@ -1089,6 +1100,7 @@ static struct phy_driver at803x_driver[] =3D { .read_status =3D at803x_read_status, .soft_reset =3D genphy_soft_reset, .config_aneg =3D at803x_config_aneg, + }, }, }; =20 module_phy_driver(at803x_driver); diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c index 780c28e2e4aa..9ff9a8a062a9 100644 --- a/drivers/net/phy/qcom/qca807x.c +++ b/drivers/net/phy/qcom/qca807x.c @@ -797,6 +797,7 @@ static struct phy_driver qca807x_drivers[] =3D { .name =3D "Qualcomm QCA8072", .flags =3D PHY_POLL_CABLE_TEST, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D qca807x_probe, .config_init =3D qca807x_config_init, .read_status =3D qca807x_read_status, @@ -809,12 +810,14 @@ static struct phy_driver qca807x_drivers[] =3D { .suspend =3D genphy_suspend, .cable_test_start =3D qca807x_cable_test_start, .cable_test_get_status =3D qca808x_cable_test_get_status, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_QCA8075), .name =3D "Qualcomm QCA8075", .flags =3D PHY_POLL_CABLE_TEST, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .probe =3D qca807x_probe, .config_init =3D qca807x_config_init, .read_status =3D qca807x_read_status, @@ -832,6 +835,7 @@ static struct phy_driver qca807x_drivers[] =3D { .led_hw_is_supported =3D qca807x_led_hw_is_supported, .led_hw_control_set =3D qca807x_led_hw_control_set, .led_hw_control_get =3D qca807x_led_hw_control_get, + }, }, }; module_phy_driver(qca807x_drivers); diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c index 2acf852fb4de..5aee2529f329 100644 --- a/drivers/net/phy/qcom/qca808x.c +++ b/drivers/net/phy/qcom/qca808x.c @@ -609,6 +609,7 @@ static struct phy_driver qca808x_driver[] =3D { PHY_ID_MATCH_EXACT(QCA8081_PHY_ID), .name =3D "Qualcomm QCA8081", .flags =3D PHY_POLL_CABLE_TEST, + .ops =3D &(const struct phy_driver_ops){ .probe =3D qca808x_probe, .config_intr =3D at803x_config_intr, .handle_interrupt =3D at803x_handle_interrupt, @@ -632,6 +633,7 @@ static struct phy_driver qca808x_driver[] =3D { .led_hw_control_set =3D qca808x_led_hw_control_set, .led_hw_control_get =3D qca808x_led_hw_control_get, .led_polarity_set =3D qca808x_led_polarity_set, + }, }, }; =20 module_phy_driver(qca808x_driver); diff --git a/drivers/net/phy/qcom/qca83xx.c b/drivers/net/phy/qcom/qca83xx.c index 5d083ef0250e..6630c0e6de90 100644 --- a/drivers/net/phy/qcom/qca83xx.c +++ b/drivers/net/phy/qcom/qca83xx.c @@ -220,8 +220,9 @@ static struct phy_driver qca83xx_driver[] =3D { .phy_id_mask =3D QCA8K_PHY_ID_MASK, .name =3D "Qualcomm Atheros 8337 internal PHY", /* PHY_GBIT_FEATURES */ - .probe =3D qca83xx_probe, .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ + .probe =3D qca83xx_probe, .config_init =3D qca83xx_config_init, .soft_reset =3D genphy_soft_reset, .get_sset_count =3D qca83xx_get_sset_count, @@ -229,15 +230,17 @@ static struct phy_driver qca83xx_driver[] =3D { .get_stats =3D qca83xx_get_stats, .suspend =3D qca8337_suspend, .resume =3D qca83xx_resume, + }, }, { /* QCA8327-A from switch QCA8327-AL1A */ .phy_id =3D QCA8327_A_PHY_ID, .phy_id_mask =3D QCA8K_PHY_ID_MASK, .name =3D "Qualcomm Atheros 8327-A internal PHY", /* PHY_GBIT_FEATURES */ + .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .link_change_notify =3D qca83xx_link_change_notify, .probe =3D qca83xx_probe, - .flags =3D PHY_IS_INTERNAL, .config_init =3D qca8327_config_init, .soft_reset =3D genphy_soft_reset, .get_sset_count =3D qca83xx_get_sset_count, @@ -245,15 +248,17 @@ static struct phy_driver qca83xx_driver[] =3D { .get_stats =3D qca83xx_get_stats, .suspend =3D qca8327_suspend, .resume =3D qca83xx_resume, + }, }, { /* QCA8327-B from switch QCA8327-BL1A */ .phy_id =3D QCA8327_B_PHY_ID, .phy_id_mask =3D QCA8K_PHY_ID_MASK, .name =3D "Qualcomm Atheros 8327-B internal PHY", /* PHY_GBIT_FEATURES */ + .flags =3D PHY_IS_INTERNAL, + .ops =3D &(const struct phy_driver_ops){ .link_change_notify =3D qca83xx_link_change_notify, .probe =3D qca83xx_probe, - .flags =3D PHY_IS_INTERNAL, .config_init =3D qca8327_config_init, .soft_reset =3D genphy_soft_reset, .get_sset_count =3D qca83xx_get_sset_count, @@ -261,6 +266,7 @@ static struct phy_driver qca83xx_driver[] =3D { .get_stats =3D qca83xx_get_stats, .suspend =3D qca8327_suspend, .resume =3D qca83xx_resume, + }, }, }; =20 module_phy_driver(qca83xx_driver); diff --git a/drivers/net/phy/qsemi.c b/drivers/net/phy/qsemi.c index 30d15f7c9b03..a8c5c263669d 100644 --- a/drivers/net/phy/qsemi.c +++ b/drivers/net/phy/qsemi.c @@ -148,9 +148,11 @@ static struct phy_driver qs6612_driver[] =3D { { .name =3D "QS6612", .phy_id_mask =3D 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D qs6612_config_init, .config_intr =3D qs6612_config_intr, .handle_interrupt =3D qs6612_handle_interrupt, + }, } }; =20 module_phy_driver(qs6612_driver); diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 481c79fbd6eb..b5db40d783d8 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -867,37 +867,46 @@ static struct phy_driver realtek_drvs[] =3D { { PHY_ID_MATCH_EXACT(0x00008201), .name =3D "RTL8201CP Ethernet", + .ops =3D &(const struct phy_driver_ops){ .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc816), .name =3D "RTL8201F Fast Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_intr =3D &rtl8201_config_intr, .handle_interrupt =3D rtl8201_handle_interrupt, .suspend =3D genphy_suspend, .resume =3D genphy_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_MODEL(0x001cc880), .name =3D "RTL8208 Fast Ethernet", + .ops =3D &(const struct phy_driver_ops){ .read_mmd =3D genphy_read_mmd_unsupported, .write_mmd =3D genphy_write_mmd_unsupported, .suspend =3D genphy_suspend, .resume =3D genphy_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc910), .name =3D "RTL8211 Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_aneg =3D rtl8211_config_aneg, .read_mmd =3D &genphy_read_mmd_unsupported, .write_mmd =3D &genphy_write_mmd_unsupported, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc912), .name =3D "RTL8211B Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_intr =3D &rtl8211b_config_intr, .handle_interrupt =3D rtl821x_handle_interrupt, .read_mmd =3D &genphy_read_mmd_unsupported, @@ -906,26 +915,32 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtl8211b_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc913), .name =3D "RTL8211C Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D rtl8211c_config_init, .read_mmd =3D &genphy_read_mmd_unsupported, .write_mmd =3D &genphy_write_mmd_unsupported, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc914), .name =3D "RTL8211DN Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_intr =3D rtl8211e_config_intr, .handle_interrupt =3D rtl821x_handle_interrupt, .suspend =3D genphy_suspend, .resume =3D genphy_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc915), .name =3D "RTL8211E Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &rtl8211e_config_init, .config_intr =3D &rtl8211e_config_intr, .handle_interrupt =3D rtl821x_handle_interrupt, @@ -933,9 +948,12 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D genphy_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc916), .name =3D "RTL8211F Gigabit Ethernet", + .flags =3D PHY_ALWAYS_CALL_SUSPEND, + .ops =3D &(const struct phy_driver_ops){ .probe =3D rtl821x_probe, .config_init =3D &rtl8211f_config_init, .read_status =3D rtlgen_read_status, @@ -945,10 +963,12 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtl821x_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, - .flags =3D PHY_ALWAYS_CALL_SUSPEND, + }, }, { PHY_ID_MATCH_EXACT(RTL_8211FVD_PHYID), .name =3D "RTL8211F-VD Gigabit Ethernet", + .flags =3D PHY_ALWAYS_CALL_SUSPEND, + .ops =3D &(const struct phy_driver_ops){ .probe =3D rtl821x_probe, .config_init =3D &rtl8211f_config_init, .read_status =3D rtlgen_read_status, @@ -958,9 +978,10 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtl821x_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, - .flags =3D PHY_ALWAYS_CALL_SUSPEND, + }, }, { .name =3D "Generic FE-GE Realtek PHY", + .ops =3D &(const struct phy_driver_ops){ .match_phy_device =3D rtlgen_match_phy_device, .read_status =3D rtlgen_read_status, .suspend =3D genphy_suspend, @@ -969,8 +990,10 @@ static struct phy_driver realtek_drvs[] =3D { .write_page =3D rtl821x_write_page, .read_mmd =3D rtlgen_read_mmd, .write_mmd =3D rtlgen_write_mmd, + }, }, { .name =3D "RTL8226 2.5Gbps PHY", + .ops =3D &(const struct phy_driver_ops){ .match_phy_device =3D rtl8226_match_phy_device, .get_features =3D rtl822x_get_features, .config_aneg =3D rtl822x_config_aneg, @@ -981,9 +1004,11 @@ static struct phy_driver realtek_drvs[] =3D { .write_page =3D rtl821x_write_page, .read_mmd =3D rtl822x_read_mmd, .write_mmd =3D rtl822x_write_mmd, + }, }, { PHY_ID_MATCH_EXACT(0x001cc840), .name =3D "RTL8226B_RTL8221B 2.5Gbps PHY", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D rtl822x_get_features, .config_aneg =3D rtl822x_config_aneg, .read_status =3D rtl822x_read_status, @@ -993,9 +1018,11 @@ static struct phy_driver realtek_drvs[] =3D { .write_page =3D rtl821x_write_page, .read_mmd =3D rtl822x_read_mmd, .write_mmd =3D rtl822x_write_mmd, + }, }, { PHY_ID_MATCH_EXACT(0x001cc838), .name =3D "RTL8226-CG 2.5Gbps PHY", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D rtl822x_get_features, .config_aneg =3D rtl822x_config_aneg, .read_status =3D rtl822x_read_status, @@ -1003,9 +1030,11 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtlgen_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc848), .name =3D "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D rtl822x_get_features, .config_aneg =3D rtl822x_config_aneg, .read_status =3D rtl822x_read_status, @@ -1013,9 +1042,11 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtlgen_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc849), .name =3D "RTL8221B-VB-CG 2.5Gbps PHY", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D rtl822x_get_features, .config_aneg =3D rtl822x_config_aneg, .read_status =3D rtl822x_read_status, @@ -1023,9 +1054,11 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtlgen_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc84a), .name =3D "RTL8221B-VM-CG 2.5Gbps PHY", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D rtl822x_get_features, .config_aneg =3D rtl822x_config_aneg, .read_status =3D rtl822x_read_status, @@ -1033,9 +1066,11 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtlgen_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc862), .name =3D "RTL8251B 5Gbps PHY", + .ops =3D &(const struct phy_driver_ops){ .get_features =3D rtl822x_get_features, .config_aneg =3D rtl822x_config_aneg, .read_status =3D rtl822x_read_status, @@ -1043,9 +1078,11 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D rtlgen_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc961), .name =3D "RTL8366RB Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &rtl8366rb_config_init, /* These interrupts are handled by the irq controller * embedded inside the RTL8366RB, they get unmasked when the @@ -1056,10 +1093,12 @@ static struct phy_driver realtek_drvs[] =3D { .handle_interrupt =3D genphy_handle_interrupt_no_ack, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { PHY_ID_MATCH_EXACT(0x001ccb00), .name =3D "RTL9000AA_RTL9000AN Ethernet", .features =3D PHY_BASIC_T1_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D rtl9000a_config_init, .config_aneg =3D rtl9000a_config_aneg, .read_status =3D rtl9000a_read_status, @@ -1069,14 +1108,17 @@ static struct phy_driver realtek_drvs[] =3D { .resume =3D genphy_resume, .read_page =3D rtl821x_read_page, .write_page =3D rtl821x_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x001cc942), .name =3D "RTL8365MB-VC Gigabit Ethernet", + .ops =3D &(const struct phy_driver_ops){ /* Interrupt handling analogous to RTL8366RB */ .config_intr =3D genphy_no_config_intr, .handle_interrupt =3D genphy_handle_interrupt_no_ack, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, }; =20 diff --git a/drivers/net/phy/rockchip.c b/drivers/net/phy/rockchip.c index bb13e75183ee..45e18fbec58d 100644 --- a/drivers/net/phy/rockchip.c +++ b/drivers/net/phy/rockchip.c @@ -177,12 +177,14 @@ static struct phy_driver rockchip_phy_driver[] =3D { .name =3D "Rockchip integrated EPHY", /* PHY_BASIC_FEATURES */ .flags =3D 0, + .ops =3D &(const struct phy_driver_ops){ .link_change_notify =3D rockchip_link_change_notify, .soft_reset =3D genphy_soft_reset, .config_init =3D rockchip_integrated_phy_config_init, .config_aneg =3D rockchip_config_aneg, .suspend =3D genphy_suspend, .resume =3D rockchip_phy_resume, + }, }, }; =20 diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 150aea7c9c36..0860d30901a2 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -643,6 +643,7 @@ static struct phy_driver smsc_phy_driver[] =3D { .name =3D "SMSC LAN83C185", =20 /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D smsc_phy_probe, =20 @@ -656,12 +657,14 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D 0x0007c0b0, /* OUI=3D0x00800f, Model#=3D0x0b */ .phy_id_mask =3D 0xfffffff0, .name =3D "SMSC LAN8187", =20 /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D smsc_phy_probe, =20 @@ -680,6 +683,7 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { /* This covers internal PHY (phy_id: 0x0007C0C3) for * LAN9500 (PID: 0x9500), LAN9514 (PID: 0xec00), LAN9505 (PID: 0x9505) @@ -689,6 +693,7 @@ static struct phy_driver smsc_phy_driver[] =3D { .name =3D "SMSC LAN8700", =20 /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D smsc_phy_probe, =20 @@ -712,12 +717,14 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D 0x0007c0d0, /* OUI=3D0x00800f, Model#=3D0x0d */ .phy_id_mask =3D 0xfffffff0, .name =3D "SMSC LAN911x Internal PHY", =20 /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D smsc_phy_probe, =20 @@ -727,6 +734,7 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { /* This covers internal PHY (phy_id: 0x0007C0F0) for * LAN9500A (PID: 0x9E00), LAN9505A (PID: 0x9E01) @@ -736,6 +744,7 @@ static struct phy_driver smsc_phy_driver[] =3D { .name =3D "SMSC LAN8710/LAN8720", =20 /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D smsc_phy_probe, =20 @@ -759,6 +768,7 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D 0x0007c110, .phy_id_mask =3D 0xfffffff0, @@ -766,6 +776,7 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 /* PHY_BASIC_FEATURES */ .flags =3D PHY_RST_AFTER_CLK_EN, + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D smsc_phy_probe, =20 @@ -792,6 +803,7 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D 0x0007c130, /* 0x0007c130 and 0x0007c131 */ /* This mask (0xfffffff2) is to differentiate from @@ -803,6 +815,7 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 /* PHY_BASIC_FEATURES */ .flags =3D PHY_RST_AFTER_CLK_EN, + .ops =3D &(const struct phy_driver_ops){ =20 .probe =3D smsc_phy_probe, =20 @@ -829,6 +842,7 @@ static struct phy_driver smsc_phy_driver[] =3D { =20 .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, } }; =20 module_phy_driver(smsc_phy_driver); diff --git a/drivers/net/phy/ste10Xp.c b/drivers/net/phy/ste10Xp.c index 309e4c3496c4..1af413906823 100644 --- a/drivers/net/phy/ste10Xp.c +++ b/drivers/net/phy/ste10Xp.c @@ -105,21 +105,25 @@ static struct phy_driver ste10xp_pdriver[] =3D { .phy_id_mask =3D 0xfffffff0, .name =3D "STe101p", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D ste10Xp_config_init, .config_intr =3D ste10Xp_config_intr, .handle_interrupt =3D ste10Xp_handle_interrupt, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, }, { .phy_id =3D STE100P_PHY_ID, .phy_id_mask =3D 0xffffffff, .name =3D "STe100p", /* PHY_BASIC_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D ste10Xp_config_init, .config_intr =3D ste10Xp_config_intr, .handle_interrupt =3D ste10Xp_handle_interrupt, .suspend =3D genphy_suspend, .resume =3D genphy_resume, + }, } }; =20 module_phy_driver(ste10xp_pdriver); diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index 8057ea8dbc21..d1eadd7074a3 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -78,10 +78,12 @@ static struct phy_driver teranetics_driver[] =3D { .phy_id_mask =3D 0xffffffff, .name =3D "Teranetics TN2020", .features =3D PHY_10GBIT_FEATURES, + .ops =3D &(const struct phy_driver_ops){ .aneg_done =3D teranetics_aneg_done, .config_aneg =3D gen10g_config_aneg, .read_status =3D teranetics_read_status, .match_phy_device =3D teranetics_match_phy_device, + }, }, }; =20 diff --git a/drivers/net/phy/uPD60620.c b/drivers/net/phy/uPD60620.c index 38834347a427..865f62844d58 100644 --- a/drivers/net/phy/uPD60620.c +++ b/drivers/net/phy/uPD60620.c @@ -84,8 +84,10 @@ static struct phy_driver upd60620_driver[1] =3D { { .name =3D "Renesas uPD60620", /* PHY_BASIC_FEATURES */ .flags =3D 0, + .ops =3D &(const struct phy_driver_ops){ .config_init =3D upd60620_config_init, .read_status =3D upd60620_read_status, + }, } }; =20 module_phy_driver(upd60620_driver); diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 897b979ec03c..41fc63ce3b2e 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c @@ -408,99 +408,121 @@ static struct phy_driver vsc82xx_driver[] =3D { .name =3D "Vitesse VSC8234", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &vsc824x_config_init, .config_aneg =3D &vsc82x4_config_aneg, .config_intr =3D &vsc82xx_config_intr, .handle_interrupt =3D &vsc82xx_handle_interrupt, + }, }, { .phy_id =3D PHY_ID_VSC8244, .name =3D "Vitesse VSC8244", .phy_id_mask =3D 0x000fffc0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &vsc824x_config_init, .config_aneg =3D &vsc82x4_config_aneg, .config_intr =3D &vsc82xx_config_intr, .handle_interrupt =3D &vsc82xx_handle_interrupt, + }, }, { .phy_id =3D PHY_ID_VSC8572, .name =3D "Vitesse VSC8572", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &vsc824x_config_init, .config_aneg =3D &vsc82x4_config_aneg, .config_intr =3D &vsc82xx_config_intr, .handle_interrupt =3D &vsc82xx_handle_interrupt, + }, }, { .phy_id =3D PHY_ID_VSC8601, .name =3D "Vitesse VSC8601", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &vsc8601_config_init, .config_intr =3D &vsc82xx_config_intr, .handle_interrupt =3D &vsc82xx_handle_interrupt, + }, }, { .phy_id =3D PHY_ID_VSC7385, .name =3D "Vitesse VSC7385", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D vsc738x_config_init, .config_aneg =3D vsc73xx_config_aneg, .read_page =3D vsc73xx_read_page, .write_page =3D vsc73xx_write_page, + }, }, { .phy_id =3D PHY_ID_VSC7388, .name =3D "Vitesse VSC7388", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D vsc738x_config_init, .config_aneg =3D vsc73xx_config_aneg, .read_page =3D vsc73xx_read_page, .write_page =3D vsc73xx_write_page, + }, }, { .phy_id =3D PHY_ID_VSC7395, .name =3D "Vitesse VSC7395", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D vsc739x_config_init, .config_aneg =3D vsc73xx_config_aneg, .read_page =3D vsc73xx_read_page, .write_page =3D vsc73xx_write_page, + }, }, { .phy_id =3D PHY_ID_VSC7398, .name =3D "Vitesse VSC7398", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D vsc739x_config_init, .config_aneg =3D vsc73xx_config_aneg, .read_page =3D vsc73xx_read_page, .write_page =3D vsc73xx_write_page, + }, }, { .phy_id =3D PHY_ID_VSC8662, .name =3D "Vitesse VSC8662", .phy_id_mask =3D 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &vsc824x_config_init, .config_aneg =3D &vsc82x4_config_aneg, .config_intr =3D &vsc82xx_config_intr, .handle_interrupt =3D &vsc82xx_handle_interrupt, + }, }, { /* Vitesse 8221 */ .phy_id =3D PHY_ID_VSC8221, .phy_id_mask =3D 0x000ffff0, .name =3D "Vitesse VSC8221", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &vsc8221_config_init, .config_intr =3D &vsc82xx_config_intr, .handle_interrupt =3D &vsc82xx_handle_interrupt, + }, }, { /* Vitesse 8211 */ .phy_id =3D PHY_ID_VSC8211, .phy_id_mask =3D 0x000ffff0, .name =3D "Vitesse VSC8211", /* PHY_GBIT_FEATURES */ + .ops =3D &(const struct phy_driver_ops){ .config_init =3D &vsc8221_config_init, .config_intr =3D &vsc82xx_config_intr, .handle_interrupt =3D &vsc82xx_handle_interrupt, + }, } }; =20 module_phy_driver(vsc82xx_driver); diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_g= mii2rgmii.c index 7b1bc5fcef9b..46f64c1fa143 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -24,6 +24,7 @@ struct gmii2rgmii { struct phy_device *phy_dev; const struct phy_driver *phy_drv; struct phy_driver conv_phy_drv; + struct phy_driver_ops conv_phy_drv_ops; struct mdio_device *mdio; }; =20 @@ -51,8 +52,8 @@ static int xgmiitorgmii_read_status(struct phy_device *ph= ydev) struct gmii2rgmii *priv =3D mdiodev_get_drvdata(&phydev->mdio); int err; =20 - if (priv->phy_drv->read_status) - err =3D priv->phy_drv->read_status(phydev); + if (priv->phy_drv->ops && priv->phy_drv->ops->read_status) + err =3D priv->phy_drv->ops->read_status(phydev); else err =3D genphy_read_status(phydev); if (err < 0) @@ -68,8 +69,8 @@ static int xgmiitorgmii_set_loopback(struct phy_device *p= hydev, bool enable) struct gmii2rgmii *priv =3D mdiodev_get_drvdata(&phydev->mdio); int err; =20 - if (priv->phy_drv->set_loopback) - err =3D priv->phy_drv->set_loopback(phydev, enable); + if (priv->phy_drv->ops && priv->phy_drv->ops->set_loopback) + err =3D priv->phy_drv->ops->set_loopback(phydev, enable); else err =3D genphy_loopback(phydev, enable); if (err < 0) @@ -113,8 +114,11 @@ static int xgmiitorgmii_probe(struct mdio_device *mdio= dev) priv->phy_drv =3D priv->phy_dev->drv; memcpy(&priv->conv_phy_drv, priv->phy_dev->drv, sizeof(struct phy_driver)); - priv->conv_phy_drv.read_status =3D xgmiitorgmii_read_status; - priv->conv_phy_drv.set_loopback =3D xgmiitorgmii_set_loopback; + memcpy(&priv->conv_phy_drv_ops, priv->phy_dev->drv->ops, + sizeof(struct phy_driver_ops)); + priv->conv_phy_drv_ops.read_status =3D xgmiitorgmii_read_status; + priv->conv_phy_drv_ops.set_loopback =3D xgmiitorgmii_set_loopback; + priv->conv_phy_drv.ops =3D &priv->conv_phy_drv_ops; mdiodev_set_drvdata(&priv->phy_dev->mdio, priv); priv->phy_dev->drv =3D &priv->conv_phy_drv; =20 diff --git a/include/linux/phy.h b/include/linux/phy.h index c2dda21b39e1..bce995067b4c 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -882,19 +882,7 @@ struct phy_led { #define to_phy_led(d) container_of(d, struct phy_led, led_cdev) =20 /** - * struct phy_driver - Driver structure for a particular PHY type - * - * @mdiodrv: Data common to all MDIO devices - * @phy_id: The result of reading the UID registers of this PHY - * type, and ANDing them with the phy_id_mask. This driver - * only works for PHYs with IDs which match this field - * @name: The friendly name of this PHY type - * @phy_id_mask: Defines the important bits of the phy_id - * @features: A mandatory list of features (speed, duplex, etc) - * supported by this PHY - * @flags: A bitfield defining certain other features this PHY - * supports (like interrupts) - * @driver_data: Static driver data + * struct phy_driver_ops - Driver structure for all OPs of a particular PHY * * All functions are optional. If config_aneg or read_status * are not implemented, the phy core uses the genphy versions. @@ -903,16 +891,8 @@ struct phy_led { * to be able to block when the bus transaction is happening, * and be freed up by an interrupt (The MPC85xx has this ability, * though it is not currently supported in the driver). - */ -struct phy_driver { - struct mdio_driver_common mdiodrv; - u32 phy_id; - char *name; - u32 phy_id_mask; - const unsigned long * const features; - u32 flags; - const void *driver_data; - +*/ +struct phy_driver_ops { /** * @soft_reset: Called to issue a PHY software reset */ @@ -1171,6 +1151,33 @@ struct phy_driver { int (*led_polarity_set)(struct phy_device *dev, int index, unsigned long modes); }; + +/** + * struct phy_driver - Driver structure for a particular PHY type + * + * @mdiodrv: Data common to all MDIO devices + * @phy_id: The result of reading the UID registers of this PHY + * type, and ANDing them with the phy_id_mask. This driver + * only works for PHYs with IDs which match this field + * @name: The friendly name of this PHY type + * @phy_id_mask: Defines the important bits of the phy_id + * @features: A mandatory list of features (speed, duplex, etc) + * supported by this PHY + * @flags: A bitfield defining certain other features this PHY + * supports (like interrupts) + * @driver_data: Static driver data + * @ops: Pointer to PHY driver OPs + */ +struct phy_driver { + struct mdio_driver_common mdiodrv; + u32 phy_id; + char *name; + u32 phy_id_mask; + const unsigned long * const features; + u32 flags; + const void *driver_data; + const struct phy_driver_ops *ops; +}; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) =20 @@ -1929,8 +1936,8 @@ static inline int phy_read_status(struct phy_device *= phydev) if (!phydev->drv) return -EIO; =20 - if (phydev->drv->read_status) - return phydev->drv->read_status(phydev); + if (phydev->drv->ops && phydev->drv->ops->read_status) + return phydev->drv->ops->read_status(phydev); else return genphy_read_status(phydev); } --=20 2.43.0 From nobody Thu Nov 14 04:44:16 2024 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 D9A017E772; Sat, 17 Feb 2024 19:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198897; cv=none; b=GP90tBODVKb5O2BNTulGG9ieJtt6gMIFaD/VybE0qYHKB+zpEEzSQWvnmBUFcCeRHivi0EtxcpTOJlaDvJDxVjJTkbJ5pBDk7b6BKqWtMlystz47NMR+BvrvYnE0VnNNWDGYHs2QjtFCKZES9ujbZXNHIoKPKCtfagLPjlQvKpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198897; c=relaxed/simple; bh=mTd7gWZZAv2L+AJWK4gReRVscjNHop7dSwQNqNUKLck=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Df1ykdkCD+c0stMvmzgMLsM4Cgbtt4vLw+qwglYSWE8h/TlnLSYOs9Ia6HMMM7+TMVPyWr7ofrI/TCzsDK/sf+j4I2BKy8sgYH/BITlqoWZPjh/t+EaN7v/X/yj6Hm0k9KV1s0y6g8R2y6D0JW52TJ4sNMhdJlItNY14nJjE70s= 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=js8H22hX; arc=none smtp.client-ip=209.85.221.42 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="js8H22hX" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-33d3a9f377aso127978f8f.3; Sat, 17 Feb 2024 11:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708198894; x=1708803694; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pZEviv2teb4NzkCVrP/1Qc+rjhnubLMND2DwU0Wh17A=; b=js8H22hXIr9XYN2i9WppjzX6ShpIbBke39H8Tt/MS4mQM6nSxl7AvD/vzx2LRWtsOO exjjWcPyg28lCsgQ5GMo5OYk19/3kaQC4Nvw+Dmaz6m2nI7k5AINo6ZQpJIUeusaAZyG 1E5n2qj8Ukfy6vlV2ckNHWzcJQ/3mCP7fr58JJ3i9/1tBBFyTvhZszAyM1akpcS5gyaw 7QhA68daFhGWEATCFrHHNt6wEFS6vonMRfWhzA9dfqPb057Zq1MfJHotZNmXYIRouNbF xgQjlYqVDrRgLG56AYiuwirENaP8vUgArYluJS/pXLZn2LCfDj0nQjHW3bHrK49v1nEr 2B2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708198894; x=1708803694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pZEviv2teb4NzkCVrP/1Qc+rjhnubLMND2DwU0Wh17A=; b=RdVZ6fK5RoyFEeQfpkRuIJYcCCAibuueYVvffj+GjFGkwnSOGYb6C6/eeFs2JLdyXg wQLBB0gepILA4mI2Fr3JLqXhyQTOPji8qonOMr5jfp2nu4mQQS/DE/JUhs1+GQGCb0zb nAks03bu4iJl2TRDMyacyJrFSjVA0tZFRT+s3+r7bLpQf4+dUv/aAl4pSdDNMpN85nuz EON5wtq+WLCZlyuGjQyw6yzF3QECSrQgoG23uLhIROzbAcm+cfxl28EzPFCaQAeSN5jr o683k/I50O2PWaq2KxCidqJhAKSh2MFxioNkfN7nxD/JrZzIt1xBJ78Hc/xYCXWdSn7p n+0A== X-Forwarded-Encrypted: i=1; AJvYcCXFob8VfmCmU7iXEICDEkdVtD7vq024Ft1KvFtfoj5e4BZBeY+ybuUvimlX/U6dK3p1ZTJNHlfin7G4QzAtKpVCrF4/ffo6srNwgNovZloRewGtLgRKg0Ccpo6Qs93a1n2Xa322miN6DnkNBAvHYJA+RkmYSIgi3TSrqkpV0H/hxLO7xamEsWTdJ+d9/kmnB0Lrz+0cTLIEbNbj8IaFPXbxutQL X-Gm-Message-State: AOJu0Yxt0JU83RCl0Hd/jy+Od4RZMkWsW/fxqzQdGfWYOgbHfDZ08+nK cOl/UtTSclMFdpMtcmureuQ4RQDyIKO0kFs5MwiDZHbuL2+c53jJ X-Google-Smtp-Source: AGHT+IH5z0lQxM8SWKlZjhmYQZswVu+KcjSTCP84/EW6jYLGcTWFQHxT2+612mD4BXGNG14DlFINyw== X-Received: by 2002:a05:6000:24a:b0:33d:3b44:aaa6 with SMTP id m10-20020a056000024a00b0033d3b44aaa6mr339545wrz.58.1708198893894; Sat, 17 Feb 2024 11:41:33 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id b10-20020a5d40ca000000b0033ceca3a3dbsm5661169wrq.2.2024.02.17.11.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 11:41:33 -0800 (PST) From: Christian Marangi To: Michael Hennerich , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Richard Cochran , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Daniel Golle , Qingfang Deng , SkyLake Huang , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Arun Ramadoss , UNGLinuxDriver@microchip.com, Peter Geis , Frank , Xu Liang , Piergiorgio Beruto , Andrei Botila , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Michal Simek , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Vladimir Oltean , David Epping , Harini Katakam , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, rust-for-linux@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 2/3] net: phy: aquantia: use common OPs for PHYs where possible Date: Sat, 17 Feb 2024 20:41:13 +0100 Message-ID: <20240217194116.8565-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240217194116.8565-1-ansuelsmth@gmail.com> References: <20240217194116.8565-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Group common OPs for PHY, make them static and reference these statically link OPs table instead of duplicating them for each PHY. Signed-off-by: Christian Marangi --- drivers/net/phy/aquantia/aquantia_main.c | 207 ++++++++--------------- 1 file changed, 69 insertions(+), 138 deletions(-) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aqu= antia/aquantia_main.c index 2166370ccc82..5720ceda303f 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -768,53 +768,14 @@ static int aqr111_config_init(struct phy_device *phyd= ev) return aqr107_config_init(phydev); } =20 -static struct phy_driver aqr_driver[] =3D { -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), - .name =3D "Aquantia AQ1202", - .ops =3D &(const struct phy_driver_ops){ - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .read_status =3D aqr_read_status, - }, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQ2104), - .name =3D "Aquantia AQ2104", - .ops =3D &(const struct phy_driver_ops){ - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .read_status =3D aqr_read_status, - }, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR105), - .name =3D "Aquantia AQR105", - .ops =3D &(const struct phy_driver_ops){ - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .read_status =3D aqr_read_status, - .suspend =3D aqr107_suspend, - .resume =3D aqr107_resume, - }, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR106), - .name =3D "Aquantia AQR106", - .ops =3D &(const struct phy_driver_ops){ +static const struct phy_driver_ops aqr106_ops =3D { .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, .read_status =3D aqr_read_status, - }, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR107), - .name =3D "Aquantia AQR107", - .ops =3D &(const struct phy_driver_ops){ +}; + +static const struct phy_driver_ops aqr107_ops =3D { .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, .config_init =3D aqr107_config_init, @@ -830,15 +791,12 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, - }, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), - .name =3D "Aquantia AQCS109", - .ops =3D &(const struct phy_driver_ops){ +}; + +static const struct phy_driver_ops aqr111_ops =3D { .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, - .config_init =3D aqcs109_config_init, + .config_init =3D aqr111_config_init, .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, @@ -851,36 +809,66 @@ static struct phy_driver aqr_driver[] =3D { .get_strings =3D aqr107_get_strings, .get_stats =3D aqr107_get_stats, .link_change_notify =3D aqr107_link_change_notify, - }, +}; + +static const struct phy_driver_ops aqr113_ops =3D { + .probe =3D aqr107_probe, + .get_rate_matching =3D aqr107_get_rate_matching, + .config_init =3D aqr113c_config_init, + .config_aneg =3D aqr_config_aneg, + .config_intr =3D aqr_config_intr, + .handle_interrupt =3D aqr_handle_interrupt, + .read_status =3D aqr107_read_status, + .get_tunable =3D aqr107_get_tunable, + .set_tunable =3D aqr107_set_tunable, + .suspend =3D aqr107_suspend, + .resume =3D aqr107_resume, + .get_sset_count =3D aqr107_get_sset_count, + .get_strings =3D aqr107_get_strings, + .get_stats =3D aqr107_get_stats, + .link_change_notify =3D aqr107_link_change_notify, +}; + +static struct phy_driver aqr_driver[] =3D { +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), + .name =3D "Aquantia AQ1202", + .ops =3D &aqr106_ops, }, { - PHY_ID_MATCH_MODEL(PHY_ID_AQR111), - .name =3D "Aquantia AQR111", + PHY_ID_MATCH_MODEL(PHY_ID_AQ2104), + .name =3D "Aquantia AQ2104", + .ops =3D &aqr106_ops, +}, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR105), + .name =3D "Aquantia AQR105", .ops =3D &(const struct phy_driver_ops){ - .probe =3D aqr107_probe, - .get_rate_matching =3D aqr107_get_rate_matching, - .config_init =3D aqr111_config_init, .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, - .read_status =3D aqr107_read_status, - .get_tunable =3D aqr107_get_tunable, - .set_tunable =3D aqr107_set_tunable, + .read_status =3D aqr_read_status, .suspend =3D aqr107_suspend, .resume =3D aqr107_resume, - .get_sset_count =3D aqr107_get_sset_count, - .get_strings =3D aqr107_get_strings, - .get_stats =3D aqr107_get_stats, - .link_change_notify =3D aqr107_link_change_notify, }, }, { - PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0), - .name =3D "Aquantia AQR111B0", + PHY_ID_MATCH_MODEL(PHY_ID_AQR106), + .name =3D "Aquantia AQR106", + .ops =3D &aqr106_ops, +}, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR107), + .name =3D "Aquantia AQR107", + .ops =3D &aqr107_ops, +}, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), + .name =3D "Aquantia AQCS109", .ops =3D &(const struct phy_driver_ops){ .probe =3D aqr107_probe, .get_rate_matching =3D aqr107_get_rate_matching, - .config_init =3D aqr111_config_init, + .config_init =3D aqcs109_config_init, .config_aneg =3D aqr_config_aneg, .config_intr =3D aqr_config_intr, .handle_interrupt =3D aqr_handle_interrupt, @@ -895,97 +883,40 @@ static struct phy_driver aqr_driver[] =3D { .link_change_notify =3D aqr107_link_change_notify, }, }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR111), + .name =3D "Aquantia AQR111", + .ops =3D &aqr111_ops, +}, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0), + .name =3D "Aquantia AQR111B0", + .ops =3D &aqr111_ops, +}, { PHY_ID_MATCH_MODEL(PHY_ID_AQR405), .name =3D "Aquantia AQR405", - .ops =3D &(const struct phy_driver_ops){ - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .read_status =3D aqr_read_status, - }, + .ops =3D &aqr106_ops, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR112), .name =3D "Aquantia AQR112", - .ops =3D &(const struct phy_driver_ops){ - .probe =3D aqr107_probe, - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .get_tunable =3D aqr107_get_tunable, - .set_tunable =3D aqr107_set_tunable, - .suspend =3D aqr107_suspend, - .resume =3D aqr107_resume, - .read_status =3D aqr107_read_status, - .get_rate_matching =3D aqr107_get_rate_matching, - .get_sset_count =3D aqr107_get_sset_count, - .get_strings =3D aqr107_get_strings, - .get_stats =3D aqr107_get_stats, - .link_change_notify =3D aqr107_link_change_notify, - }, + .ops =3D &aqr107_ops, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name =3D "Aquantia AQR412", - .ops =3D &(const struct phy_driver_ops){ - .probe =3D aqr107_probe, - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .get_tunable =3D aqr107_get_tunable, - .set_tunable =3D aqr107_set_tunable, - .suspend =3D aqr107_suspend, - .resume =3D aqr107_resume, - .read_status =3D aqr107_read_status, - .get_rate_matching =3D aqr107_get_rate_matching, - .get_sset_count =3D aqr107_get_sset_count, - .get_strings =3D aqr107_get_strings, - .get_stats =3D aqr107_get_stats, - .link_change_notify =3D aqr107_link_change_notify, - }, + .ops =3D &aqr107_ops, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113), .name =3D "Aquantia AQR113", - .ops =3D &(const struct phy_driver_ops){ - .probe =3D aqr107_probe, - .get_rate_matching =3D aqr107_get_rate_matching, - .config_init =3D aqr113c_config_init, - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .read_status =3D aqr107_read_status, - .get_tunable =3D aqr107_get_tunable, - .set_tunable =3D aqr107_set_tunable, - .suspend =3D aqr107_suspend, - .resume =3D aqr107_resume, - .get_sset_count =3D aqr107_get_sset_count, - .get_strings =3D aqr107_get_strings, - .get_stats =3D aqr107_get_stats, - .link_change_notify =3D aqr107_link_change_notify, - }, + .ops =3D &aqr113_ops, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), .name =3D "Aquantia AQR113C", - .ops =3D &(const struct phy_driver_ops){ - .probe =3D aqr107_probe, - .get_rate_matching =3D aqr107_get_rate_matching, - .config_init =3D aqr113c_config_init, - .config_aneg =3D aqr_config_aneg, - .config_intr =3D aqr_config_intr, - .handle_interrupt =3D aqr_handle_interrupt, - .read_status =3D aqr107_read_status, - .get_tunable =3D aqr107_get_tunable, - .set_tunable =3D aqr107_set_tunable, - .suspend =3D aqr107_suspend, - .resume =3D aqr107_resume, - .get_sset_count =3D aqr107_get_sset_count, - .get_strings =3D aqr107_get_strings, - .get_stats =3D aqr107_get_stats, - .link_change_notify =3D aqr107_link_change_notify, - }, + .ops =3D &aqr113_ops, }, }; =20 --=20 2.43.0 From nobody Thu Nov 14 04:44:16 2024 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 EC0E01E863; Sat, 17 Feb 2024 19:41:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198899; cv=none; b=hJmdel5d74sSCVO6rkP/Tyq+lMHtq+TnkuQWzYPaLbJzDZPh5oUoiUMdFKg+xn6ekV3vb23nMXvxoDpu6sp1b8NxZBfmBBSChVFksTwwOxpvKM8n0fMEU68GkEVSIz3bkVs7g4dl5+Mym7Z+/eEWdVZ10xHL7xm+gjUqJZGjsbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198899; c=relaxed/simple; bh=7l+4WmcZhRm+cQXIUxCvDteAB3XdXH5QXlynCwU1qq4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G2MQAmKUGMz0sTWd19itI3fvEEAPTZ2s2c8wDguqbWBUseYmkSDlnvqUhcQlgCzeSRG5JaaLRVR0M4jBjlh+mSc2B44jYK7N8w2Ng4c0y2YrLslvwUr0l953e90/I0+Nt5mtJx6shCTgOCb47wYLYlTaDLbckTFoZoyNJr5GtlE= 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=Zp65E9yj; arc=none smtp.client-ip=209.85.221.51 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zp65E9yj" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33d38c9f227so131153f8f.0; Sat, 17 Feb 2024 11:41:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708198896; x=1708803696; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pEGqx9swrd2Efs0TPhy/y31ToK5jrlVR+4ffHyJyKoM=; b=Zp65E9yjSzzfs9w0zqjXmFpPWIvc6ryOatypdrsonRJR8xzP10at40ET5L4abUVbip Q5Oq6mGG1AB5Ivs+z1nWljfWl75YZe/cPsg3P6FSUnt4xLzcJ7mGC9wsGdoIKTzN4ao8 WnW4VMAPXZMzwX2zTpHHXMaKkSRl2ZbTm+CG/EooUOZjsa2JsaQQ4aPQ/Sys5WD24rxv NOaxH1G/oEKUnfWSwZZtlWXlcS5Te7Kf27E3JamM40gzY6eAqpf1DSi3eSUAE+R+47if GgJ+aYLCuZAFXRgsL3pMCT1aB1yqrE27MPsLgi2SgmQfXMtbVNHkme9vR3cVQbL7nSB/ HSKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708198896; x=1708803696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pEGqx9swrd2Efs0TPhy/y31ToK5jrlVR+4ffHyJyKoM=; b=F3+kFpmEciEekOs6s9gOiPheI+tyPDZ89LS/oRUnG/7KGNxAM9tXda484CLaPGSrvp TY2tF6peNFKhiZYGA1p9sGneGG7rg5NtyhjkcUy6ooqvyo1LLtDUcRuAtKGYCnDFJ9Qo N+LtM8R6gn/tqOMb4HpjJPU/I7lvPxGjJrcmdit4f8I3lBHNJWbKTScZV+7BuegN4HCc Qp0SgYWebjEvsyQWVgccv9Chyf5FtGaH/Mvll88BlQDXVTgu2Bsv1ddDiJ79weV1RiFj jXY6Urvc2tDhdf0rB3QIDbIYDjGqejLB6z6G8fYgzBkaY5vr5bR32m3bbFLverayWwVK KzEw== X-Forwarded-Encrypted: i=1; AJvYcCXp8LPm0Z4WYw1D9A9I3rWSpJ0eSL4pAu+rgRRcAwZBKsy3PXvoOzfy84VwZG1Dz+4YqdPZJLZowAcUMt8zWE0CkgilTeQ8qkTTXhV1YKGk8xHpeMj5rOJ09+kqeBdHv/UVeK4SriwGuZDKeKWi7zF2CxGYV2cnpC0z6OnVUCS9cQD0wlHmxqSfXldd8rSCGnvJD8CBtUxmrK3cFx37QAB+eONu X-Gm-Message-State: AOJu0YxBcpWulFPGNA+wvTPXbTXwmbGzj1zQZb46cvdwBYAVSwBpDD2s T5M2v+MH6mdM6Xa/obhlWEayaSuNEdf+5ixN/hOGTTjS+3TVnunV X-Google-Smtp-Source: AGHT+IHTBfuLFBgxYDXyAEdhLvoS/uyVjXtTiqArx5lwkdOqMzfSKqV8T9BR5k1vk63E8j+lc/Nsdg== X-Received: by 2002:a05:6000:105:b0:33d:39bb:a350 with SMTP id o5-20020a056000010500b0033d39bba350mr736402wrx.59.1708198896316; Sat, 17 Feb 2024 11:41:36 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id b10-20020a5d40ca000000b0033ceca3a3dbsm5661169wrq.2.2024.02.17.11.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 11:41:35 -0800 (PST) From: Christian Marangi To: Michael Hennerich , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Richard Cochran , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Daniel Golle , Qingfang Deng , SkyLake Huang , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Arun Ramadoss , UNGLinuxDriver@microchip.com, Peter Geis , Frank , Xu Liang , Piergiorgio Beruto , Andrei Botila , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Michal Simek , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Vladimir Oltean , David Epping , Harini Katakam , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, rust-for-linux@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 3/3] net: phy: bcm7xxx: use common OPs for PHYs where possible Date: Sat, 17 Feb 2024 20:41:14 +0100 Message-ID: <20240217194116.8565-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240217194116.8565-1-ansuelsmth@gmail.com> References: <20240217194116.8565-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Group common OPs for PHY, make them static and reference these statically link OPs table instead of duplicating them for each PHY. Signed-off-by: Christian Marangi --- drivers/net/phy/bcm7xxx.c | 80 +++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c index c820a94b30a4..adfe364846dd 100644 --- a/drivers/net/phy/bcm7xxx.c +++ b/drivers/net/phy/bcm7xxx.c @@ -840,6 +840,17 @@ static int bcm7xxx_28nm_probe(struct phy_device *phyde= v) return ret; } =20 +static const struct phy_driver_ops bcm7xxx_28nm_gpy_ops =3D { + .config_init =3D bcm7xxx_28nm_config_init, + .resume =3D bcm7xxx_28nm_resume, + .get_tunable =3D bcm7xxx_28nm_get_tunable, + .set_tunable =3D bcm7xxx_28nm_set_tunable, + .get_sset_count =3D bcm_phy_get_sset_count, + .get_strings =3D bcm_phy_get_strings, + .get_stats =3D bcm7xxx_28nm_get_phy_stats, + .probe =3D bcm7xxx_28nm_probe, +}; + #define BCM7XXX_28NM_GPHY(_oui, _name) \ { \ .phy_id =3D (_oui), \ @@ -847,18 +858,20 @@ static int bcm7xxx_28nm_probe(struct phy_device *phyd= ev) .name =3D _name, \ /* PHY_GBIT_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ - .ops =3D &(const struct phy_driver_ops){ \ - .config_init =3D bcm7xxx_28nm_config_init, \ - .resume =3D bcm7xxx_28nm_resume, \ - .get_tunable =3D bcm7xxx_28nm_get_tunable, \ - .set_tunable =3D bcm7xxx_28nm_set_tunable, \ - .get_sset_count =3D bcm_phy_get_sset_count, \ - .get_strings =3D bcm_phy_get_strings, \ - .get_stats =3D bcm7xxx_28nm_get_phy_stats, \ - .probe =3D bcm7xxx_28nm_probe, \ - }, \ + .ops =3D &bcm7xxx_28nm_gpy_ops, \ } =20 +static const struct phy_driver_ops bcm7xxx_28nm_ephy_ops =3D { + .config_init =3D bcm7xxx_28nm_ephy_config_init, + .resume =3D bcm7xxx_28nm_ephy_resume, + .get_sset_count =3D bcm_phy_get_sset_count, + .get_strings =3D bcm_phy_get_strings, + .get_stats =3D bcm7xxx_28nm_get_phy_stats, + .probe =3D bcm7xxx_28nm_probe, + .read_mmd =3D bcm7xxx_28nm_ephy_read_mmd, + .write_mmd =3D bcm7xxx_28nm_ephy_write_mmd, +}; + #define BCM7XXX_28NM_EPHY(_oui, _name) \ { \ .phy_id =3D (_oui), \ @@ -866,18 +879,16 @@ static int bcm7xxx_28nm_probe(struct phy_device *phyd= ev) .name =3D _name, \ /* PHY_BASIC_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ - .ops =3D &(const struct phy_driver_ops){ \ - .config_init =3D bcm7xxx_28nm_ephy_config_init, \ - .resume =3D bcm7xxx_28nm_ephy_resume, \ - .get_sset_count =3D bcm_phy_get_sset_count, \ - .get_strings =3D bcm_phy_get_strings, \ - .get_stats =3D bcm7xxx_28nm_get_phy_stats, \ - .probe =3D bcm7xxx_28nm_probe, \ - .read_mmd =3D bcm7xxx_28nm_ephy_read_mmd, \ - .write_mmd =3D bcm7xxx_28nm_ephy_write_mmd, \ - }, \ + .ops =3D &bcm7xxx_28nm_ephy_ops, \ } =20 +static const struct phy_driver_ops bcm7xxx_40nm_ephy_ops =3D { + .soft_reset =3D genphy_soft_reset, + .config_init =3D bcm7xxx_config_init, + .suspend =3D bcm7xxx_suspend, + .resume =3D bcm7xxx_config_init, +}; + #define BCM7XXX_40NM_EPHY(_oui, _name) \ { \ .phy_id =3D (_oui), \ @@ -885,14 +896,20 @@ static int bcm7xxx_28nm_probe(struct phy_device *phyd= ev) .name =3D _name, \ /* PHY_BASIC_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ - .ops =3D &(const struct phy_driver_ops){ \ - .soft_reset =3D genphy_soft_reset, \ - .config_init =3D bcm7xxx_config_init, \ - .suspend =3D bcm7xxx_suspend, \ - .resume =3D bcm7xxx_config_init, \ - }, \ + .ops =3D &bcm7xxx_40nm_ephy_ops, \ } =20 +static const struct phy_driver_ops bcm7xxx_16nm_ephy_ops =3D { + .get_sset_count =3D bcm_phy_get_sset_count, + .get_strings =3D bcm_phy_get_strings, + .get_stats =3D bcm7xxx_28nm_get_phy_stats, + .probe =3D bcm7xxx_28nm_probe, + .config_init =3D bcm7xxx_16nm_ephy_config_init, + .config_aneg =3D genphy_config_aneg, + .read_status =3D genphy_read_status, + .resume =3D bcm7xxx_16nm_ephy_resume, +}; + #define BCM7XXX_16NM_EPHY(_oui, _name) \ { \ .phy_id =3D (_oui), \ @@ -900,16 +917,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phyde= v) .name =3D _name, \ /* PHY_BASIC_FEATURES */ \ .flags =3D PHY_IS_INTERNAL, \ - .ops =3D &(const struct phy_driver_ops){ \ - .get_sset_count =3D bcm_phy_get_sset_count, \ - .get_strings =3D bcm_phy_get_strings, \ - .get_stats =3D bcm7xxx_28nm_get_phy_stats, \ - .probe =3D bcm7xxx_28nm_probe, \ - .config_init =3D bcm7xxx_16nm_ephy_config_init, \ - .config_aneg =3D genphy_config_aneg, \ - .read_status =3D genphy_read_status, \ - .resume =3D bcm7xxx_16nm_ephy_resume, \ - }, \ + .ops =3D &bcm7xxx_16nm_ephy_ops, \ } =20 static struct phy_driver bcm7xxx_driver[] =3D { --=20 2.43.0