From patchwork Fri May 19 14:12:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1269464vqo; Fri, 19 May 2023 07:15:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73KKPgfRfcM/gmc9A5ihZW/08otPsE1CVM5xa3utF2W+TyPS9d6twpbEWI5edFMd1i6sg4 X-Received: by 2002:a05:6a00:21cf:b0:644:18ec:4510 with SMTP id t15-20020a056a0021cf00b0064418ec4510mr3598738pfj.9.1684505719704; Fri, 19 May 2023 07:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684505719; cv=none; d=google.com; s=arc-20160816; b=QX1pVBfiNXwsAHESXqoBU2O96TbSRvmmPB1VlotPZbJIPFU8lWBjNzp59Euys6QiIV WlUm/wXvB/ZQPIYdR/c0xVhzA2IBpKAIBNizGU0zwMulVxCJdrYXnQhRdqCQERXvaAxW vCJdmEYLH/z4ziQoUCw07XYYeFrv5+2yQWpSQp2/jFeZBatReuPpdU0Qn2/XnMXucRe3 6kBlHNfqVXbnBKNei4PQjOMWBc4f+HGg7p42wLpqQ8DFurTpxiHJtc377A/DuHdKP+bF cDP9eeIouJlaNWNWleuQkE62qJe+ZAt26K1a6O8qkWFpDNKQtAloeVQ9o0/WQMzBw0Jg Wa7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RbnRwa+V9iC7DR2jK0YOcpyWlvO4fLpqpNlnKGwZALk=; b=QV2x/cOtxzZUPMfNsa82tQbNRKUdpjuLXGwq28EExbAUM2YcwLXnnSTP2Oci93cjMn sz6tm6fdcwITFlzVRhhXE3sJwLLmyEOyfYsU/U1JCqTGuPdz/8TZhvNi7JD+HD96MsFK f3BXLXxBASPuyOENL76i5af6awvJXlQ2eh7Rza1EHRclPKvpVAk1a3z46reqfH37qxQm gSGj0UAPxXqmaHmr79vm93e6z0Ibyg2/eOK382L2fP0wkAI8NMC5DQom5TO9VMF+Yi+0 D3T+4rAxUybgfKT/rRDk6AdnpNsU4SBcPPsYefMzibKr+GL2Dh+Awbt6N5dsiV4l+RVm fZiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZGm68zV8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a63b40c000000b00518a1800624si3823799pgf.307.2023.05.19.07.15.03; Fri, 19 May 2023 07:15:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZGm68zV8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232080AbjESONN (ORCPT + 99 others); Fri, 19 May 2023 10:13:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbjESONG (ORCPT ); Fri, 19 May 2023 10:13:06 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D746A192; Fri, 19 May 2023 07:13:04 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id E1648E0018; Fri, 19 May 2023 14:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RbnRwa+V9iC7DR2jK0YOcpyWlvO4fLpqpNlnKGwZALk=; b=ZGm68zV8E4hlpG7EeqdCgsf8/g8ZH4dx0knLP4oAQIkggF7GFrJkjcFBr+aiY3Vjb9jF2X 2IttnsEYN0CSB5SNVBVGQdxer0lyJoaWC95EKRXo+FIszaAZRM1nJ0/36I66fsRAiQSsIv RJQNAvwDu3FjCuvdIIimmLSCDvbuGwDSojoTDINtOh833TKxBgqHWjC922WlumBan9Q0um PiphIjaroRsBw90R90UB2kCxz+ceyqC7kNnXnxKQJ+1+wJ28jFddJ0IxJH/dv1HZpbFoSg fux5FEqS/w85dYNLR8cwDoPcQr2WpYOvk1SrnjLEDjr0zuMR/Vlt2alVa4AywQ== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= Subject: [PATCH net-next v2 2/7] net: dsa: mv88e6xxx: pass directly chip structure to mv88e6xxx_phy_is_internal Date: Fri, 19 May 2023 16:12:58 +0200 Message-Id: <20230519141303.245235-3-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332269554792072?= X-GMAIL-MSGID: =?utf-8?q?1766332269554792072?= From: Alexis Lothoré Since this function is a simple helper, we do not need to pass a full dsa_switch structure, we can directly pass the mv88e6xxx_chip structure. Doing so will allow to share this function with any other function not manipulating dsa_switch structure but needing info about number of internal phys Signed-off-by: Alexis Lothoré Reviewed-by: Russell King (Oracle) Reviewed-by: Florian Fainelli --- drivers/net/dsa/mv88e6xxx/chip.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 64a2f2f83735..93bcfa5c80e1 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -463,10 +463,8 @@ static int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, return err; } -static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port) +static int mv88e6xxx_phy_is_internal(struct mv88e6xxx_chip *chip, int port) { - struct mv88e6xxx_chip *chip = ds->priv; - return port < chip->info->num_internal_phys; } @@ -584,7 +582,7 @@ static void mv88e6095_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100; - if (mv88e6xxx_phy_is_internal(chip->ds, port)) { + if (mv88e6xxx_phy_is_internal(chip, port)) { __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces); } else { if (cmode < ARRAY_SIZE(mv88e6185_phy_interface_modes) && @@ -832,7 +830,7 @@ static void mv88e6xxx_get_caps(struct dsa_switch *ds, int port, chip->info->ops->phylink_get_caps(chip, port, config); mv88e6xxx_reg_unlock(chip); - if (mv88e6xxx_phy_is_internal(ds, port)) { + if (mv88e6xxx_phy_is_internal(chip, port)) { __set_bit(PHY_INTERFACE_MODE_INTERNAL, config->supported_interfaces); /* Internal ports with no phy-mode need GMII for PHYLIB */ @@ -853,7 +851,7 @@ static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port, mv88e6xxx_reg_lock(chip); - if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(ds, port)) { + if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(chip, port)) { /* In inband mode, the link may come up at any time while the * link is not forced down. Force the link down while we * reconfigure the interface mode.