Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp214294rdb; Tue, 5 Dec 2023 03:32:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHz5q6rD9rhukH8HXsrIbLhh+TgZtgREA8ssUkUfoCia0TIH+9Pq5jbms+BjfPJzTRbra8T X-Received: by 2002:a17:903:228d:b0:1d0:9c03:a7c9 with SMTP id b13-20020a170903228d00b001d09c03a7c9mr3595535plh.97.1701775920061; Tue, 05 Dec 2023 03:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701775920; cv=none; d=google.com; s=arc-20160816; b=oaQ1C/975F6YAXQ0vltQ1Va1Swh3uFMPUS4/xsnHVqvUcOzrvaz1MPJpbLvK/peG2r n48ZWeqnfRXlKC3xgjkc9knT4okawYnxCcnA1eH+8twvTm8MkofJhtI36vWZ0V20XO3I +Npm6TaU+9SrlOR9/hJIHD7rrk/CHyl50lqJoLAAJEX2dPq2iXKQqyAuRTLnOA+sAqqc +KaZAPmARr7xHdhaLDDHgIX8XukZFQ3u+LaFGZ0dm+K2Ary/iOJxqIwgXVf1dN9WkFyB 5doI+tHU7lBnZ4AwpeGEi0MuSwRdZDWCXNAlKpTzRWYUW6rT4TthZTygkgIP18tRZdkK j6IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iWABwC93ZRSAHZ+Njf9xIdiKvJp/CP14/ZzB27UiO+I=; fh=AVtV1Wls/v1UV+o3DAyFguJvoENHVXWve3bKunUr09U=; b=WL+DxnmMnKNVG5IiixCYRafkIO7E6JD9jtTGAuaoYJcG+UQDl2x0GhbZ8QZcNc3Mzv 5l6kxoZxMik2oIB7g0hl0x/Nr3G5rFcexa/0ZIsftDES7ImeXRWpHM8Z4QLgZAR3dLLp IVRJfWhY6yb/npXBpFonRJvX6zg3HX9rM3UheogRRcr/M+wSq1ULZdzxVMCn25CMwUKp rWlgsAKhxFKcuWekUDGvYS5I5dmkVOSvEr0TPmB4QXXff5dMXVDgE11dM4w5Si16O9mO 33okClPapU+nmHUsbRYULnnfOUVBsqayXpbNbgiVmEYUVpWgZ9kVn1HMGgIAILv//rnl aXog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dkOdnC2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id mb5-20020a170903098500b001d05ec3be0bsi6659008plb.130.2023.12.05.03.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 03:32:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dkOdnC2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1937080D1EF9; Tue, 5 Dec 2023 03:31:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345081AbjLELbm (ORCPT + 99 others); Tue, 5 Dec 2023 06:31:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235128AbjLELbl (ORCPT ); Tue, 5 Dec 2023 06:31:41 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 591781AB; Tue, 5 Dec 2023 03:31:46 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50bfa7f7093so2354334e87.0; Tue, 05 Dec 2023 03:31:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701775904; x=1702380704; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=iWABwC93ZRSAHZ+Njf9xIdiKvJp/CP14/ZzB27UiO+I=; b=dkOdnC2jVcPaiBlOkIvqbrTfzUQ3I7jxR0Kwld7MjSIUuPzjIhXwdTkw1F6sqRfO4k Sj91baZc4COMmXwLhS8a8Yp5CVC1rmrK609Z/i/U056UjJ8VpGQAvx4a2+p54cL6eqjM M6iVbUIBo+BTlJ+7Ah6Ac2fbe4ENTLQm8hTy6uCFtG8vrOPz5kk6JrLPtbvzyCSg17qY B9aDNaZC6jpTSdmuL2BzlqZsEhP6ktmLaGQqTAsjaZ8NACo0f0ntjqqRT21COJ4c9pt1 U5wA+DQn9RBsTzucjQioQPJmQM95C4+r5QV/9D13823kHWgPRWOsamk5hWp5RHdj73BO j42A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701775904; x=1702380704; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=iWABwC93ZRSAHZ+Njf9xIdiKvJp/CP14/ZzB27UiO+I=; b=hGxGdsJaL7UoCmrD9UVX0DZt3SFivLr6bRvKNYt+Gq2B/ffTN3oRKttPidxrJ4x3X5 WSqRibG/RVB8AlIiVH7+Pl4jbx6MAvqR386hFoUCWdJvoF1aD4t4T+b9X28kgEbpg76B sOKw3h7jYGsJHtB124oiVEJUQnqJTEvpRk+/f9T8KQGdIcLl7Ca8XkdhjI7GvnN2CphV GdKqBJGxSd35BjJfV/3trdNngs1f7ihBJKCdFO+gF6y1sRHR6WPRIek6LnZvs6ho237U IprrjfqNNsQvRFC9V+Xxt/ztnPY99zeMmg7tT2TU71nMs0G1P9dZGt80xW0rNkWHrf6H MUvg== X-Gm-Message-State: AOJu0YwU8gpUnTzZEpZkf4N1IU/TM44xJpbHvPw2dcJFEtr0bY8API90 XHuF0M/9CxJlIVEpAbo48PY= X-Received: by 2002:ac2:5490:0:b0:50b:f2e0:4997 with SMTP id t16-20020ac25490000000b0050bf2e04997mr1735238lfk.103.1701775904378; Tue, 05 Dec 2023 03:31:44 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id bi38-20020a0565120ea600b0050bfd88075asm395757lfb.287.2023.12.05.03.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 03:31:43 -0800 (PST) Date: Tue, 5 Dec 2023 14:31:41 +0300 From: Serge Semin To: "Russell King (Oracle)" Cc: Andrew Lunn , Heiner Kallweit , Alexandre Torgue , Jose Abreu , Jose Abreu , Maxime Chevallier , Tomer Maimon , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 06/16] net: pcs: xpcs: Avoid creating dummy XPCS MDIO device Message-ID: References: <20231205103559.9605-1-fancer.lancer@gmail.com> <20231205103559.9605-7-fancer.lancer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 05 Dec 2023 03:31:57 -0800 (PST) On Tue, Dec 05, 2023 at 10:49:47AM +0000, Russell King (Oracle) wrote: > On Tue, Dec 05, 2023 at 01:35:27PM +0300, Serge Semin wrote: > > If the DW XPCS MDIO devices are either left unmasked for being auto-probed > > or explicitly registered in the MDIO subsystem by means of the > > mdiobus_register_board_info() method there is no point in creating the > > dummy MDIO device instance in order to get the DW XPCS handler since the > > MDIO core subsystem will create the device during the MDIO bus > > registration procedure. > > Please reword this overly long sentence. Ok. > > If they're left unmasked, what prevents them being created as PHY > devices? Not sure I fully get what you meant. If they are left unmasked the MDIO-device descriptor will be created by the MDIO subsystem anyway. What the point in creating another one? > > > @@ -1437,19 +1435,21 @@ struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr, > > struct mdio_device *mdiodev; > > struct dw_xpcs *xpcs; > > > > - mdiodev = mdio_device_create(bus, addr); > > - if (IS_ERR(mdiodev)) > > - return ERR_CAST(mdiodev); > > + if (addr >= PHY_MAX_ADDR) > > + return ERR_PTR(-EINVAL); > > > > - xpcs = xpcs_create(mdiodev, interface); > > + if (mdiobus_is_registered_device(bus, addr)) { > > + mdiodev = bus->mdio_map[addr]; > > + mdio_device_get(mdiodev); > > No, this makes no sense now. This function is called > xpcs_create_mdiodev() - note the "create_mdiodev" part. If it's getting > the mdiodev from what is already there then it isn't creating it, so > it's no longer doing what it says in its function name. If you want to > add this functionality, create a new function to do it. AFAICS the method semantics is a bit different. It's responsibility is to create the DW XPCS descriptor. MDIO-device is utilized internally by the DW XPCS driver. The function callers don't access the created MDIO device directly (at least since some recent commit). So AFAIU "create" means creating the XPCS descriptor irrespective from the internal communication layer. So IMO the suffix is a bit misleading. I'll change it in one of the next commit anyway. Should I just merge that patch back in this one? -Serge(y) > > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!