From nobody Thu Nov 14 16:40:46 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