From patchwork Wed Jul 12 15:07:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 119246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1229098vqm; Wed, 12 Jul 2023 08:27:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlEmR5yVlrmydsdTMN6kAGNS9MV2AohTH/tkTqxeQJ5oFb0xY9dPc80jGDxUAqx3ZiBqkhbd X-Received: by 2002:a17:906:77da:b0:993:d7ff:afe7 with SMTP id m26-20020a17090677da00b00993d7ffafe7mr19158963ejn.13.1689175647094; Wed, 12 Jul 2023 08:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689175647; cv=none; d=google.com; s=arc-20160816; b=01X31b0p4U7N6xX66ScJ5u7lIM98FCgly27/8IpCQ6Lw9t5JbmKCaa6h3BeF+ZhOLl qvcvRzmgc8T+KIj/rAp2l4UAwdbQAUmMWU7OS3UUrtLuSlvdIo8RtVtd1zjU1GpUStdA Hbb61Hg3lw9PfOcV1YV2pltz5brylLY6wdvlP6HDAmOAdkBNsQ4XNjcUg1q5nXfjUxbe aU7CLamgeueNazUjJ2FcLU027UrBOCJcpl3RH97dRGBC+yi/CvOacL2+3LgcxmiKiuJv 3WQ0jYu5U3jNeWa2cmF91nFIsYE3ns4U2xZ87IQA1EBq67qwYwH0pu4GhfU/LtKSLv2g kosA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=OU7+4qsJlAMGD194fx1AaI3yHYu8KdEChrNhRSexvu0=; fh=iCOcDVYygcUt3nx67Q2pFMpkgstG/nFvtDYAC1AAD60=; b=kVHGn2ikU3o/FOXnNaVYwoLlS/yh+pZt2A3PBH12bbMEFo7FXjuEpn7/OSX4rnwM5u 8IOE2xQETvp4Oux6Amiv8xe9MyLAetTXtHr+yCzudQqYCluw7hU1nE5HTqS+DxYzeIb2 xH/3Oz9Qk6TBgVusdfMboJ9RtxVMzzxHkuhRiy6815pSZEZjYB+BBawrB80bWLc4K5rs 9xEu94ijR3SHfmoYJ0MMp80dmZOJHgQd6RhBr4tcZG9UXSr3tg4LazSplUWK48MalvI+ YHLE/1cl+aYW7Lu5Da1sQdzXFkFVyHoAiAVnC9ao3Vjz3HP2AUl84Ech1mvScZZ+Pbe6 PGzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oi9YDlwc; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gh16-20020a170906e09000b0099279210464si5058132ejb.420.2023.07.12.08.27.03; Wed, 12 Jul 2023 08:27:27 -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=@kernel.org header.s=k20201202 header.b=oi9YDlwc; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233291AbjGLPHl (ORCPT + 99 others); Wed, 12 Jul 2023 11:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233269AbjGLPHj (ORCPT ); Wed, 12 Jul 2023 11:07:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2015E74 for ; Wed, 12 Jul 2023 08:07:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 884D761853 for ; Wed, 12 Jul 2023 15:07:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0A58C433D9; Wed, 12 Jul 2023 15:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689174454; bh=6hu2QLAnatQP5UFKHqQxLipPsz8mKS6yWJMOvqrfh4E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oi9YDlwcTqrVxqhOw1EZZr9PArfNBsj2F7xdvu0hNxBS+lAeoSYV+yVW2SkbjXuJ9 ZJnTmXOAJffEds4stKmwQUKBJJcyNs70h0BlapfpbgY5pD1AJjN1xDNQXr1Kku+9+m auOKDvO9TbLw9TkKvY5TzgBK7NBJrZWU9zIZG7DFZkfIMpxm8Zzy/3UcucoiDBHo5X 5qNcGoh4zLdrErmwDnPVA+H/DYbdaG6VwkSiyrQToE9d/5aGcI7LcpplpauC2PZS+i nq2szRaVXz/UQU53cI4Vffdjg8b+M8Srm+/DE6dFL+kh5iwQ8jT3uyTTzczc/W+mBM s+gJJSuSDsjuw== From: Michael Walle Date: Wed, 12 Jul 2023 17:07:01 +0200 Subject: [PATCH net-next v3 01/11] net: phy: get rid of redundant is_c45 information MIME-Version: 1.0 Message-Id: <20230620-feature-c45-over-c22-v3-1-9eb37edf7be0@kernel.org> References: <20230620-feature-c45-over-c22-v3-0-9eb37edf7be0@kernel.org> In-Reply-To: <20230620-feature-c45-over-c22-v3-0-9eb37edf7be0@kernel.org> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yisen Zhuang , Salil Mehta , Florian Fainelli , Broadcom internal kernel review list , =?utf-8?q?Marek_Beh=C3=BAn?= , Xu Liang Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Michael Walle X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1771229043013621771 X-GMAIL-MSGID: 1771229043013621771 phy_device_create() will be called with is_c45 and c45_ids. If c45_ids are set, is_c45 is (usually) true. Change the only caller which do things differently, then drop the is_c45 check in phy_device_create(). This is a preparation patch to replace the is_c45 boolean with an enum which will indicate how the PHY is accessed (by c22, c45 or c45-over-c22). Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn --- drivers/net/phy/phy_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 0c2014accba7..226d5507c865 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -689,7 +689,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, * driver will get bored and give up as soon as it finds that * there's no driver _already_ loaded. */ - if (is_c45 && c45_ids) { + if (c45_ids) { const int num_ids = ARRAY_SIZE(c45_ids->device_ids); int i; @@ -970,7 +970,8 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) true, &c45_ids); } - return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids); + return phy_device_create(bus, addr, phy_id, is_c45, + !is_c45 ? NULL : &c45_ids); } EXPORT_SYMBOL(get_phy_device);