From patchwork Thu May 27 20:45:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 449311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E0C3C47089 for ; Thu, 27 May 2021 20:45:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6AD5613E2 for ; Thu, 27 May 2021 20:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235760AbhE0UrR (ORCPT ); Thu, 27 May 2021 16:47:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235379AbhE0UrQ (ORCPT ); Thu, 27 May 2021 16:47:16 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1606FC061760 for ; Thu, 27 May 2021 13:45:42 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id e24so2274995eds.11 for ; Thu, 27 May 2021 13:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nkiW4cgqcNA2wnsGokaWDqLEeknOpooJwCUovxh3/t0=; b=Z4oTJB5Y74wha5BkSsO7Ho0Udg0OuV7TlLRz/9wZZ1TLuBpkCD3K7yFSKzB4NNmBI8 Gu3LzaUkgsjBf001vHgVrrddG6liaV/R9IepZFN/5j4ICE8LuVAhIwK2rQW0SqaMmp3t gPsynwyX2DaqlqJ2D20/DkF96P6HT9i0JS8IaMil86Is8v0Dww4Q1s11naTj+/kQ2SEn T3CCO9c+JjDNkZ1LfUE89bUenZv4XKoB89xBFwDPsdqHkqxgazi35qiv0SU7+rViw9e2 rsD/I+xB52ODKE7BGkAPfTNR+UbRoKcHy8K2GEnVJGs6knvhOUCRn1jGq0p89z3jk4uJ cpsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nkiW4cgqcNA2wnsGokaWDqLEeknOpooJwCUovxh3/t0=; b=UhlfOK2YkVRllEQD45IpR7/ZaYHi5C9EA5uJsYkWyRaBGDZhVbvNCyjvZHdD9cMvIi xvgPOr9w71rHWANmlTOy01NlXs+6ayKK9zrECKb/W81nyCfUavWXMWV3J5XaFk9TCjyG dU1g+BvTtxaLXbZt5ITqBdobqB0YCQeIZG39QxfnUWOZYoNs6DfzH3dZ8AjjQPn6pPhi OUGJ/yUPUggPWfNfOhVJ0TCwQMoYafOVSMfV6FsNdXNMAllCQUrE3PIPlzQ1q3eb6/iQ VgRbVOqRJHT3bW3rhxksmokBU5RnYfoHMOkr3T57Z4AhJ94oFtHsdwrl4UAR1kPFtg1s Ag7g== X-Gm-Message-State: AOAM531ynFOFVvhVL6nuULyMTXOhl7nhj/YulnguyNcNBx4wLNPJUA0K 18UIR2CJnZPmuSFW+7hxPRc= X-Google-Smtp-Source: ABdhPJyYByVl7G+keupLijkhy1dJY61aYv505FjG03VqtvoMIxDHTl0kXTm+v+je5fEhmwUVW5zeNg== X-Received: by 2002:a05:6402:14d2:: with SMTP id f18mr6478692edx.259.1622148339318; Thu, 27 May 2021 13:45:39 -0700 (PDT) Received: from localhost.localdomain ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id g11sm1654145edt.85.2021.05.27.13.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 13:45:39 -0700 (PDT) From: Vladimir Oltean To: Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Heiner Kallweit , Russell King - ARM Linux admin , Florian Fainelli , Andrew Lunn , Ong Boon Leong , Michael Sit Wei Hong , Vladimir Oltean Subject: [RFC PATCH net-next 1/8] net: pcs: xpcs: delete shim definition for mdio_xpcs_get_ops() Date: Thu, 27 May 2021 23:45:21 +0300 Message-Id: <20210527204528.3490126-2-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527204528.3490126-1-olteanv@gmail.com> References: <20210527204528.3490126-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean CONFIG_STMMAC_ETH selects CONFIG_PCS_XPCS, so there should be no situation where the shim should be needed. Signed-off-by: Vladimir Oltean --- include/linux/pcs/pcs-xpcs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index 5938ced805f4..c4d0a2c469c7 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -36,13 +36,6 @@ struct mdio_xpcs_ops { int enable); }; -#if IS_ENABLED(CONFIG_PCS_XPCS) struct mdio_xpcs_ops *mdio_xpcs_get_ops(void); -#else -static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void) -{ - return NULL; -} -#endif #endif /* __LINUX_PCS_XPCS_H */ From patchwork Thu May 27 20:45:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 449310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C781BC4708A for ; Thu, 27 May 2021 20:45:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5B71611C2 for ; Thu, 27 May 2021 20:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235871AbhE0UrV (ORCPT ); Thu, 27 May 2021 16:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235792AbhE0UrS (ORCPT ); Thu, 27 May 2021 16:47:18 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1142BC061761 for ; Thu, 27 May 2021 13:45:43 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id g7so2368626edm.4 for ; Thu, 27 May 2021 13:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f3LXLy0RxWR9HBLo60bQO4krGpz/yZL++bJpVi6moh0=; b=KiLH/RjHXRiudeeWLmGLxFfwwNxpuUr5Xg+9fX+b6oAuvBFQJUob5llvDqNsO8F2Up WDo/E9PUS3HR6u7lWfj/jzJGy2K0k2JjAoAoN5PqADtksUgo8vPS23fqMYDqp5JVzT0P IdWPee2Hu1bQGj2kOmsh2XQKqjw1RrzgggMoSnIrnRKLmJdYyOb0KeMqjslFArrtwfoB /fYvIedoR7M1qw7Ig8NAA34bK0HxLktMZUvQlBYUxF95eqZNJ+WgOVhU/Nt8ZAmEsQxY BywgYgnS3ESkETO2UeWLb1qjE0D6LIBNDNPskNXIDL70APf7WXs8XArqztUX4izP/20G ctaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f3LXLy0RxWR9HBLo60bQO4krGpz/yZL++bJpVi6moh0=; b=mwU6SaC6/8GK5IqeUx8nUl0zLHd97wukKS7VrjD5uCojhnOpsk/aDj5OVckoGxbmn8 STP4MQVYjs33sGVgeidoHCppGNArD/eESIBhBQ+38apeeeRK15sV0X04VnrvZcsfiKGg Oye+TvTZw4MAiw4q7QZNo95HWiVPgsV9Ue0idp/WHZjKZjradm/WTlaGYRfM1BtRT2wQ gcAmX1gQKoWinrEi6aT4mPE7OXZQkwJn7cG354eYEdsSmD7mb0wz0DkFUjTjYf2avhik iyaEQuI8/aZimt/JyPx1RM4hbj3dFa3yxFslDiSfWgHlI4F1lpdRkmYyds8e1KGphCZD DCtA== X-Gm-Message-State: AOAM532RXH4/qCdHJm7jfN0cSyTQF8lB47Z/VCm1eeCGKQdxbcyzpLIs W7AsPdQgvot3oWZAZ7277/4= X-Google-Smtp-Source: ABdhPJyIXKzYSMGSj4uJEl5i4yOI3WEVbysDrGcHEearUs0F0rTLxkFbpHTqTRnICFLMpmTQEkRtdw== X-Received: by 2002:a05:6402:5174:: with SMTP id d20mr6443295ede.248.1622148341586; Thu, 27 May 2021 13:45:41 -0700 (PDT) Received: from localhost.localdomain ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id g11sm1654145edt.85.2021.05.27.13.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 13:45:41 -0700 (PDT) From: Vladimir Oltean To: Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Heiner Kallweit , Russell King - ARM Linux admin , Florian Fainelli , Andrew Lunn , Ong Boon Leong , Michael Sit Wei Hong , Vladimir Oltean Subject: [RFC PATCH net-next 3/8] net: pcs: xpcs: export xpcs_validate Date: Thu, 27 May 2021 23:45:23 +0300 Message-Id: <20210527204528.3490126-4-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527204528.3490126-1-olteanv@gmail.com> References: <20210527204528.3490126-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean Calling a function pointer with a single implementation through struct mdio_xpcs_ops is clunky, and the stmmac_do_callback system forces this to return int, even though it always returns zero. Simply remove the "validate" function pointer from struct mdio_xpcs_ops and replace it with an exported xpcs_validate symbol which is called directly by stmmac. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 -- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- drivers/net/pcs/pcs-xpcs.c | 10 ++++------ include/linux/pcs/pcs-xpcs.h | 5 ++--- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 75a8b90c202a..a86b358feae9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -613,8 +613,6 @@ struct stmmac_mmc_ops { stmmac_do_void_callback(__priv, mmc, read, __args) /* XPCS callbacks */ -#define stmmac_xpcs_validate(__priv, __args...) \ - stmmac_do_callback(__priv, xpcs, validate, __args) #define stmmac_xpcs_config(__priv, __args...) \ stmmac_do_callback(__priv, xpcs, config, __args) #define stmmac_xpcs_get_state(__priv, __args...) \ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index bf9fe25fed69..d3d85d36e177 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -996,7 +996,7 @@ static void stmmac_validate(struct phylink_config *config, linkmode_andnot(state->advertising, state->advertising, mask); /* If PCS is supported, check which modes it supports. */ - stmmac_xpcs_validate(priv, &priv->hw->xpcs_args, supported, state); + xpcs_validate(&priv->hw->xpcs_args, supported, state); } static void stmmac_mac_pcs_get_state(struct phylink_config *config, diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 71efd5ef69e5..4c0093473470 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -658,9 +658,8 @@ static void xpcs_resolve_pma(struct mdio_xpcs_args *xpcs, } } -static int xpcs_validate(struct mdio_xpcs_args *xpcs, - unsigned long *supported, - struct phylink_link_state *state) +void xpcs_validate(struct mdio_xpcs_args *xpcs, unsigned long *supported, + struct phylink_link_state *state) { bool valid_interface; @@ -683,13 +682,13 @@ static int xpcs_validate(struct mdio_xpcs_args *xpcs, if (!valid_interface) { bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); - return 0; + return; } linkmode_and(supported, supported, xpcs->supported); linkmode_and(state->advertising, state->advertising, xpcs->supported); - return 0; } +EXPORT_SYMBOL_GPL(xpcs_validate); static int xpcs_config_eee(struct mdio_xpcs_args *xpcs, int mult_fact_100ns, int enable) @@ -958,7 +957,6 @@ static int xpcs_probe(struct mdio_xpcs_args *xpcs) } static struct mdio_xpcs_ops xpcs_ops = { - .validate = xpcs_validate, .config = xpcs_config, .get_state = xpcs_get_state, .link_up = xpcs_link_up, diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index e48636a1a078..56755b7895a0 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -25,9 +25,6 @@ struct mdio_xpcs_args { }; struct mdio_xpcs_ops { - int (*validate)(struct mdio_xpcs_args *xpcs, - unsigned long *supported, - struct phylink_link_state *state); int (*config)(struct mdio_xpcs_args *xpcs, const struct phylink_link_state *state); int (*get_state)(struct mdio_xpcs_args *xpcs, @@ -40,5 +37,7 @@ struct mdio_xpcs_ops { }; struct mdio_xpcs_ops *mdio_xpcs_get_ops(void); +void xpcs_validate(struct mdio_xpcs_args *xpcs, unsigned long *supported, + struct phylink_link_state *state); #endif /* __LINUX_PCS_XPCS_H */ From patchwork Thu May 27 20:45:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 449309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6622EC47089 for ; Thu, 27 May 2021 20:45:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BC88613E2 for ; Thu, 27 May 2021 20:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236267AbhE0UrZ (ORCPT ); Thu, 27 May 2021 16:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235897AbhE0UrU (ORCPT ); Thu, 27 May 2021 16:47:20 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BC9FC061574 for ; Thu, 27 May 2021 13:45:45 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id z12so2240942ejw.0 for ; Thu, 27 May 2021 13:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zZrJAKistV6Q/B1No+cwqeXn71UQaxifsVS30S0BqGc=; b=ITvqgLUehzvzHiGeOl+5fnFIzos2/qmnGjfPbnG8+p/wky2ysQaYXYNy64+FB/YZU5 /O5EEaNmz20SheYA1aRRy38s+cICgFYAn1Ye3aUAIxzLsYCaY1HzKrZ3ozuqgxrGtsia JC5ZZfBPZvqhF1UqtKKuliyWIVeZk4UjlNb6IAm4gcfYJ9BNQq141qpA2LEmLOTab4kn gEwAG8Jdj0FaYVTjvv2d/d4Qmm8ySFklofTBR8DXMe23eY5eXYpiR4pGqhZZUs4lVeYD DM5Yza984EVEt5u4PUzn4GU7ZhHTsG/oWFqX7SUPj28MUMYV/NnH+SPuJpgEWtp62iL5 mi2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zZrJAKistV6Q/B1No+cwqeXn71UQaxifsVS30S0BqGc=; b=RcMmbJ/lk6mxR/5zW3w+1GIgpA99TuPqsj0nH1jGuVwah47n7J2rpTtWme0q0CDU39 kuH2pVV/ZNR5kXfOx1UMXnP3ULRx78EG7xkZHYlQOVlOn8oyAo3OnJw3B56scYSbeDNv +7TH0dQkzMGbJ4Q3DCe9+xke4C6cR8Q1ZBwKofxwzQKYKEfG6ulpkPTQbscVPycpmQ/I ZYbNE69K3VHdqtVg7A8mrW03Tc5n8ius4GZ5qUb2aMuMYYgmLSQxklm4OWz89+LXe3FH 82ROarTsnCJfxStw1wWme/FEBq/v7eWjTfj8nFbTSBQnsgP++/op2AyniwlSyKFxnjUu 4dgw== X-Gm-Message-State: AOAM531P8/W/jhEOZlwGCDdINZRIS1RKoPuqHzM/AkOetXpA9L/qVAT8 fu9wbqSP5GXQIQjM1h6KAmA= X-Google-Smtp-Source: ABdhPJxG1VMm5zuLTYuodIHjZWmyjo9fpn5BVeMzcpRjiy0YewA3eEewNwmswLOyX3pPNvaQWdvtLQ== X-Received: by 2002:a17:906:5448:: with SMTP id d8mr5889849ejp.248.1622148343944; Thu, 27 May 2021 13:45:43 -0700 (PDT) Received: from localhost.localdomain ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id g11sm1654145edt.85.2021.05.27.13.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 13:45:43 -0700 (PDT) From: Vladimir Oltean To: Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Heiner Kallweit , Russell King - ARM Linux admin , Florian Fainelli , Andrew Lunn , Ong Boon Leong , Michael Sit Wei Hong , Vladimir Oltean Subject: [RFC PATCH net-next 5/8] net: pcs: xpcs: export xpcs_probe Date: Thu, 27 May 2021 23:45:25 +0300 Message-Id: <20210527204528.3490126-6-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527204528.3490126-1-olteanv@gmail.com> References: <20210527204528.3490126-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean Similar to the other recently functions, it is not necessary for xpcs_probe to be a function pointer, so export it so that it can be called directly. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 -- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +- drivers/net/pcs/pcs-xpcs.c | 4 ++-- include/linux/pcs/pcs-xpcs.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 2d2843edaf21..5014b260844b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -619,8 +619,6 @@ struct stmmac_mmc_ops { stmmac_do_callback(__priv, xpcs, get_state, __args) #define stmmac_xpcs_link_up(__priv, __args...) \ stmmac_do_callback(__priv, xpcs, link_up, __args) -#define stmmac_xpcs_probe(__priv, __args...) \ - stmmac_do_callback(__priv, xpcs, probe, __args) struct stmmac_regs_off { u32 ptp_off; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index d12dfa60b8ea..2af83d902ea1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -522,7 +522,7 @@ int stmmac_mdio_register(struct net_device *ndev) for (addr = 0; addr < max_addr; addr++) { xpcs->addr = addr; - ret = stmmac_xpcs_probe(priv, xpcs); + ret = xpcs_probe(xpcs); if (!ret) { found = 1; break; diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index a7851a8a219b..4063dcc0f767 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -934,7 +934,7 @@ static u32 xpcs_get_id(struct mdio_xpcs_args *xpcs) return 0xffffffff; } -static int xpcs_probe(struct mdio_xpcs_args *xpcs) +int xpcs_probe(struct mdio_xpcs_args *xpcs) { u32 xpcs_id = xpcs_get_id(xpcs); int i; @@ -956,12 +956,12 @@ static int xpcs_probe(struct mdio_xpcs_args *xpcs) return -ENODEV; } +EXPORT_SYMBOL_GPL(xpcs_probe); static struct mdio_xpcs_ops xpcs_ops = { .config = xpcs_config, .get_state = xpcs_get_state, .link_up = xpcs_link_up, - .probe = xpcs_probe, }; struct mdio_xpcs_ops *mdio_xpcs_get_ops(void) diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index 203aafae9166..11585fa093cd 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -31,7 +31,6 @@ struct mdio_xpcs_ops { struct phylink_link_state *state); int (*link_up)(struct mdio_xpcs_args *xpcs, int speed, phy_interface_t interface); - int (*probe)(struct mdio_xpcs_args *xpcs); }; struct mdio_xpcs_ops *mdio_xpcs_get_ops(void); @@ -39,5 +38,6 @@ void xpcs_validate(struct mdio_xpcs_args *xpcs, unsigned long *supported, struct phylink_link_state *state); int xpcs_config_eee(struct mdio_xpcs_args *xpcs, int mult_fact_100ns, int enable); +int xpcs_probe(struct mdio_xpcs_args *xpcs); #endif /* __LINUX_PCS_XPCS_H */ From patchwork Thu May 27 20:45:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 449308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C807C47089 for ; Thu, 27 May 2021 20:45:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C744613E6 for ; Thu, 27 May 2021 20:45:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236370AbhE0Urb (ORCPT ); Thu, 27 May 2021 16:47:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236052AbhE0UrW (ORCPT ); Thu, 27 May 2021 16:47:22 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0658C061574 for ; Thu, 27 May 2021 13:45:47 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id lg14so2095607ejb.9 for ; Thu, 27 May 2021 13:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KV4L5yPhusQwpn3Ky/Es1VhkJTPcXPa1gVI8rTgpDUo=; b=kPIa6phvPga725lveo2klEzb2aTPZvqSpOsgveBoV9Xo3y+MN8c8CoLCjpizrCTEvl YR01OWr4byDPtrF0Ht8N9wcJplkuC+OAgcPaQDueaN9M/HVBQ3dNCa/CtiDYfaAC0KSN fjSy4l9brDiLydNK79B1V8QqIfHe2oj9JwD6R+Gaypwo6zCe5sqRT/z6Sc7C5V6iSNYC pVmeSb8Zm1FxcjI7fxmC1af5621awz5M5yQ55Ba4P5aM+sDKr7f0BZ9xoXOu24czztEn tkS3HKX/DAEGjzgL8T10jJZb7T2VLxWuPuwDFVcSqbpDqYiWMowAW6uw621q1gzdhBEP Sx+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KV4L5yPhusQwpn3Ky/Es1VhkJTPcXPa1gVI8rTgpDUo=; b=Qz3PYIIPf59gM95KzN7ZRXJt739EOo6QAnS6fuXxAApmKv9jeDu3uygBLJi+y33z55 J3st6kBXOEJF6t5nIV4pgNLEQP4eyowUniFGXhUBwhXZ9ZA58TSTv2Am+LsPO8QREqEG T+Fns8nqClmtitIWTjtuX+xibeMp4eSzC6ypXpFCp3a80RXJapGBaWi704EqQyUuD4I5 /boWTjteXD+JdmpkBzpBQeaCBxcd83Qow6SI3z83YL3Qku9MXgpvxElFwiMwDloiFcKS v0QDlgaEwP+8FtG123ceFollyGKf2lIGGH2tXeD+3eiJdMCCWqTj0/7ie1yeSYwWzmoq 1jWQ== X-Gm-Message-State: AOAM530WagRQDl/iEVWO5xmsuog8P3NPG/PNORZL8xzCdsbopXFIXRIn t8qBqxPzGPClYWtG0HEiOTluQQFE/HM= X-Google-Smtp-Source: ABdhPJyighIHBKIxUGuLn5Doa2pKyhAV/MO6ZrQ1hViVCcyxTeJaz3dZ049ovYGzaVEyn7Nt6FKYdw== X-Received: by 2002:a17:907:2d0c:: with SMTP id gs12mr5856037ejc.173.1622148346390; Thu, 27 May 2021 13:45:46 -0700 (PDT) Received: from localhost.localdomain ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id g11sm1654145edt.85.2021.05.27.13.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 13:45:46 -0700 (PDT) From: Vladimir Oltean To: Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Heiner Kallweit , Russell King - ARM Linux admin , Florian Fainelli , Andrew Lunn , Ong Boon Leong , Michael Sit Wei Hong , Vladimir Oltean Subject: [RFC PATCH net-next 7/8] net: pcs: xpcs: use mdiobus_c45_addr in xpcs_{read, write} Date: Thu, 27 May 2021 23:45:27 +0300 Message-Id: <20210527204528.3490126-8-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527204528.3490126-1-olteanv@gmail.com> References: <20210527204528.3490126-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean Use the dedicated helper for abstracting away how the clause 45 address is packed in reg_addr. Signed-off-by: Vladimir Oltean --- drivers/net/pcs/pcs-xpcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 288abe8ddaf3..e0a7e546f32b 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -220,14 +220,14 @@ static struct xpcs_id { static int xpcs_read(struct mdio_xpcs_args *xpcs, int dev, u32 reg) { - u32 reg_addr = MII_ADDR_C45 | dev << 16 | reg; + u32 reg_addr = mdiobus_c45_addr(dev, reg); return mdiobus_read(xpcs->bus, xpcs->addr, reg_addr); } static int xpcs_write(struct mdio_xpcs_args *xpcs, int dev, u32 reg, u16 val) { - u32 reg_addr = MII_ADDR_C45 | dev << 16 | reg; + u32 reg_addr = mdiobus_c45_addr(dev, reg); return mdiobus_write(xpcs->bus, xpcs->addr, reg_addr, val); }