From patchwork Mon Jun 22 10:00:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11617621 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91C0690 for ; Mon, 22 Jun 2020 12:44:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6AD192071A for ; Mon, 22 Jun 2020 12:44:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="d0mvNlDh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="n2krAX2Y"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="LpewbTVA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AD192071A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ws8OXPHR0nHemZezdL/wLN3BJvlB0y2WZeb7KQDdENM=; b=d0mvNlDhRwB7kltdihSnyuiuN qNpahSWC+/xYyqiTO7QJDzSuQGwUOnCtmQTdeZWBmu6I15suPwzl42tniX4tZqJgPIcPtwzilahUY ftu8/BHsAatUTSx9G2l7Lu7dRRmwB4QGgZjMXRRCcVWH9FbZDS65e2j+eG0aeCD4/rrd1fInPhn7q icWgZWaE/c5aZGeF9axkv9lNjluvs6UFm2HdA/G8QgyA9jKyBWAWn9nJyC0zDVCcnd8g3rJV+NAI4 g1kyJqgOhhCVNLhJpHuz8YMR5spKrXXPK3E2KhVBvvhXuaDqocHoEp+8JI9jzSowMM6q9wSWOH085 HPAdTExXw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnLog-0000n9-BA; Mon, 22 Jun 2020 12:44:50 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnLl4-0006jf-Qe for linux-mediatek@merlin.infradead.org; Mon, 22 Jun 2020 12:41:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=5QarOMVR645D9ubKovjzVLDL1uXK7z1gDINN/6iJvAs=; b=n2krAX2YDU9ctM0lt7uMQ+45vD D6uphY0ml77FumWY7I7+PnG+5qU1dZUtL1cYjscE/G8N5SKBrnqA8oIr+DzB0SU0ko7Pcw87ewScg UytCQ+kwlxY7PpDPqcQxMIMKHHkYu3jmHxpnZxz7yMXci3hZ8fPz78LkE0bSIqs5LRrEG9sdHsKG/ zSF6IduTyNs8/gggH+8uC++jmQyVZL+K71r0rh5wpFxl4AiADJop0uim12mvoichQf6r4Fo5mIKcV jKm7BSLMin69j8CkNKw3p36TxLiSze7L9nkBOZc1/acOZSy1NvjHe1B/WYfvm/xVwV9jZNBpjuy4v DGBzv8Tw==; Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJHD-0004hm-Fk for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:02:09 +0000 Received: by mail-wm1-x342.google.com with SMTP id r15so15091377wmh.5 for ; Mon, 22 Jun 2020 03:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5QarOMVR645D9ubKovjzVLDL1uXK7z1gDINN/6iJvAs=; b=LpewbTVAIvBpnXi99/xVv5fbqz2WujW0FcFIKxrOtFsxX8fD+Q/1J+ukHVtzm2tM0u nrSNkek+MnZpGtu/cb3IES/Oe0XCrkBfBJI7bMVzqbKrpKpiN6tkeNUJijkQQ2taMHgV F2/kkG8pj76PGjfgqO9kVPMj+M50223gvL2bEDlGEZm57XR+OYc7hJ2fylF1Euolc3X2 Sv/NLPTj62fMq3VPOxv/PcWtMYNVFJgKmLsSKRZG3V9OJmDfKzvarPK3gG08+dN+VRLN hib1dKtxy+nGusP97umOk8eJL3G8NZUA6W5f4/aFKPSPpMx8D1c5kMmHmm6jkKV4D31K rYAQ== 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=5QarOMVR645D9ubKovjzVLDL1uXK7z1gDINN/6iJvAs=; b=ee9YFIJ8+rbsJw4VYxMZ6GUNL7E76dGdPNNuWGAPv3FE1V7O1EUV+6Omriq58EWApr +bWxVmbTfhoC7XBdnYOqdhQyD6vzyCAUGQUZwaWvilmkVIMQDMqO6mKP7YbtSM9FJ4i/ VYSV3N6ys1j+TulXCXQx/o1Tr4ZuDc2Vs0VRswNo79hly163V9ZQc6YVGh3GU53lA7EF t9bNwVSBVCSrt3Dg7ER0gY1qVKfGTHutZYa4yogY4eLpzMh6qqzUAeAY+DdrtoVO+ts2 bAc5q4Ab+K3VtOafrot70ZREivzU8OwBQfx6OZESoJ3K4q6wU7AJ8So/sfkktSALmaBa Bscw== X-Gm-Message-State: AOAM530JzWgUQ1Oa+39DBtsIDyWRERpYIV8WKWsd03uH5//t6smE1hkc /NL75yw1OKuqiYzsRiHKUAjYRQ== X-Google-Smtp-Source: ABdhPJyQJrKCdVTA5/4h6jLuGo2TntfNLAXOnjZEpfXKXnJs07i++H3XlKxtAUGNs97IxT5JDpCRCw== X-Received: by 2002:a1c:bc55:: with SMTP id m82mr10040285wmf.92.1592820066976; Mon, 22 Jun 2020 03:01:06 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:06 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 01/11] net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init() Date: Mon, 22 Jun 2020 12:00:46 +0200 Message-Id: <20200622100056.10151-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200622_110207_605231_00B48936 X-CRM114-Status: GOOD ( 12.21 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski This function may fail. Check its return value and propagate the error code. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index f162b8b8f345..4ec4eeb9736b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -11167,10 +11167,14 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL, true); - ixgbe_mii_bus_init(hw); + err = ixgbe_mii_bus_init(hw); + if (err) + goto err_netdev; return 0; +err_netdev: + unregister_netdev(netdev); err_register: ixgbe_release_hw_control(adapter); ixgbe_clear_interrupt_scheme(adapter); From patchwork Mon Jun 22 10:00:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11617793 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8610D14E3 for ; Mon, 22 Jun 2020 13:49:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57CD620716 for ; Mon, 22 Jun 2020 13:49:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Vvh+7PD6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="c0YffHio"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="W5twYeDF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57CD620716 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eAXzZX4UC+I7OTdaofPENVXdPOgIbq0oaA7Q9prR9lM=; b=Vvh+7PD6FSFYQVfDexzhx8clY GIpbewkRdgO8d1rfV0pUoqG7s4PVfC0YZBiVmE5aO70aZjECW4WYRX15PHWqWvD1n3BOOIdOOVr+w CG5I2dHb5q3EQg3CrCrl0u+8EAyPaXLF9znefZeogp+t6RFPwqGah0KK/KSddck3pjosAGW9Vb4K9 ahbf/8z9KeQWPqj1O6UEfYqnhmxtP2BXtbgY/YjMo1PKOPZIsHWrlEEZHWd9QnjlgGt7dYNok9tpC r3xJdKjfmZTnHaJBfy6rLaD7HdwiIGq06GlOkJEFbwdng6KpI/cgU6Exn6rP5OmjB6wq/QnCT/84V FlhYGnmig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnMp4-0002oq-5g; Mon, 22 Jun 2020 13:49:18 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnLy4-00058l-AE for linux-mediatek@merlin.infradead.org; Mon, 22 Jun 2020 12:54:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=nZJ9RrYkX//UjOI/5YYylQYoHuaDDR4YnVJY1VbZiK8=; b=c0YffHioHharkk5mtpddf9GN0A RoJR12NULf+a5dc5HMP/2ZjMzDMSCxWiGx3aUbZyA3Q9Qrrb6OFjDHcD42ncop8u2H8OdxkT+z4Qo mWAIg2cd2QZcvUEXKnhNxerKcAT8Yrhwg1Xj6+F3RlFVXkdmqUQXb2DchfBcFc+sKMfFGVK4B9JG6 RGGyd/RTuY1dB1QDfEXAjbsb39lotq7ZzUpnp2u3upLV26RDz9yuz3eK+5yo5UkW7DGf6y85FyCkh ZNQDccZ20tNyX11stMjHwO53Uh6IkhMAJvvWZAu9LK3eAYWQMrwbkWrbiaDdjbC7FeC4/TqJXDrRO vYdDImlw==; Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGI-0004fe-NS for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:12 +0000 Received: by mail-wm1-x344.google.com with SMTP id g10so14254116wmh.4 for ; Mon, 22 Jun 2020 03:01:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nZJ9RrYkX//UjOI/5YYylQYoHuaDDR4YnVJY1VbZiK8=; b=W5twYeDFovUtibE54WQz/oY7xyAdsth+BrFOY/mwsKgJPsn0I8IXyw+KxwKQF1ccxI 0Vt4K58MBHihtcBcsAbduhBD/mpp6DDwwRtQDMg4DPDarSks61h5JkloiQmN5VvS0yn1 0MSYq3+hFxyViGeyscqGmPromya4jk9KRI0GNLYt2z3RxhbOM4E3fY3KBk6qoCm79iXc 3Hv1vs4zZ9h7EGmVIUsjsu72HT6azkCzrdmgJHG4VQQEoPysFHsyyrj5e60fdxVZexdD trJKHKTrt9CadDNiF6JYZkjIDKxYSRiSUtH8aF77wU6jWNuYEqz2A6dAA/jnuyrnG/K6 JkAQ== 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=nZJ9RrYkX//UjOI/5YYylQYoHuaDDR4YnVJY1VbZiK8=; b=CglQ6Aehve0VFbc4UQyKZ1gIwBkXpriHAuUUWDiUiB9tuRX0tLAo589W4TGE7qsHow /6Oa0/JaFQSjLujE9hdj1B/9CpUuQUOMjimsInGEZMig2+7mZW9dRCuBfG0tI1mqKEhG l/wtUBCHTWXWkEoYJDzJ6kEzwzfc9UDg39qVPq+iAj73XmOKRqfR8m7PpJMAVL6h4Bmw ploOrF9QejlNu06ZnNbdkGCnrkvurYAc0iyzW3UMQeBZFuqRmYn4JHp5ScUdrI93+Y9k R05D43yUyX28pbAJ7Cs8ZQp0sYkiZVlLiXlQI2DLjtbW+r0qURnUwqSEJ0szkw7VL951 0+3w== X-Gm-Message-State: AOAM532pw1Nb0whdgeMgWpfNv7HHF2FMvzWDrI0HyIPjMTv23m1ApOSB seKP1egE5aqADLibgr0DVCMOAQ== X-Google-Smtp-Source: ABdhPJz3Tx9rRuWOQsVP67dBEA0GfJ//6KQ3oIcn8+cDfu01dOKFVefKNNRcSbP+61lUU38AkDnLJw== X-Received: by 2002:a05:600c:2dc1:: with SMTP id e1mr5037577wmh.108.1592820068560; Mon, 22 Jun 2020 03:01:08 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:08 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 02/11] net: ethernet: ixgbe: don't call devm_mdiobus_free() Date: Mon, 22 Jun 2020 12:00:47 +0200 Message-Id: <20200622100056.10151-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200622_110110_862368_6EBB430F X-CRM114-Status: GOOD ( 14.37 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:344 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski The idea behind devres is that the release callbacks are called if probe fails. As we now check the return value of ixgbe_mii_bus_init(), we can drop the call devm_mdiobus_free() in error path as the release callback will be called automatically. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index 2fb97967961c..7980d7265e10 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c @@ -905,7 +905,6 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) struct pci_dev *pdev = adapter->pdev; struct device *dev = &adapter->netdev->dev; struct mii_bus *bus; - int err = -ENODEV; bus = devm_mdiobus_alloc(dev); if (!bus) @@ -923,7 +922,7 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) case IXGBE_DEV_ID_X550EM_A_1G_T: case IXGBE_DEV_ID_X550EM_A_1G_T_L: if (!ixgbe_x550em_a_has_mii(hw)) - goto ixgbe_no_mii_bus; + return -ENODEV; bus->read = &ixgbe_x550em_a_mii_bus_read; bus->write = &ixgbe_x550em_a_mii_bus_write; break; @@ -948,15 +947,8 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) */ hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22; - err = mdiobus_register(bus); - if (!err) { - adapter->mii_bus = bus; - return 0; - } - -ixgbe_no_mii_bus: - devm_mdiobus_free(dev, bus); - return err; + adapter->mii_bus = bus; + return mdiobus_register(bus); } /** From patchwork Mon Jun 22 10:00:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11619343 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6348E1731 for ; Mon, 22 Jun 2020 23:06:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3CC55206E2 for ; Mon, 22 Jun 2020 23:06:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="waWqzemK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="0NIB4N04" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CC55206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mrI6eSafCfIk0Y934QEb7ltv8yFQ7yu1srYiKZFXy+o=; b=waWqzemKltliBhN9P7Uat24tZ Jd54PLcfZrtciXolvk0JPHAree+LzQEXtFBAc50m8PrUIiGGaGlulh0PqFMpUQi+aIeDQytBJiqpM neQYRKlgmE1GCs9KIPh30S/5n2fRlJRmwzPs8hQaAtu8+4VjvcSttRQfc4xRdbPVla0ckPJ0IW5M7 uC4b6EKkZYhyNt5iAiiOFM1f4SdvVoRX98NY3DmuQaXG5kmEqyYhtj40DcNVNwzvsSOeiKqwazwJ3 9/SY2FkwGxL1GUreFaBOXZn3T/Iu/9xPGQcBTtb0qLMoVArsD04oozhXqj7PF1TIDkDo2KQojregx g7/0uQy5g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnVWT-00019a-W4; Mon, 22 Jun 2020 23:06:42 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJHH-00087x-3w for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:02:11 +0000 Received: by mail-wm1-x341.google.com with SMTP id a6so4145733wmm.0 for ; Mon, 22 Jun 2020 03:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=okWA8PmH0C2v2F1PxoaaMH4dinGpC6QBNEa7DW2Zh+g=; b=0NIB4N040OCOlLgg1O0x3F3JvByO2McpYkbxqJlqEN6Uq58x4AMdQ+vmj+3LegiabQ Qi5h6Dcv3VNEw+1qhAS9iL+Ip15A313D+S5s7uJcHHRwosRSi7RgslmsGIt0O228NVDo PoTwoUyuwGRep31ekyLWFFUPoZ/TiBca0eNIeHgmWQ1XaehWYL72IoRRCRAZdx1cSaJ3 OlWtHwtJz9u+WM0ep6ON0EkIZ8Sve2lyWWwlIAcWWWiut3v+6NKMu8uaSloirjUY3JBr 9Z8QSzo7FQnOxk4qsBB/iDIcaICDzSEM/QDfagcUetqaFwncNnOOvWoj+ek6OenujuR7 /TRQ== 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=okWA8PmH0C2v2F1PxoaaMH4dinGpC6QBNEa7DW2Zh+g=; b=n383mMMThxyhWHgsAn+sdxRwUmoSGqt0BtowjENviCtUV4K1kWYPApE6duJ9lxh4wQ 1x1wscwITIP4BOOGb4tZbie8obF1o6XHf59xWpwcSbO5eJ3axf1xxI5OKFfzalyhhkdo AIw1lug6k1ELwieOeP4bHaV5rAcEUlERe120c/mZKEqxoWyzfmthsAjKUY0oXI/LtVAx sylSs4U6XHxF38xOaIrQ2OEQ+IL2NPAXeQYrEh5Xd42nT00/uRpmirusX0V6BWb54rIB ekhdl16Jan1VoCNA9BZZK7w4WtE1II7pjfu/vsaRJV4vOdgAJafHi5/0/jlSqCyvz8c2 +sFw== X-Gm-Message-State: AOAM531cqUjouXxALMjvja6aGmh1qTH3AgMBJMrsYUONaELDdYtxQb7r Dr0EEWqazbl5V9LjtN8ILV9JEw== X-Google-Smtp-Source: ABdhPJwS5xS9WKkHvow7dKsFvCMdQtYLfCBeItKxhFKFlwRPqAUaAjn5C3o1Oi23Aq0D8zU5tG1vjg== X-Received: by 2002:a1c:804c:: with SMTP id b73mr698464wmd.59.1592820070021; Mon, 22 Jun 2020 03:01:10 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:09 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 03/11] net: devres: relax devm_register_netdev() Date: Mon, 22 Jun 2020 12:00:48 +0200 Message-Id: <20200622100056.10151-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski This devres helper registers a release callback that only unregisters the net_device. It works perfectly fine with netdev structs that are not managed on their own. There's no reason to check this - drop the warning. Signed-off-by: Bartosz Golaszewski --- net/devres.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/net/devres.c b/net/devres.c index 57a6a88d11f6..1583ccb207c0 100644 --- a/net/devres.c +++ b/net/devres.c @@ -46,14 +46,6 @@ static void devm_netdev_release(struct device *dev, void *this) unregister_netdev(res->ndev); } -static int netdev_devres_match(struct device *dev, void *this, void *match_data) -{ - struct net_device_devres *res = this; - struct net_device *ndev = match_data; - - return ndev == res->ndev; -} - /** * devm_register_netdev - resource managed variant of register_netdev() * @dev: managing device for this netdev - usually the parent device @@ -61,22 +53,13 @@ static int netdev_devres_match(struct device *dev, void *this, void *match_data) * * This is a devres variant of register_netdev() for which the unregister * function will be call automatically when the managing device is - * detached. Note: the net_device used must also be resource managed by - * the same struct device. + * detached. */ int devm_register_netdev(struct device *dev, struct net_device *ndev) { struct net_device_devres *dr; int ret; - /* struct net_device must itself be managed. For now a managed netdev - * can only be allocated by devm_alloc_etherdev_mqs() so the check is - * straightforward. - */ - if (WARN_ON(!devres_find(dev, devm_free_netdev, - netdev_devres_match, ndev))) - return -EINVAL; - dr = devres_alloc(devm_netdev_release, sizeof(*dr), GFP_KERNEL); if (!dr) return -ENOMEM; From patchwork Mon Jun 22 10:00:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11617855 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B34813A0 for ; Mon, 22 Jun 2020 14:03:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 344AB206E2 for ; Mon, 22 Jun 2020 14:03:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jVfJ7n+j"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="Tsq60zSl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 344AB206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W0fdEMeoYDVt1GpGIy20Qz8U/9ih+o4fzVFzxSPda64=; b=jVfJ7n+jsPviCUeJE+ugTGC3L pm6QEAIijDUuaG/qo6jUld7u1NeU25UqzT6DcO9ZR5E46bh7J94Xxd9CN7pBKFkPsShTU9uBY4Dkz XhSgDE2nOgFpwQ7o1QaFcI3YdYmo/5GpVMH+Eg1NVR+NO4kCPqicLIYg/fwV0kRrGUr70mSfOM+7G lYY/GfD4wb5qxg9q4AxMuNKwTF/K6evpkB0JHHlabLCDLNPCYFL5gq/2XiLfuzIr1G185LCkOh4Xk gbijjlNsSSrLQkfnRc10Gr66nWeY/kbg4Akh/9nJzo6zCJDdl8QQrMiVr/vP3DDWPEj2gAEHXMOT8 JXbduRnFA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnN2N-0006c0-2n; Mon, 22 Jun 2020 14:03:03 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGM-00086R-B0 for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:15 +0000 Received: by mail-wm1-x342.google.com with SMTP id g10so14254283wmh.4 for ; Mon, 22 Jun 2020 03:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A+lImr9HJg7an5aR2kWVhsrz0bguXORdrvazpSsfAy4=; b=Tsq60zSlQyklW6ikiOvVha9m8MSQkGcpaji1GbS6xFPATyiJUUq3JKJyfCAyoxgehy 6CzmzBfAhfYC+JJ7E2jJttBs8SlhgR8oo9tMY8qH0H5uA72QFI9xKDo+9n217Y4MWcDI iIpqF19hJetEL+xliD5MhEvVcUjPcnrYARK0a04t2IuYk/3fmnQix3PKNa1StSQ2Ywir OsASWBCKRjtVl/oQTuUFv5MYvUju1kmBOyveg54l6ZkSpLRCgEJ7CT/LJK7QfCebpVVu Mj4niG7n9b0pf3hzpGxkqMvGlvJ+MWwIDdWWPh8rjVNo3Yy750rQCUi4Ar9S11Dn+wof slIA== 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=A+lImr9HJg7an5aR2kWVhsrz0bguXORdrvazpSsfAy4=; b=IhIg2abgkZ83I6EhBB1goO9agBjH3kJpRf8Drcjxg3woHnhRsMbz/f2YzHlOjwgFxt K080rdgPwj8x8BUKO9027p4GIu8f0SgMfU3psKHByOmBGiv+0cqKok+SA04D9KJfOtSf qEacWUqhNeQgW+YV8PTR+uJVi9PGB7MzLc3PpObOIrCvm4RZ3rEaR8CoHKyUSu1HoQ1R E1TRDWqeJM3iZKFmFGgSsEFWf8B4baHgkMz8r4gr+86myJciBTJxaDT+9xh90dBXPBk+ rCdCAH7j/AlcPa4QwrZ+8oKhcuE5otsmjVaO+wbL6U89NQLKWfpjwtC9SmSCaBba31Kb C5Wg== X-Gm-Message-State: AOAM533itbIU9x709Bbbw/cMmjrvB+60BHrosYTKa9zzy1ZDnHBbuE7z voPt9smkJAnQPbZaW7bhzYYUtA== X-Google-Smtp-Source: ABdhPJz+xi3uc649226XqSHmo+O8gA+/80J/5T5A137PMAF2MXQi5PymwGW6I5MXBKX7A322evi/xw== X-Received: by 2002:a1c:3bc2:: with SMTP id i185mr17995739wma.33.1592820071777; Mon, 22 Jun 2020 03:01:11 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:11 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 04/11] net: devres: rename the release callback of devm_register_netdev() Date: Mon, 22 Jun 2020 12:00:49 +0200 Message-Id: <20200622100056.10151-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski Make it an explicit counterpart to devm_register_netdev() just like we do with devm_free_netdev() for better clarity. Signed-off-by: Bartosz Golaszewski --- net/devres.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/devres.c b/net/devres.c index 1583ccb207c0..d7aa92243844 100644 --- a/net/devres.c +++ b/net/devres.c @@ -39,7 +39,7 @@ struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv, } EXPORT_SYMBOL(devm_alloc_etherdev_mqs); -static void devm_netdev_release(struct device *dev, void *this) +static void devm_unregister_netdev(struct device *dev, void *this) { struct net_device_devres *res = this; @@ -60,7 +60,7 @@ int devm_register_netdev(struct device *dev, struct net_device *ndev) struct net_device_devres *dr; int ret; - dr = devres_alloc(devm_netdev_release, sizeof(*dr), GFP_KERNEL); + dr = devres_alloc(devm_unregister_netdev, sizeof(*dr), GFP_KERNEL); if (!dr) return -ENOMEM; From patchwork Mon Jun 22 10:00:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11619611 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB4C013B1 for ; Tue, 23 Jun 2020 02:46:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 743C020780 for ; Tue, 23 Jun 2020 02:46:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QopnKgQ/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="xtlQ6vt2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 743C020780 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Xo1vsfUzjeZh617JKE8S/bhMznKNVSrIkuS/yIakLNE=; b=QopnKgQ/c+xAFQpU8wLF4tDuv KuyujvSSsUMBkS2bJazJgI4XGgQ+37UIB5qBZ+8D7paFQ3yJ9SgmeXo5Kx7efFE1z9HYZ+qdxiddH aXiH/lCfRqdvUIY5PnvOU3RgYz1hJpMGlfKSmkJHOMmERaztaFIIkE+DpXEWoa6uANuNpHHbhPHTU wbVAGeflN2JgJvntBDyyNLBcO5gkvHZLnvoY0g4leCEcZn006jjOmFMiMSHRjYZkvZMEBOXmCYiZk 7+RWawVITOx62jUlRp+Sbh59f5+ZF3gmsj20T3GASyLxfUBaqLbGsupwLR7lPGf5+HBY6DcAqCBHj h2W7JM8eg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnYxZ-0007Mu-PJ; Tue, 23 Jun 2020 02:46:53 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGt-00087P-V3 for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:48 +0000 Received: by mail-wm1-x343.google.com with SMTP id g75so6171260wme.5 for ; Mon, 22 Jun 2020 03:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vANIsXo74NzXiDIyR10LVPoVvN0SF3cCppVREngNaSg=; b=xtlQ6vt2ftcI+XabUk5dlYEY+EoWH8nR8xcQ0FineEvTFIyHxwdZru/XNV/dfPCuwH p+2SV3EvOLiwS1nhvc60TsvMW4YNirrfN8g/xcNwpKisI/ZQhpTItmGFfFpSHrXsGu+S b7MvvTAW41tXqhs9scOYapiZqZ36Pfyhf81lebKF4vMaR5ghYo5mQz1TbDxar4ISYJoU r97GfAQhf4HMDRDYdamUBfw7XB2G5c/8Yd3xQBk2wd2NRH8kL2poxNolBqJT2m6c+bYv ZbtsK6uSEB72jNc60WhrddXbm/mQa5m5tZApNrkGL3PmfTcjFpfrBr+Em/UQj5iDvDis u71g== 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=vANIsXo74NzXiDIyR10LVPoVvN0SF3cCppVREngNaSg=; b=YOjaaAyyz+l8cmrhdDJoj67PF2AN7QkypYzvd4mi/q7GyJgiuTOXbsv8vrjbYNab7l jpVZKm4L2rhj1OhHsrj28NVeYidzIGHEADeZcN6SmPP7DMqsUT3o5qmNfbf9Ld+FF9lV qSa3Ao5DtXFqt+zMDeHOk3UUjjQy6Rv7xrgmpWUUEIav/gOGEzLYrg95ozP5kiHG/yaR 5C+9IiJEy4m+aJ4LfjTMRjE5gGE2jQx13vzlVP41GqZ9PQbU1KVB80s6cqwPbqWCgVa/ c9No8FhyZqhE1h8Pb9PZK+j45lk3qb7ZUltl4YgXjyLGIqr+cSl+zetipo5wZl9ieR8c dvGg== X-Gm-Message-State: AOAM533x2SyGQ8IjQ5PSmNyA6pe8gtAzsumSBYXK755LSvuKFmT60I7k l1qAQ8Xl8MXysOmMQ4jCRaPYKg== X-Google-Smtp-Source: ABdhPJzUHixuKfQa4u9XvxcXJoOatBovm5nA4dkuN9R2ixW6hpip+ioKdNDg9ycFUOAJ0KD49goWaA== X-Received: by 2002:a1c:c1:: with SMTP id 184mr17443884wma.74.1592820073899; Mon, 22 Jun 2020 03:01:13 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:12 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 05/11] Documentation: devres: add missing mdio helper Date: Mon, 22 Jun 2020 12:00:50 +0200 Message-Id: <20200622100056.10151-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski We have a devres variant of mdiobus_register() but it's not listed in devres.rst. Add it under other mdio devm functions. Signed-off-by: Bartosz Golaszewski --- Documentation/driver-api/driver-model/devres.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index e0b58c392e4f..5463fc8a60c1 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -343,6 +343,7 @@ MDIO devm_mdiobus_alloc() devm_mdiobus_alloc_size() devm_mdiobus_free() + devm_mdiobus_register() MEM devm_free_pages() From patchwork Mon Jun 22 10:00:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11618103 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3579B60D for ; Mon, 22 Jun 2020 15:12:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C571206FA for ; Mon, 22 Jun 2020 15:12:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NSIzBHox"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="hPCSBYPi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C571206FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jA1rHez+olilWIU8ejXVokOpvmTgTUrt6PHC6UV/Hc4=; b=NSIzBHoxLNKLz1I3lQtqFw9nY DSXXK+Gt3ed3+NULABWA3Vu1+jpQF0hVQ80Y/nWoxMFeFF38NYWrWbjMESs5dQdfJEH+d5zArzHRv HD6IFCnQrimCyogOixd/rworJMZ+Sp7GnljxsER7sQMPAQvb0zMNBhvhFP2khKFnKNpG/fMh2irqr sUlFG4epcda1TSfLxd2L72qizv0vztPrB50be8Bw8KghOneCs4M8spL5Q6WVXCaLG7Lyt3FAxDK2s 2EsDt39+7KamH+j/LFBr4jK8dWYjoM6omyz7jZNnjcDbz4J7KOmHb/1OARcxqn47gAIfDNjPfQhQR AJS2An2VQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnO7j-0006Fa-4Y; Mon, 22 Jun 2020 15:12:39 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGS-00086a-Ht for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:21 +0000 Received: by mail-wm1-x343.google.com with SMTP id u26so13163563wmn.1 for ; Mon, 22 Jun 2020 03:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SA+ksrlspcBtk66ickfbWi5/X69plQETLqM+T7sqDOM=; b=hPCSBYPijk+oW7o3W3ojF3NAaYsD4JrRPsGlfOOBzQ4ThECSIaaifu8iSYPR7zbUAx giQ4sowH3znExtSO3S964zh5IyteuZGXmP9B2ZvExrbuG0lv3RnqMa0dbDx7oKT3Cruf ntFtCt/KtwVdleh2QZcz+vD9bEurGJjeVbuXPkyeyA87kxRvFoIssYR99lkRq25sp0Dy 8ME3z0/l/PLLTultbtzKIRLt1ie8TS/eRQs7WOUniJkv9YG+Ya35j/vswWIOOkBzSz+Z KPipplT5rhQD8Nb/E1vu5Mffd1y2DmSUKnz0Ux1Df2rzIAqZgpQCiOI37E2WBb24Fa9I KUIw== 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=SA+ksrlspcBtk66ickfbWi5/X69plQETLqM+T7sqDOM=; b=QQuOOYLzp3Aj+iRkRlvuEyLG/p7a54uPvnrpDBI1U40YgpmLHhmztk7d+pGQ5TWDrT SRypj2AeFt92tR10TWlwTXsUAYxxK2J1dXGaypR5fPhFPfo3aH7Z+VKDYn4O9zW/Ai1e 11O7sJ8gcz3f+DrvVvFgCbySTht2QKMyWCBa/gOoLZZJC8mTUgNcX3crXqdq54tdQgZJ xlOJPOsFzPEt3iowqVWVhr721RUXRUkXDIUSF8+noTAA+snryvLDLyP8XkBtdIZYTl8T vna22pE5XhHeki9pDhElSOrNYDC2FAURZeZLXpnRranOp3WVVkvqZ0LS5uv9dlVciBhH CuPg== X-Gm-Message-State: AOAM5336x8C60Ser/pmA2vg5t5vWVvml5l/0LHEhHNESegd54jrdTv1T wrbj/cq8pTDLDx1f2tK56jiqTQ== X-Google-Smtp-Source: ABdhPJwWuhZqPJe1EH2uJKbIx2fxGg7cPQA+kFKd21eTb++TacoGNccIXkK+VSOvahqdHB0+R/2MHw== X-Received: by 2002:a1c:bc55:: with SMTP id m82mr10040949wmf.92.1592820075474; Mon, 22 Jun 2020 03:01:15 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:14 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 06/11] phy: un-inline devm_mdiobus_register() Date: Mon, 22 Jun 2020 12:00:51 +0200 Message-Id: <20200622100056.10151-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski Functions should only be static inline if they're very short. This devres helper is already over 10 lines and it will grow soon as we'll be improving upon its approach. Pull it into mdio_devres.c. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/Makefile | 2 +- drivers/net/phy/mdio_devres.c | 18 ++++++++++++++++++ include/linux/phy.h | 15 ++------------- 3 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 drivers/net/phy/mdio_devres.c diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index dc9e53b511d6..896afdcac437 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -3,7 +3,7 @@ libphy-y := phy.o phy-c45.o phy-core.o phy_device.o \ linkmode.o -mdio-bus-y += mdio_bus.o mdio_device.o +mdio-bus-y += mdio_bus.o mdio_device.o mdio_devres.o ifdef CONFIG_MDIO_DEVICE obj-y += mdio-boardinfo.o diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c new file mode 100644 index 000000000000..f0b4b6cfe5e3 --- /dev/null +++ b/drivers/net/phy/mdio_devres.c @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include + +int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner) +{ + int ret; + + if (!bus->is_managed) + return -EPERM; + + ret = __mdiobus_register(bus, owner); + if (!ret) + bus->is_managed_registered = 1; + + return ret; +} +EXPORT_SYMBOL(__devm_mdiobus_register); diff --git a/include/linux/phy.h b/include/linux/phy.h index 8c05d0fb5c00..62149945c5b3 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -313,20 +313,9 @@ static inline struct mii_bus *mdiobus_alloc(void) } int __mdiobus_register(struct mii_bus *bus, struct module *owner); +int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner); #define mdiobus_register(bus) __mdiobus_register(bus, THIS_MODULE) -static inline int devm_mdiobus_register(struct mii_bus *bus) -{ - int ret; - - if (!bus->is_managed) - return -EPERM; - - ret = mdiobus_register(bus); - if (!ret) - bus->is_managed_registered = 1; - - return ret; -} +#define devm_mdiobus_register(bus) __devm_mdiobus_register(bus, THIS_MODULE) void mdiobus_unregister(struct mii_bus *bus); void mdiobus_free(struct mii_bus *bus); From patchwork Mon Jun 22 10:00:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11619385 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CBE7912 for ; Mon, 22 Jun 2020 23:39:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAFB920720 for ; Mon, 22 Jun 2020 23:39:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CRCxuLhg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="RkGI6tow" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAFB920720 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GbH85wjW8tPED81AqpEA7v6KOOgWGdHsGJQAhG1Fxpc=; b=CRCxuLhgc8ogtdHNNO8aHUVyf NVUgh+/fqOm42RsfgTbzaWvq4vZPOk8njr4Ae0oy99craM5uD/WdzlfAVfqNeEY6I5mTBr427A6if QLDhjhTyKAU9K6R7bKLZSYaGOV9KaLIb9+AERjGF8szerVcEBtog6HFLbqpheRa7pZFtfkAiiFP6T szAdsUOR0DoGZ3Rsa2QQx5PuMSPbMBhy7c21Yqpk4Wcj8aYx8NZb//ZrwyOt5H4cKO1c3BDQEeXA9 M5qqCevbSvlAO/LoYbxnL05BkyAA29e62Sj9KR5Mw0psgLdbHzMVhWWkv/0jxR0uGU9xN4QCAgWZv C0ZJ9A7EA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnW2B-0000Zj-Vz; Mon, 22 Jun 2020 23:39:28 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGx-00087X-03 for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:51 +0000 Received: by mail-wm1-x342.google.com with SMTP id x16so5121129wmj.1 for ; Mon, 22 Jun 2020 03:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rcgV1UNGKm4K4QD82m2Udcr1uoHRVa+LAuPxtdS553M=; b=RkGI6towfSCgupn14twIBaRcPBpM6kTZkAyARWvNzlnwP2dFp8mTrnv4XT4CqOTAtt IZZIzKyBSsI3/vkakwGdPxh4YtWTjHfNDgdbQoZiEHDRdqwaJzeBZU2n3pe3Hl1JIPX3 j5b+wJ80RHNzlW79fmuSMN+irizFshjUfl7KHbTO/28J+86JZlFjPu2oxnw1xDlP9U+o Tz/qaKPx5+I3TcQfOgtfVc5nagMQ1oAW9Ofb8YpEYwg0Zu2KW4gsBJQW7Tl/PL353xVB MT3qUFDfoJzdv7OI5y+BMBaG6gcer8a9lZAr62OJTJz3NDwnsNdQyvR6wevtOPQ6vWAU 9aMQ== 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=rcgV1UNGKm4K4QD82m2Udcr1uoHRVa+LAuPxtdS553M=; b=I5DZ/qX7CE1ApLiQ7srPC3lO1wpKqgboi1UpVaLi53SCdQLJnNSqNbWBxn4TEBPhv3 8bCG0uQYYNBkC2BGN7MDSlsqa1JnJtFjwXYLQMavh1vtrWWCjeLRxffr0/5t/JU9oI6h nRQmpSHbAfbksf+PZL433y2XP1VL47UDw5eooV4z2KYG2GLhnUTPjVgmCSXPe4zleMfK 27xZ8VgbvO4PajrjGykOpTL7PECtAvVOKXXOOcZhEQOtgfU7hB/60QnTC7rbUGgWgusQ 3/vdFRbkpMgGpji4uBpXFTKuapImn771L5hX+fflspVuEB2wkDOJ+fPohNB9WXlahSKl m9Tg== X-Gm-Message-State: AOAM532tPLMekjPf1OiRGE662kAIlZsSD9km5wIT2Mo2vXllZBsf8clO LgbruIvSQTa4KT6gvnsvaYhVlA== X-Google-Smtp-Source: ABdhPJy6HpyoKYwmL67X7W6b1kvbkakGECdClzNJkWp/hMLI6DOqKfaBEc4Vc9FAS3rR166Apmbchw== X-Received: by 2002:a1c:f616:: with SMTP id w22mr9844980wmc.155.1592820077095; Mon, 22 Jun 2020 03:01:17 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:16 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 07/11] phy: mdio: add kerneldoc for __devm_mdiobus_register() Date: Mon, 22 Jun 2020 12:00:52 +0200 Message-Id: <20200622100056.10151-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski This function is not documented. Add a short kerneldoc description. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/mdio_devres.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c index f0b4b6cfe5e3..3ee887733d4a 100644 --- a/drivers/net/phy/mdio_devres.c +++ b/drivers/net/phy/mdio_devres.c @@ -2,6 +2,13 @@ #include +/** + * __devm_mdiobus_register - Resource-managed variant of mdiobus_register() + * @bus: MII bus structure to register + * @owner: Owning module + * + * Returns 0 on success, negative error number on failure. + */ int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner) { int ret; From patchwork Mon Jun 22 10:00:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11618097 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 834ED60D for ; Mon, 22 Jun 2020 15:12:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4EB8C206FA for ; Mon, 22 Jun 2020 15:12:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="swPDPetO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="umsqc560" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EB8C206FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CWojgQ5/cLoYPkl863kHzANDMNd3mg0bAqcyrzR50JA=; b=swPDPetOP5jjStP13vZmFzerJ qHOUia6I7YY/VUHMfMqDCI68zs3pmYB1KpPf9auu8kPGBa0S9oqtlAs2/cBBSWfNn6Ok6ImA7mv4c Y6BIBt/3HP6twIFN9TT9g3NUrbe6P3WzGFumbjWh/2lf7JzxBPAH1XNC+qyAdIKcdNr8Kyign5Tlx 1RS4amaxg7z9IpUGvRVd/zidU0sjNxkt8bK5o9WUgn735dnf5EeVb1W7yqsCGHUMwQ8vwfPoYgoHC ncxGlQkTkwq3grpuBGwxWTGy+2KpqDLTbKPpEFAmWyBZyQJ4hLUv/T0Ekg60bxsVmdYtji3wBpmLA 2Ains7etA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnO7d-0006C5-81; Mon, 22 Jun 2020 15:12:33 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGS-00086b-Hr for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:21 +0000 Received: by mail-wm1-x344.google.com with SMTP id r9so14264038wmh.2 for ; Mon, 22 Jun 2020 03:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TTj07T08NNZro/U2yWPFP3Dw02nhL5hB1K0t6Vwkyzw=; b=umsqc560VgWzO4IFGB8xbm9+eHaBnWiZ8GN88xIPqibz5h05dlWPTFWVVY+f69KlG0 a4y7K5KJh92xDh9QC/FmqY1WMCLtVijDEi7mmlatAu20aNEY/OkwQAydZfniEo6v19ly 5UpNecI0rhyx7ljbmoN4ErSxXuJgzG2Pvn5qCM8hJ/gz7PmN8uAxqCEn0FKto6Yw3BQJ MwlWbDZgiEh6Bxwf6FJ+KhsXROfVkjFYGLxKZrFtIx6c3oqVOLqL2qrekxNXHOXLjNu7 HsquwI/7md6BwXsqjVvJhh/XfV1XR78LuXr1JLkx4Xai6QrZExGPdzterXgVwn8Nlu2K +Dwg== 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=TTj07T08NNZro/U2yWPFP3Dw02nhL5hB1K0t6Vwkyzw=; b=DCqc/Qbi2SH06KnyTqNis4r9II8blbH06IeyfSUms/8j91BWP2nzpo/94uesXsd5Zh g1IjQZmVZwACBG+nUeo93kp/xImjb3ggx9rkzJx6fMkzEK5Oa3VEvkBqZZp1wegQmtpO gzppZoYK/AwW+uOz4UJAy645S39FIQuE3z+pIqPfchVmNAN4+WHXX7mWLrPTcOEztgYO lpr+33T0kF6wJph+jQ3sDMncRujoTxYPm5tAh/HD5wTELjnxMQN1kNyxknmfgVNxpRdu /vO78JkcqHQ1h/0VoTTfXdnlIiSAMKpd5iiiho5fhOSBkOfLpXu6uPZSR5F2QntmJ1vs /GTA== X-Gm-Message-State: AOAM5318XmzSJUDTpxnP0EZcriGUNC+ndpUDy7iPzC/C3hbt+0sN8JkY BOw9XtW0X0KEcgg4sj9BMJl4pw== X-Google-Smtp-Source: ABdhPJwbtQnwhgQy4/PGrqFbGi4Rm4Vlma7uhso1tRe0BeUVnkpoIf981M/hc/QiwEw6xXi5+FRkFQ== X-Received: by 2002:a05:600c:2dc1:: with SMTP id e1mr5038382wmh.108.1592820078894; Mon, 22 Jun 2020 03:01:18 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:18 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 08/11] net: phy: don't abuse devres in devm_mdiobus_register() Date: Mon, 22 Jun 2020 12:00:53 +0200 Message-Id: <20200622100056.10151-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:344 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski We currently have two managed helpers for mdiobus - devm_mdiobus_alloc() and devm_mdiobus_register(). The idea behind devres is that the release callback releases whatever resource the devm function allocates. In the mdiobus case however there's no devres associated with the device by devm_mdiobus_register(). Instead the release callback for devm_mdiobus_alloc(): _devm_mdiobus_free() unregisters the device if it is marked as managed. This all seems wrong. The managed structure shouldn't need to know or care about whether it's managed or not - and this is the case now for struct mii_bus. The devres wrapper should be opaque to the managed resource. This changeset makes devm_mdiobus_alloc() and devm_mdiobus_register() conform to common devres standards: devm_mdiobus_alloc() allocates a devres structure and registers a callback that will call mdiobus_free(). __devm_mdiobus_register() allocated another devres and registers a callback that will unregister the bus. Similarily to how we modified devm_register_netdev() - we're not checking whether struct mii_bus is managed - it could have been allocated as part of a bigger structure. Signed-off-by: Bartosz Golaszewski --- .../driver-api/driver-model/devres.rst | 1 - drivers/net/ethernet/realtek/r8169_main.c | 2 +- drivers/net/phy/mdio_bus.c | 73 ------------------- drivers/net/phy/mdio_devres.c | 70 ++++++++++++++++-- include/linux/phy.h | 10 +-- 5 files changed, 69 insertions(+), 87 deletions(-) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index 5463fc8a60c1..e0333d66a7f4 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -342,7 +342,6 @@ LED MDIO devm_mdiobus_alloc() devm_mdiobus_alloc_size() - devm_mdiobus_free() devm_mdiobus_register() MEM diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index dad84ecf5a77..34d5797695ba 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -5100,7 +5100,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->read = r8169_mdio_read_reg; new_bus->write = r8169_mdio_write_reg; - ret = devm_mdiobus_register(new_bus); + ret = devm_mdiobus_register(&pdev->dev, new_bus); if (ret) return ret; diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 6ceee82b2839..42192991f55d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -165,79 +165,6 @@ struct mii_bus *mdiobus_alloc_size(size_t size) } EXPORT_SYMBOL(mdiobus_alloc_size); -static void _devm_mdiobus_free(struct device *dev, void *res) -{ - struct mii_bus *bus = *(struct mii_bus **)res; - - if (bus->is_managed_registered && bus->state == MDIOBUS_REGISTERED) - mdiobus_unregister(bus); - - mdiobus_free(bus); -} - -static int devm_mdiobus_match(struct device *dev, void *res, void *data) -{ - struct mii_bus **r = res; - - if (WARN_ON(!r || !*r)) - return 0; - - return *r == data; -} - -/** - * devm_mdiobus_alloc_size - Resource-managed mdiobus_alloc_size() - * @dev: Device to allocate mii_bus for - * @sizeof_priv: Space to allocate for private structure. - * - * Managed mdiobus_alloc_size. mii_bus allocated with this function is - * automatically freed on driver detach. - * - * If an mii_bus allocated with this function needs to be freed separately, - * devm_mdiobus_free() must be used. - * - * RETURNS: - * Pointer to allocated mii_bus on success, NULL on failure. - */ -struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv) -{ - struct mii_bus **ptr, *bus; - - ptr = devres_alloc(_devm_mdiobus_free, sizeof(*ptr), GFP_KERNEL); - if (!ptr) - return NULL; - - /* use raw alloc_dr for kmalloc caller tracing */ - bus = mdiobus_alloc_size(sizeof_priv); - if (bus) { - *ptr = bus; - devres_add(dev, ptr); - bus->is_managed = 1; - } else { - devres_free(ptr); - } - - return bus; -} -EXPORT_SYMBOL_GPL(devm_mdiobus_alloc_size); - -/** - * devm_mdiobus_free - Resource-managed mdiobus_free() - * @dev: Device this mii_bus belongs to - * @bus: the mii_bus associated with the device - * - * Free mii_bus allocated with devm_mdiobus_alloc_size(). - */ -void devm_mdiobus_free(struct device *dev, struct mii_bus *bus) -{ - int rc; - - rc = devres_release(dev, _devm_mdiobus_free, - devm_mdiobus_match, bus); - WARN_ON(rc); -} -EXPORT_SYMBOL_GPL(devm_mdiobus_free); - /** * mdiobus_release - mii_bus device release callback * @d: the target struct device that contains the mii_bus diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c index 3ee887733d4a..344d2c748c16 100644 --- a/drivers/net/phy/mdio_devres.c +++ b/drivers/net/phy/mdio_devres.c @@ -1,25 +1,83 @@ // SPDX-License-Identifier: GPL-2.0-or-later +#include #include +#include + +struct mdiobus_devres { + struct mii_bus *mii; +}; + +static void devm_mdiobus_free(struct device *dev, void *this) +{ + struct mdiobus_devres *dr = this; + + mdiobus_free(dr->mii); +} + +/** + * devm_mdiobus_alloc_size - Resource-managed mdiobus_alloc_size() + * @dev: Device to allocate mii_bus for + * @sizeof_priv: Space to allocate for private structure + * + * Managed mdiobus_alloc_size. mii_bus allocated with this function is + * automatically freed on driver detach. + * + * RETURNS: + * Pointer to allocated mii_bus on success, NULL on out-of-memory error. + */ +struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv) +{ + struct mdiobus_devres *dr; + + dr = devres_alloc(devm_mdiobus_free, sizeof(*dr), GFP_KERNEL); + if (!dr) + return NULL; + + dr->mii = mdiobus_alloc_size(sizeof_priv); + if (!dr->mii) { + devres_free(dr); + return NULL; + } + + devres_add(dev, dr); + return dr->mii; +} +EXPORT_SYMBOL(devm_mdiobus_alloc_size); + +static void devm_mdiobus_unregister(struct device *dev, void *this) +{ + struct mdiobus_devres *dr = this; + + mdiobus_unregister(dr->mii); +} /** * __devm_mdiobus_register - Resource-managed variant of mdiobus_register() + * @dev: Device to register mii_bus for * @bus: MII bus structure to register * @owner: Owning module * * Returns 0 on success, negative error number on failure. */ -int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner) +int __devm_mdiobus_register(struct device *dev, struct mii_bus *bus, + struct module *owner) { + struct mdiobus_devres *dr; int ret; - if (!bus->is_managed) - return -EPERM; + dr = devres_alloc(devm_mdiobus_unregister, sizeof(*dr), GFP_KERNEL); + if (!dr) + return -ENOMEM; ret = __mdiobus_register(bus, owner); - if (!ret) - bus->is_managed_registered = 1; + if (ret) { + devres_free(dr); + return ret; + } - return ret; + dr->mii = bus; + devres_add(dev, dr); + return 0; } EXPORT_SYMBOL(__devm_mdiobus_register); diff --git a/include/linux/phy.h b/include/linux/phy.h index 62149945c5b3..fa6697edefb3 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -260,9 +260,6 @@ struct mii_bus { int (*reset)(struct mii_bus *bus); struct mdio_bus_stats stats[PHY_MAX_ADDR]; - unsigned int is_managed:1; /* is device-managed */ - unsigned int is_managed_registered:1; - /* * A lock to ensure that only one thing can read/write * the MDIO bus at a time @@ -313,9 +310,11 @@ static inline struct mii_bus *mdiobus_alloc(void) } int __mdiobus_register(struct mii_bus *bus, struct module *owner); -int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner); +int __devm_mdiobus_register(struct device *dev, struct mii_bus *bus, + struct module *owner); #define mdiobus_register(bus) __mdiobus_register(bus, THIS_MODULE) -#define devm_mdiobus_register(bus) __devm_mdiobus_register(bus, THIS_MODULE) +#define devm_mdiobus_register(dev, bus) \ + __devm_mdiobus_register(dev, bus, THIS_MODULE) void mdiobus_unregister(struct mii_bus *bus); void mdiobus_free(struct mii_bus *bus); @@ -326,7 +325,6 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) } struct mii_bus *mdio_find_bus(const char *mdio_name); -void devm_mdiobus_free(struct device *dev, struct mii_bus *bus); struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); #define PHY_INTERRUPT_DISABLED false From patchwork Mon Jun 22 10:00:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11619597 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7200713A0 for ; Tue, 23 Jun 2020 02:18:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A38620720 for ; Tue, 23 Jun 2020 02:18:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hWgEVmzB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="MxEnyo50" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A38620720 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7dIGonxH+YL7VzAJ8xGTjdztDl8lbGzL/iPWn7KoBbE=; b=hWgEVmzBOWIgWKNZjE57fZHIm 6o206W71MyMUfByUIrVOe7mQuOZvc7uGANCPAv1hesI5CGxi4nHnvnk3eZLmNkRTKWOzf7JG81SUi 7X37WYOKaWE2mX2k4XSE1yNz+UPqwtvK6i2fHqynBGqfPtQMyNL/89/55c74rCG0WlNQzLwoklcV4 8BGASdOsyLiq52ujZDapWsYsw0KJJKwNdFXmcYbiEXbTpN06iOreThWx/1nSSq3bDjzNP9B6Yi9WC +Q6gPxdeDhmZ4ZwQIGezZEy61+tNL3nD4zUrzRZOD/Em7Mgh8YJzLZH13Xbtsl+z5CFEe59QMWLDG sr7XB/03g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnYVj-0006EG-Mf; Tue, 23 Jun 2020 02:18:07 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGb-000876-Nk for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:30 +0000 Received: by mail-wr1-x443.google.com with SMTP id b6so15997449wrs.11 for ; Mon, 22 Jun 2020 03:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eg4utbhrf/3v6wZhuPotuFpmqRh7IC4ZAOzFVoP+DSU=; b=MxEnyo505JlU2NM71Ns3rqf71HG9d+3e0DSgBr4zrwK8k/6QZkxukBWBPbXD0U7DOU LTkBY0EmU2E4b1wfmzJjeUMAcwEQbL6bY0Hxl0Zle/ZEIhZf9HVji4mYG9zx7e5CQY4u CCATyRl6NEWhTBKaJ58QnmPlrIe3Dpoz9v76MGezVbZdpfDsY8bQjSRNfPy0117mdmc7 ZWOILTIDUcfXtXy0/X7HXWgBFDWAUDVKV9VQFgANzt2cc9PVEsPMYZoVDpe/q0TWrtQm vP1dPPAeTocwkUNR3FXFR7z6gj9eEexFguHwDu10Lr43tHqCkUMFiBLt0giJs6h4sjhU 4RRw== 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=eg4utbhrf/3v6wZhuPotuFpmqRh7IC4ZAOzFVoP+DSU=; b=XqXpVpXR32Wun/QMUAyssHu0hEH9zSdHzKXY0JL3J37bq0E/d1Zw0wvx+5ZLmsBvFT YUA8Oh5M4FokdGeNkcJ5qW9qtUkjR7+Jlyw0MX+iTGOuxh54lBTmymOZsczWLGbIdnAI usAI4GMceYSQZdqsLSMpbi9gzvLlaYAM9IBPw9DF5KxtePWgXgjsbSj2E9b4VfvjbOmW c989cipwZES/luDI5K7km9owIwppn/iWx2U4LKiZjXVIyACMD0ELkSo2x5GXCiPF1EgO 39SmJRKkaifDT647jtt4hVGoxc0uuEsCFVqId+ZQd839htYYFV5CRH6+FKw8Dmcr7b34 iDsA== X-Gm-Message-State: AOAM533PhQ0XhUrz/vCQrBxQ4RuwqaZI3f/tPBh7TGgk6RS+dSLa7BGf Quflg0+EZ2mnOmOlqrJq0c4tGw== X-Google-Smtp-Source: ABdhPJzUx9/chMNKmLzAYZpTwQ9uy6yZYRBRjyWPOHP+aXvq3C4Pttlm2e9Adw57f6qs+y2AureErg== X-Received: by 2002:adf:dd83:: with SMTP id x3mr16132134wrl.292.1592820080518; Mon, 22 Jun 2020 03:01:20 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:20 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 09/11] of: mdio: remove the 'extern' keyword from function declarations Date: Mon, 22 Jun 2020 12:00:54 +0200 Message-Id: <20200622100056.10151-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski The 'extern' keyword in headers doesn't have any benefit. Remove them all from the of_mdio.h header. Signed-off-by: Bartosz Golaszewski --- include/linux/of_mdio.h | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 0f61a4ac6bcf..ba8e157f24ad 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -12,27 +12,26 @@ #include #if IS_ENABLED(CONFIG_OF_MDIO) -extern bool of_mdiobus_child_is_phy(struct device_node *child); -extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); -extern struct phy_device *of_phy_find_device(struct device_node *phy_np); -extern struct phy_device *of_phy_connect(struct net_device *dev, - struct device_node *phy_np, - void (*hndlr)(struct net_device *), - u32 flags, phy_interface_t iface); -extern struct phy_device * +bool of_mdiobus_child_is_phy(struct device_node *child); +int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); +struct phy_device *of_phy_find_device(struct device_node *phy_np); +struct phy_device * +of_phy_connect(struct net_device *dev, struct device_node *phy_np, + void (*hndlr)(struct net_device *), u32 flags, + phy_interface_t iface); +struct phy_device * of_phy_get_and_connect(struct net_device *dev, struct device_node *np, void (*hndlr)(struct net_device *)); -struct phy_device *of_phy_attach(struct net_device *dev, - struct device_node *phy_np, u32 flags, - phy_interface_t iface); - -extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); -extern int of_phy_register_fixed_link(struct device_node *np); -extern void of_phy_deregister_fixed_link(struct device_node *np); -extern bool of_phy_is_fixed_link(struct device_node *np); -extern int of_mdiobus_phy_device_register(struct mii_bus *mdio, - struct phy_device *phy, - struct device_node *child, u32 addr); +struct phy_device * +of_phy_attach(struct net_device *dev, struct device_node *phy_np, + u32 flags, phy_interface_t iface); + +struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); +int of_phy_register_fixed_link(struct device_node *np); +void of_phy_deregister_fixed_link(struct device_node *np); +bool of_phy_is_fixed_link(struct device_node *np); +int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, + struct device_node *child, u32 addr); static inline int of_mdio_parse_addr(struct device *dev, const struct device_node *np) From patchwork Mon Jun 22 10:00:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11617737 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1702912 for ; Mon, 22 Jun 2020 13:32:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA24E206D7 for ; Mon, 22 Jun 2020 13:32:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="A8Vb/TwE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CCvNogU1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="PF+tNOmB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA24E206D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W004MhEM0OaUJvG4vTLTjyRLqmwqQ9bh71tzRq/Tde4=; b=A8Vb/TwEX6X5z7Wxx2uqH+gJg mn4pm+sY4u8dzVGapxqKa4zCvXc6sKP1/q3ERR5Ini/COdHLaTmi88vstvFWkKHWzlnnBDPdAYspg 4PR09EdX+Ur7HUjetYBr91vQPbpiuki1fXLsM5Fw5RuZNPXmsScNG88REPqVBoMm3jcky9kAxzxJ3 D9UGgVoxDsxEELaM9oIZBj8ZAEiZNzr53LsHI5kthd/YO+I6frrMddrUajx2KzM7A8sIYPJPmQd75 NJWFHL7jmCIsrIeZV3X+IvaZuE399XZVrz9MqhdflRrTTd8nnhT/NiGn3RpGWARM1U65z+nHXGFHF bEbZnDHfA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnMYg-00030Z-Kq; Mon, 22 Jun 2020 13:32:22 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnLwz-0004gL-Cq for linux-mediatek@merlin.infradead.org; Mon, 22 Jun 2020 12:53:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=0OwWR9e+WLqXjj7DZkBsabU1u86Gybrt82xzuKAKe9o=; b=CCvNogU1JsU5SrJsd9v8y2Sgx3 KqGMKoSDp7JoIJNrSfrDDwYz2I5RIuqDjz4wD/w52m4J7eFjPtri/53ZkNkaIXtt2DdfNcu4ax8dg Ol2eOlj3y9MKBS6vVBfX2MzoMIfTowY/dIupsYF9Bz/Rm03rWO0uteGnx62Mm1CwX3bENOL5NqYj0 cbcujsc4mHea+5A7huRoEZ2L2nSmjND28WxiRiyEGPgHJctt1TjixhRnUFUysgyxQYw0Nyf0zEb3a zuRJouwDtrN3Klm37n/MB27D3RG46fGXj8wygN5LCEMwIdvyMzFZ2LwR2Eez+RNTrYUMXyZUP6+cb +mvPw2fA==; Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGU-0004gV-Qg for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:25 +0000 Received: by mail-wm1-x341.google.com with SMTP id 17so523251wmo.1 for ; Mon, 22 Jun 2020 03:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0OwWR9e+WLqXjj7DZkBsabU1u86Gybrt82xzuKAKe9o=; b=PF+tNOmBYUtaXR59mgLImt5cydyQjc6gCPHU2lpTFbbnauDrYket1vtlbvya1ZFFaX gZcWbJjIa4v6QOhEmbOEpsuz/BzHnaMKaiIZawDoROmh5HVGhBYs/wDzYWqAlUjdnSUP UknHwa2e8E7lmYaNQ2ZInYopleBTBrQXkM3owc7xyhGa+IPJhFae9afW+yTnTVvNJVHO noPcA8CyypW5+/8+u8UidiqF8N8uVszPjCDi1HZeV9HdAcrfhH1rHUd12HGSNxazdHuY 1nHtMg93+nwFp/9FA+D2PC82dYeE4jCIN7biofp8SUU38ZY+Mu2iypl7deFI/1IGlFYE BSsg== 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=0OwWR9e+WLqXjj7DZkBsabU1u86Gybrt82xzuKAKe9o=; b=gxtBw6w7TSARcmzgSuWRIVsNp3vLTEREC2WhJXw3Ty9FvcyeLVk9KXyzPsbN0GXiYa D4SFVIdIGaXExwQvbHdCJeErq+QwcquHhKX8X5yLDf/y6Dl7gcQ1Ac27CWVd9xHyhAjw swpJfXhlc40uA8qWm2Zk3DsAJQ8G60BQMdO28yXZthm8oI2Z35b34fnFw1d8KOocHxI/ lUpczMuLuosdUDUA54EEZh/JKkFmOP+a1DgH0kNhMUuo3NOZq3bWHPURecXsFatkACP1 CI2QUt8UzLwulAHzWdRh9JFMPqEyk6jC60SVAaZ5+HdwLABPUNmjXL3smvqpMv11p/4/ 80Vw== X-Gm-Message-State: AOAM533tyIvLysT7c5tX5JbMNfSSgoXPu03W2j5aofdUR3qaNsmj+oFL gvO7zsv1VsWEpxDWePJ7S5q5JA== X-Google-Smtp-Source: ABdhPJwvA59r+zUadSM89AyF+H+fxT/nf2nvFkXIaFeBdOLpCsO/8Bm7rv3uF+bD/IjDwAb9EKnqCw== X-Received: by 2002:a05:600c:21d7:: with SMTP id x23mr18471470wmj.95.1592820082109; Mon, 22 Jun 2020 03:01:22 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:21 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 10/11] of: mdio: provide devm_of_mdiobus_register() Date: Mon, 22 Jun 2020 12:00:55 +0200 Message-Id: <20200622100056.10151-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200622_110122_976662_5E68A7DB X-CRM114-Status: GOOD ( 15.17 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski Implement a managed variant of of_mdiobus_register(). We need to reimplement the devres structure and the release callback because we can't put this function in drivers/net/phy/mdio_devres.c or we'd hit circular dependencies between module symbols. We also don't want to build this bit if OF is not selected in Kconfig. Signed-off-by: Bartosz Golaszewski --- .../driver-api/driver-model/devres.rst | 1 + drivers/of/of_mdio.c | 43 +++++++++++++++++++ include/linux/of_mdio.h | 3 ++ 3 files changed, 47 insertions(+) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index e0333d66a7f4..eaaaafc21134 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -343,6 +343,7 @@ MDIO devm_mdiobus_alloc() devm_mdiobus_alloc_size() devm_mdiobus_register() + devm_of_mdiobus_register() MEM devm_free_pages() diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index a04afe79529c..83e98c6ec96b 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -330,6 +330,49 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) } EXPORT_SYMBOL(of_mdiobus_register); +/* This duplicates the devres code from drivers/net/phy/mdio_devres.c but + * if we put devm_of_mdiobus_register() over there we'd hit circular symbol + * dependencies between the libphy and of_mdio modules. + */ +struct mdiobus_devres { + struct mii_bus *mii; +}; + +static void devm_mdiobus_unregister(struct device *dev, void *this) +{ + struct mdiobus_devres *dr = this; + + mdiobus_unregister(dr->mii); +} + +/** + * devm_of_mdiobus_register - Resource managed variant of of_mdiobus_register() + * @dev: Device to register mii_bus for + * @mdio: MII bus structure to register + * @np: Device node to parse + */ +int devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, + struct device_node *np) +{ + struct mdiobus_devres *dr; + int ret; + + dr = devres_alloc(devm_mdiobus_unregister, sizeof(*dr), GFP_KERNEL); + if (!dr) + return -ENOMEM; + + ret = of_mdiobus_register(mdio, np); + if (ret) { + devres_free(dr); + return ret; + } + + dr->mii = mdio; + devres_add(dev, dr); + return 0; +} +EXPORT_SYMBOL(devm_of_mdiobus_register); + /** * of_phy_find_device - Give a PHY node, find the phy_device * @phy_np: Pointer to the phy's device tree node diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index ba8e157f24ad..1efb88d9f892 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -8,12 +8,15 @@ #ifndef __LINUX_OF_MDIO_H #define __LINUX_OF_MDIO_H +#include #include #include #if IS_ENABLED(CONFIG_OF_MDIO) bool of_mdiobus_child_is_phy(struct device_node *child); int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); +int devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, + struct device_node *np); struct phy_device *of_phy_find_device(struct device_node *phy_np); struct phy_device * of_phy_connect(struct net_device *dev, struct device_node *phy_np, From patchwork Mon Jun 22 10:00:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11617805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A95D618 for ; Mon, 22 Jun 2020 13:53:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4203020716 for ; Mon, 22 Jun 2020 13:53:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="k2ADsfjv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="e1kh8HVm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="eaQDTmoI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4203020716 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0fRUKRV9q9ID5fzmfJXL+gLT0rIV/Flzp0xUl6BcCHs=; b=k2ADsfjvtB3in0eV6TLz5QsY8 Z6RNrRJib3DcLsglhWCxE9Y6tziU1CDLkUP0eOrOKegKUjGcxNNKHLG9FogChpmXWw1nQCKUaeqGV Wulm6A5t7MRtMK+7b7+kjq5+c3GeVdyUKaEFC9FBn1H9WpTECZ1nvJD17XSfJrEmZ2BPMVRv7rAsG 10xz9AibKxKadDYzg0bGujKouZpO/KQRA0Jk3QY6sz2eL2yg4OJt1ODBbhA4lJc75u2+Q0L2aw8Uo vqcA3TlmrZvx0z4zd7fXCTKzpuWDxgoqQTytmSIZiJYvbMIziL3f+lyqX6me39yIrJJKLP43CMJKM pJZ3bOK8w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnMtV-0000MI-Ao; Mon, 22 Jun 2020 13:53:53 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnLyc-0005LG-IA for linux-mediatek@merlin.infradead.org; Mon, 22 Jun 2020 12:55:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=7pEL+pOqyLTkwaRij99JSBZiVqVmOtzJ61ge9c76alE=; b=e1kh8HVmG/9XZ936pxD0X6Lz2N ETv1QoquDvcsTF/hY5wyXsOLS5xbbewQMR6sz14hjwsSwfLBrIAjhSc8e300lNQSwfwiyv9itshWU 7Su3Eqlc/ascqyYSEE1i2F8g6DEB/svJwXpAvgOtePRMjMbRzORuA+iPTwvqb5odYn1thCCQDqWH7 TumsMZ1CatecqWy0PNJQTZUUdxIJ5TzS3geo28DxDGUOLEJhiS2NsSXR1Ss4zxlpq2vxtb+0cYfEK dGKKMl69vt3scO2L76P7Kew6mNSUpns1eS0VjPTsRH18Fi0vlStiP1v9Ci3fbuqcTpkQeggSYqDnF vTC+vJeA==; Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnJGX-0004h0-RX for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 10:01:28 +0000 Received: by mail-wm1-x344.google.com with SMTP id x16so5121560wmj.1 for ; Mon, 22 Jun 2020 03:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7pEL+pOqyLTkwaRij99JSBZiVqVmOtzJ61ge9c76alE=; b=eaQDTmoIva7YgqUT7n4mmFYcgVR8tYbiSv+EsIHLIkQIJviMpTReLXYVtvFOol2q0e LdphqNn3acWhpQSuesmQgbP86SDv2CFnYiE9kY21eMu86QB0XYrJByJRId49gHAlMstK B4PEF9TayTWp8MPD7056GMzylW6Q4ubJ6zSD88ao0ofMVT8s1OPaucGSs+G1NKXCU30e StG0ZCrSCfsoa1hh3rlMOqh0cMq2OsJKG43o3A8mXuwgeMr2MQBldeFEmmaxo9KTVZVr OFBWf0C3jGOzn1RbJXOwkVbboUkef6zzBQaj44aHFBunXxesBGFG26tktECmHQNvp0dY 2sXg== 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=7pEL+pOqyLTkwaRij99JSBZiVqVmOtzJ61ge9c76alE=; b=nZd0+ZsrGL96aStt0oXpvkxiil0wogy/X0KtFD32h8mqKtWKpB+0G9UxHvSuD0H0oH sAqCKbNVEaPk4h6W/TEV61rz/56klmqrKFfyydRJ5jVcc6h2DcW8nWcUjOK7dVj+4UCI 3C7Vj7CXrIhXXqcbPOeDp8SLyI5QXsmt9xRQzUFUSp5bl0TEMdKAl3KnATkI9wGPT/fA dTY7znExpH5ZFKuksEH7Jlw925tNIiL2eaPxrK2X5G9zeH15qGcY06unNRh7xlUoZdgV 1fPKMDJC8LoJPQujEQLbsEAEsFi+3Rk9EQsmZKiCsAyylec9SrkmPrn2NeMTD8I6hV3D tIWQ== X-Gm-Message-State: AOAM532+S9VSzktNT+bcJGF1mkKwwbHN5+2nu6cnmnqPfrInSitMPT8C hIkPP43BvtkbWjjRwUdZteRY9g== X-Google-Smtp-Source: ABdhPJzbn3QUtTBkSaHKKRlQD+NAcxXoZjCO6pjuNjVVzgSeYV529/r6h+a5y21qbFYnMCH6f96pIg== X-Received: by 2002:a1c:804c:: with SMTP id b73mr699546wmd.59.1592820083830; Mon, 22 Jun 2020 03:01:23 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id x205sm16822187wmx.21.2020.06.22.03.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 03:01:23 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Realtek linux nic maintainers , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH 11/11] net: ethernet: mtk-star-emac: use devm_of_mdiobus_register() Date: Mon, 22 Jun 2020 12:00:56 +0200 Message-Id: <20200622100056.10151-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl> References: <20200622100056.10151-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200622_110126_074242_1C4C6D53 X-CRM114-Status: GOOD ( 12.31 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:344 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Bartosz Golaszewski , Stephane Le Provost , linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski Shrink the code by using the managed variant of of_mdiobus_register(). Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/mediatek/mtk_star_emac.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c index 3e765bdcf9e1..13250553263b 100644 --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c @@ -1389,7 +1389,7 @@ static int mtk_star_mdio_init(struct net_device *ndev) priv->mii->write = mtk_star_mdio_write; priv->mii->priv = priv; - ret = of_mdiobus_register(priv->mii, mdio_node); + ret = devm_of_mdiobus_register(dev, priv->mii, mdio_node); out_put_node: of_node_put(mdio_node); @@ -1441,13 +1441,6 @@ static void mtk_star_clk_disable_unprepare(void *data) clk_bulk_disable_unprepare(MTK_STAR_NCLKS, priv->clks); } -static void mtk_star_mdiobus_unregister(void *data) -{ - struct mtk_star_priv *priv = data; - - mdiobus_unregister(priv->mii); -} - static int mtk_star_probe(struct platform_device *pdev) { struct device_node *of_node; @@ -1549,10 +1542,6 @@ static int mtk_star_probe(struct platform_device *pdev) if (ret) return ret; - ret = devm_add_action_or_reset(dev, mtk_star_mdiobus_unregister, priv); - if (ret) - return ret; - ret = eth_platform_get_mac_address(dev, ndev->dev_addr); if (ret || !is_valid_ether_addr(ndev->dev_addr)) eth_hw_addr_random(ndev);