Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1486310pxb; Thu, 24 Mar 2022 22:30:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5/54saAki6ONKUt5y7URR7RWGzYH8bV269f3T+NG8RehIUlApSNu3ibaoYvpOsEqElHaw X-Received: by 2002:a17:907:8687:b0:6d7:8f6a:3c0e with SMTP id qa7-20020a170907868700b006d78f6a3c0emr9551631ejc.500.1648186234097; Thu, 24 Mar 2022 22:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648186234; cv=none; d=google.com; s=arc-20160816; b=f2B/HN0JdkrRoul/q9H4/ULqFooQxxoS8bbV11NGYUqEWhypviV3aakNftyunXDusG S9B5qqm27wspndxw04zy352w/YZEGgp6rBP+yO/N9JSOZB4Vwih+EA2b9IRz2glQwb+0 XXqITT0KuvqmKOJUeiF49kcWPt/M8gbkWW+Qru+U7eb2OtSY39B/P+bN3sOFmF+f7w/z Cpo7C8XVXsxd3CpAEmrN6VRcKkcmnisDT18ZEWRHvVY8gBOYJNCCR36IoiWaaOn8zixq YYTLwgpbIoxlTatZ7ZjkYy2UxT6kjAtSymJ+wAL53V5Qo3leONbF24SRr7suwQh9v/E8 URWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=W6I5uXL5BQ9Fq8+54NpWJEnlpv+fNccLE9GVeB9+xdg=; b=ogFB838KIqk6e4z7zCxupIVuwYeaKbdwORZ7oQMinGSCsENLQ3iJ3YutnFOCCn8dsB IyTTg+7hLMshM2cDOuwLQqeoeNXuVYFzzQ59ZvNREW0Tk5+FeAnF21QV7J7zCFhVgQOk VJ+8Vm3A7Z4JfR25cuZty1k5ZaO0ALsQ7Bd8v31rhfWGGjpU5ehIWLrhd/CWiP06CyVs aN3HNchzMWvdeaLvrKEyAXowS6bdodaTBeAgGQqoFLyPaXj9283bYHOq1r2eMC5gUDOD 4GTgnJWjY8tEVDxWyzWLra/4azLHoTVy7vcRHeKjV+5MAv+IiMnb9m6KEXmMaK7O/phl kXDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=C7DQtxKA; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a170906855300b006df76385dbcsi1491489ejy.604.2022.03.24.22.30.08; Thu, 24 Mar 2022 22:30:34 -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=@walle.cc header.s=mail2016061301 header.b=C7DQtxKA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345175AbiCWWPt (ORCPT + 99 others); Wed, 23 Mar 2022 18:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241243AbiCWWPs (ORCPT ); Wed, 23 Mar 2022 18:15:48 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C1F689330; Wed, 23 Mar 2022 15:14:14 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id E536B221D4; Wed, 23 Mar 2022 23:14:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648073652; 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=W6I5uXL5BQ9Fq8+54NpWJEnlpv+fNccLE9GVeB9+xdg=; b=C7DQtxKA1eJ7QFA/2kF0rAbU3Zxg48MUOF73SQiHHf7aNNDgcj9Q8xvDUmNWWGFuAinUs7 Pd2BOIwB+1nhT2XB+FZ1v31pudztrno8xTNsGSUaOolre6LoTJdPSmrgNniusIe0jqnvxh 5+GdcH1QlocPNVvxFDV8QJ38NCAvtRQ= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 23 Mar 2022 23:14:11 +0100 From: Michael Walle To: Andrew Lunn Cc: Heiner Kallweit , Russell King , Jakub Kicinski , Paolo Abeni , "David S . Miller" , Xu Liang , Alexandre Belloni , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next 2/5] net: phy: support indirect c45 access in get_phy_c45_ids() In-Reply-To: References: <20220323183419.2278676-1-michael@walle.cc> <20220323183419.2278676-3-michael@walle.cc> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <43227d27d938fad8a2441363d175106e@walle.cc> X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,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 Am 2022-03-23 20:39, schrieb Andrew Lunn: >> +static int mdiobus_probe_mmd_read(struct mii_bus *bus, int prtad, int >> devad, >> + u16 regnum) >> +{ >> + int ret; >> + >> + /* For backwards compatibility, treat MDIOBUS_NO_CAP as c45 capable >> */ >> + if (bus->probe_capabilities == MDIOBUS_NO_CAP || >> + bus->probe_capabilities >= MDIOBUS_C45) > > Maybe we should do the work and mark up those that are C45 capable. At > a quick count, see 16 of them. You mean look at they are MDIOBUS_C45, MDIOBUS_C22_C45 or MDIOBUS_C22 and drop MDIOBUS_NO_CAP? > >> + return mdiobus_c45_read(bus, prtad, devad, regnum); >> + >> + mutex_lock(&bus->mdio_lock); >> + >> + /* Write the desired MMD Devad */ >> + ret = __mdiobus_write(bus, prtad, MII_MMD_CTRL, devad); >> + if (ret) >> + goto out; >> + >> + /* Write the desired MMD register address */ >> + ret = __mdiobus_write(bus, prtad, MII_MMD_DATA, regnum); >> + if (ret) >> + goto out; >> + >> + /* Select the Function : DATA with no post increment */ >> + ret = __mdiobus_write(bus, prtad, MII_MMD_CTRL, >> + devad | MII_MMD_CTRL_NOINCR); >> + if (ret) >> + goto out; > > Make mmd_phy_indirect() usable, rather then repeat it. I actually had that. But mmd_phy_indirect() doesn't check the return code and neither does the __phy_write_mmd() it actually deliberatly sets "ret = 0". So I wasn't sure. If you are fine with a changed code flow in the error case, then sure. I.e. mmd_phy_indirect() always (try to) do three accesses; with error checks it might end after the first. If you are fine with the error checks, should __phy_write_mmd() also check the last mdiobus_write()? -michael