From patchwork Tue Aug 13 17:04:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13762360 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EEDD37E; Tue, 13 Aug 2024 17:05:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723568733; cv=none; b=Tvfjef9fcokQg+zRu4mhLw5dV7j/1rJbiSSFwnLBsFPshJ/VYq9+ug2mRT0xMEAtXI1xRJrbUu1axDXeZyV5ra/ykbCqCVOAiKc+RK9c3WtUpqsaS10IyYoxrW7rTFPd/XSh+iBvLw/lphZJKPik/uHDVcasCWXlAqgiiOHA4tY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723568733; c=relaxed/simple; bh=li6ot2ljL+bgvf9jRRm9Sp0DTwQJSC5oDY9A48rydas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fbPjpnfkq2KbMzVkZr7W3v2IY1NxdKRUiIv1KF8HUMr/ifC3rmne08XNuht0eis+7+XEX/a9LRZHbgMu3EYPeFvhy+7wgvXq59Blqm+FcLYYMgedZB8tn1Jj+4Vo6zZd8dJlzeqYIRzlhZceMB4O+L2wCFolXgVYEcapsHBcTaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AVzvZU/z; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AVzvZU/z" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-7a1e4c75488so344633685a.0; Tue, 13 Aug 2024 10:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723568730; x=1724173530; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vES9TC9dqxR38Zom8cCTR4Q9JQRRx8777KIJEbij9E8=; b=AVzvZU/zEiO2KkxCKcumO13Q4bSkaYmMj4mkss9b/7yVALEWrOngBBfQ8I+Ko1V2Bl nilmkW2w08dIBpyWzSMrZUanp2OfRMkK/xtphP6KuaOk9Jy3cyGY100DdxJtsN8LB3MZ ByHbJBymE55bntA4m7DKbZwbqSXZ917HuBDJo8428VRzgXpp79gHQxQ0Psv9veheElCr 1M0Qr2jGbkjPs1xMPvcdk5LenMHLyXvPL/arwLPD2yTwLLDOb7K82Z7IP6VTU+sZ8L46 vSb+cmDawRXLUtrED12oaLKoCfMDOeEQj4mrysYhd+ucIkJAs7cvDOhQk8q63DtzweiH aGoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723568730; x=1724173530; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vES9TC9dqxR38Zom8cCTR4Q9JQRRx8777KIJEbij9E8=; b=kaypTkSDCdSzOSR2xHo9aOUUxtmHaODZFNVj06KkTqzt3ra7CaS8UPj3Mxy2I1upv7 iGglGZkzaGTy8Rjld4FD7am4wUQmAOijhmIV9RBy2jxf1sGm81zQocJdJeyP/sKNzq+8 Oz6emV5UltCKs2cOvpxifkq++pIOr3f2TD65Q5QnZ7h/x5UBdad0w855Gt3BVjmvcHJ4 WcU31IneRaA6sTJnXZsI0k3+nzNs1+kFpVjcfTdgtX6Wgrn9rweLPupTaYKxAJnGXqhA SJIPmYbkRknrNs0U/SWeb6eGQNUOeWs/BvLqRdpTUAKMdShM0ec3RQ7oUsXCDZzxGq1V jqZQ== X-Forwarded-Encrypted: i=1; AJvYcCXGpvFsCTw7IqilxVZJogx7c5ah505n67fBcbvhc/apjldGzDeMYeOe5F+1NHwUlW0BxHE3laOI3ugtzcgPfa6OMMN9e+c1gUzz9b80 X-Gm-Message-State: AOJu0YzqTCg8oCa79pYMjfV1XytKDV65yGcHQcxcDw3sDffJtLD1l99a RN0ZgYc3scKfi4i3N08sZ/jCXaBzQGzghRH+DZjKHPPFWUzgo8BsCl32rq2d X-Google-Smtp-Source: AGHT+IGFbjA1+xKemYdWOqR1BhN9JsERfAczIqba/7HmKM5wzTEvTHSZTPAfxsLTvNz48JlWNkZZ4g== X-Received: by 2002:a17:902:c94d:b0:1fd:a360:446f with SMTP id d9443c01a7336-201d65c0d14mr2116465ad.65.1723568719484; Tue, 13 Aug 2024 10:05:19 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201cd1a947fsm15946425ad.140.2024.08.13.10.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 10:05:19 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, o.rempel@pengutronix.de Subject: [PATCH net-next v2 1/3] net: ag71xx: devm_clk_get_enabled Date: Tue, 13 Aug 2024 10:04:57 -0700 Message-ID: <20240813170516.7301-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240813170516.7301-1-rosenp@gmail.com> References: <20240813170516.7301-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Allows removal of clk_prepare_enable to simplify the code slightly. Tested on a TP-LINK Archer C7v2. Signed-off-by: Rosen Penev --- drivers/net/ethernet/atheros/ag71xx.c | 37 +++++---------------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c index 6fc4996c8131..e46d10a5c28c 100644 --- a/drivers/net/ethernet/atheros/ag71xx.c +++ b/drivers/net/ethernet/atheros/ag71xx.c @@ -691,29 +691,20 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) np = dev->of_node; ag->mii_bus = NULL; - ag->clk_mdio = devm_clk_get(dev, "mdio"); + ag->clk_mdio = devm_clk_get_enabled(dev, "mdio"); if (IS_ERR(ag->clk_mdio)) { netif_err(ag, probe, ndev, "Failed to get mdio clk.\n"); return PTR_ERR(ag->clk_mdio); } - err = clk_prepare_enable(ag->clk_mdio); - if (err) { - netif_err(ag, probe, ndev, "Failed to enable mdio clk.\n"); - return err; - } - mii_bus = devm_mdiobus_alloc(dev); - if (!mii_bus) { - err = -ENOMEM; - goto mdio_err_put_clk; - } + if (!mii_bus) + return -ENOMEM; ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio"); if (IS_ERR(ag->mdio_reset)) { netif_err(ag, probe, ndev, "Failed to get reset mdio.\n"); - err = PTR_ERR(ag->mdio_reset); - goto mdio_err_put_clk; + return PTR_ERR(ag->mdio_reset); } mii_bus->name = "ag71xx_mdio"; @@ -735,22 +726,17 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) err = of_mdiobus_register(mii_bus, mnp); of_node_put(mnp); if (err) - goto mdio_err_put_clk; + return err; ag->mii_bus = mii_bus; return 0; - -mdio_err_put_clk: - clk_disable_unprepare(ag->clk_mdio); - return err; } static void ag71xx_mdio_remove(struct ag71xx *ag) { if (ag->mii_bus) mdiobus_unregister(ag->mii_bus); - clk_disable_unprepare(ag->clk_mdio); } static void ag71xx_hw_stop(struct ag71xx *ag) @@ -1845,7 +1831,7 @@ static int ag71xx_probe(struct platform_device *pdev) return -EINVAL; } - ag->clk_eth = devm_clk_get(&pdev->dev, "eth"); + ag->clk_eth = devm_clk_get_enabled(&pdev->dev, "eth"); if (IS_ERR(ag->clk_eth)) { netif_err(ag, probe, ndev, "Failed to get eth clk.\n"); return PTR_ERR(ag->clk_eth); @@ -1925,19 +1911,13 @@ static int ag71xx_probe(struct platform_device *pdev) netif_napi_add_weight(ndev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); - err = clk_prepare_enable(ag->clk_eth); - if (err) { - netif_err(ag, probe, ndev, "Failed to enable eth clk.\n"); - return err; - } - ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0); ag71xx_hw_init(ag); err = ag71xx_mdio_probe(ag); if (err) - goto err_put_clk; + return err; platform_set_drvdata(pdev, ndev); @@ -1962,8 +1942,6 @@ static int ag71xx_probe(struct platform_device *pdev) err_mdio_remove: ag71xx_mdio_remove(ag); -err_put_clk: - clk_disable_unprepare(ag->clk_eth); return err; } @@ -1978,7 +1956,6 @@ static void ag71xx_remove(struct platform_device *pdev) ag = netdev_priv(ndev); unregister_netdev(ndev); ag71xx_mdio_remove(ag); - clk_disable_unprepare(ag->clk_eth); platform_set_drvdata(pdev, NULL); } From patchwork Tue Aug 13 17:04:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13762362 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 247F81A38CF; Tue, 13 Aug 2024 17:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723568750; cv=none; b=PfKrNgQu3SU+bEKB2DR03EgrFLF0oOfjIvbPomCmNujRJZ9v+8puRMySJ2Aun7e3X5+rhWeESmIoL+aY8sNmm8uZsp6+ZJzF3HHfwGMe1C98J+LMPq4GxQW+3WWvKtIiiKkRBu+x1DWYmLIJT3rRaPoG6pVTt7ZNfssrDCNN//0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723568750; c=relaxed/simple; bh=MV7R+YHOXi/XcXGkohMCd1CQNmhYlhc4ACiUh5bMITI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W6o5JX1hskEZMyQI8Vij1UW9lCZRU9C+NyJmzWUI2nG4QcGxZi4YJCrGlqjlU5ExGo3ZfZiCw7zX8P3aeVLuw40hG+OGdyV8WzKX4PDprpOUfSDpY5xoicz/jb/O8IevFNLAbCnR2RKXHynvOHdGUT8tLzofq7cnz0KgtkYMG8U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eXzG7fkd; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eXzG7fkd" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e1137aafb8fso1759012276.1; Tue, 13 Aug 2024 10:05:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723568748; x=1724173548; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7JMjZUt3IuyFMwoZfgrbYg424GOy4cvItQgw2J2lg7s=; b=eXzG7fkdp7XOxY5eBoSz1NdjWvlVgY6ChbS219ASyT0dNd2IedlXF5iD2miFYFF5/L h7wZsJEMzvd4alQJtUxPyWSj7s0yeo99xvVcTEjSVlcrs6qjySO8IMM25GNm2Sv22aiV Zb6LWpCWRBgGgXa3WHYqCJ92hDPxbfw5OGBin8W1vHY+nBbaQ+UyXjMxrHY13G/2+Lif /l+umvxfE1kAGTvZx86IrzjMErewHtB8BbpwjPTSjcjDqEH1+zSU+shQnFkdyrOUGmu9 7BeD3DvsssAbW2tG8FFu8XEqR7oggZnhXhg6yg3ENNV1uFHQPoT2SMRdDiYhTpCBfEtl iz+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723568748; x=1724173548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7JMjZUt3IuyFMwoZfgrbYg424GOy4cvItQgw2J2lg7s=; b=omvD5THDO3BZWArUrC1jnez0nL/i1PRl5EFbqvjtf0Si1oW9ap70cl3Okdfv2XJAJP 84eE2uO50r3iUZeBODnCID4de7dRYxP9Vg79bTw7LHylc0EmfpO3h/fWXUvSe18X3acT /KxTXmbz+kTIKsYU9gt0Kz+WgMcNC36Z96Hjq5U+J4M8RL198ux9ZIMViAV2BrduLadS Hs/WguWG5bMdKYV1dozbt1Dy4ACpP4LbXbcmcS3oipAv8fUDBTYFZHNkosoYFbyMWKI7 SX9lYSA5kAvbkqR/DnnYMHy761opurWpCwWmQm4MHSQE/bOlrdIzgtwZGMSD8r+kJZIc YR7g== X-Forwarded-Encrypted: i=1; AJvYcCX2iJZruRuVbmOsKp0oCsjcltXRtXO1Q7ZahteGa2j+oizPvNbCMWBojenJ57xlh83n9j+HJSrh6EPYulY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9l/IF6WL2QdhP5goBm9feHDETFtqyqf3OUz7Ph/UXOoiffUqs j1btcmXB6TmpMrHVrQJbYucJLRPMqrrhLZjBSTSv+jQtTt/dUX6aC0+J70j5 X-Google-Smtp-Source: AGHT+IE857ZQNVM5Az50U2+fcTIxGCe7unJr02UBjY5k+PZt+fgbvFARTkowtKSRPy7bGkE+t99C2g== X-Received: by 2002:a17:902:ccd2:b0:201:d659:4c29 with SMTP id d9443c01a7336-201d6594e80mr1475875ad.21.1723568720796; Tue, 13 Aug 2024 10:05:20 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201cd1a947fsm15946425ad.140.2024.08.13.10.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 10:05:20 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, o.rempel@pengutronix.de Subject: [PATCH net-next v2 2/3] net: ag71xx: use devm for of_mdiobus_register Date: Tue, 13 Aug 2024 10:04:58 -0700 Message-ID: <20240813170516.7301-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240813170516.7301-1-rosenp@gmail.com> References: <20240813170516.7301-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Allows removing ag71xx_mdio_remove. Removed ag.mii_bus variable. Local one can be used with devm. Easier to reason about as mii_bus is only used here now. Also shrinks the struct slightly. Signed-off-by: Rosen Penev --- drivers/net/ethernet/atheros/ag71xx.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c index e46d10a5c28c..3c16f6c5e75c 100644 --- a/drivers/net/ethernet/atheros/ag71xx.c +++ b/drivers/net/ethernet/atheros/ag71xx.c @@ -380,7 +380,6 @@ struct ag71xx { int mac_idx; struct reset_control *mdio_reset; - struct mii_bus *mii_bus; struct clk *clk_mdio; struct clk *clk_eth; }; @@ -689,7 +688,6 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) int err; np = dev->of_node; - ag->mii_bus = NULL; ag->clk_mdio = devm_clk_get_enabled(dev, "mdio"); if (IS_ERR(ag->clk_mdio)) { @@ -723,22 +721,14 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) } mnp = of_get_child_by_name(np, "mdio"); - err = of_mdiobus_register(mii_bus, mnp); + err = devm_of_mdiobus_register(dev, mii_bus, mnp); of_node_put(mnp); if (err) return err; - ag->mii_bus = mii_bus; - return 0; } -static void ag71xx_mdio_remove(struct ag71xx *ag) -{ - if (ag->mii_bus) - mdiobus_unregister(ag->mii_bus); -} - static void ag71xx_hw_stop(struct ag71xx *ag) { /* disable all interrupts and stop the rx/tx engine */ @@ -1924,14 +1914,14 @@ static int ag71xx_probe(struct platform_device *pdev) err = ag71xx_phylink_setup(ag); if (err) { netif_err(ag, probe, ndev, "failed to setup phylink (%d)\n", err); - goto err_mdio_remove; + return err; } err = register_netdev(ndev); if (err) { netif_err(ag, probe, ndev, "unable to register net device\n"); platform_set_drvdata(pdev, NULL); - goto err_mdio_remove; + return err; } netif_info(ag, probe, ndev, "Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n", @@ -1939,23 +1929,16 @@ static int ag71xx_probe(struct platform_device *pdev) phy_modes(ag->phy_if_mode)); return 0; - -err_mdio_remove: - ag71xx_mdio_remove(ag); - return err; } static void ag71xx_remove(struct platform_device *pdev) { struct net_device *ndev = platform_get_drvdata(pdev); - struct ag71xx *ag; if (!ndev) return; - ag = netdev_priv(ndev); unregister_netdev(ndev); - ag71xx_mdio_remove(ag); platform_set_drvdata(pdev, NULL); } From patchwork Tue Aug 13 17:04:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13762363 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 009E91A2C01; Tue, 13 Aug 2024 17:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723568771; cv=none; b=XdTm7ZT+XyWO+rqm3BORCGs8Mv1par/4u9BCsYnuJImPQRMp6moxphdhDmcR/3dMQ3vfKNUzYhNoQ8m+l5mdzsHUk1ckPBgyBAGKUG9OS6fvZ4j/o2ZfcCZV9rk7wP57i27C8hTzyS1jvIoHV/tRZt57/9C7wICE/9hmvAeit4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723568771; c=relaxed/simple; bh=dWbaslV3ImDpvRvaMLnGXkIpncnPCFLL0dppXw0Goew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m16FTV0WgZHbbIK2dXqiC++WbwWnfC64wZpZGZU4yYdhCunSy/Ehf2Ehij62BUMmLmJaRxeWLm0IXO4V6JHKwAaqMvghEAq5fQtu12sUy3LIhOC2mkTxgOw8AZLzzh/tbvCFLeNrdFU8FPA7nYWfXZmIloKIu2aib45RiyQkOAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DPOxKoGm; arc=none smtp.client-ip=209.85.166.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DPOxKoGm" Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-81fbbd4775bso222883839f.3; Tue, 13 Aug 2024 10:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723568769; x=1724173569; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c0sZsb6ltlwXBeuXfPHSdXrF6cY3aDT1sNvM6eUoQL8=; b=DPOxKoGmAMfATjexjiknVR3UCwIrZEYjPdIVbMAMFaTTVCHruFPIJmmWlhbE6wtI0q 7IAs5/VV2tsL9O+dD7jMzzx3cG+p06K+jP6e5bA62YC9TnCU1slINY2WmOyM6xPk9mk3 LXDBkcMbE6XzV7uX6r+GYLCE6BJwf/wdfkPzH43gtxW5AoVpB2DenOzn7YSXkmJy+SSc AGwCs2nL0UsIY5iHiWCs6rfGOZWeYWOLoNwq9Xq4w+fscPGQBNYOX50Ff92S/NAN2JQ8 RDKoMQexuxy7pJf15KjNASFWjXe+NH41RGnS6ocbznbIOaq/NEvo0wp2eVbJiquO3gBj +5ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723568769; x=1724173569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c0sZsb6ltlwXBeuXfPHSdXrF6cY3aDT1sNvM6eUoQL8=; b=VDMCkWkblT+zpvS1kTVzm17Ib4b9JHPRoHXjVgre28CGDv0CqEJAdLrtAryFA9f45W H54iY/Nt/XukeWTHkZuGEB7ABs9pMUHiJOJkmTw5sUg1YWfmRVfTuui+FUsTcDS6QXsk JjqtSbca7ExerzZWPGmenOo5kdTOnqrGRwtffo5UnZvasYvrN5jybu5DkgMy+g2ZbS/z j/tAuuxo6rMTV4LD/feg4gm7n32LX98he9Y4+/SyYkHqtSe5/QlsfXSI3lrnD/wESP/8 ZiHWUTzoeF4VoW8InJrDtEqfejFewW1MCocGoo374WTdPm1smTPfMnJW+pWAXjRgy27r hnJQ== X-Forwarded-Encrypted: i=1; AJvYcCWUz+MwPqkUzJwpwLepH14vuUaIouo6Z6BZvowtDVFXXSkOK1zjxGdmF9JkYhZGwbguAiULj6fvtD4bR+dxRg0GxAfoJ6p3NEl6i3dZ X-Gm-Message-State: AOJu0Yxi4Y2dawkcbVhyhLBzLLwoz42bfddEafJ7XvQHq0tFanXMb9/g 5KGW1Jv0M32/x6pA8b6sMVTVwe4ZQ9YY/kVfRZbEwT8/oT4nbDAwlRvG/kLI X-Google-Smtp-Source: AGHT+IESjOSkHOg1sqqE8IWaty0EbuhRg33ls2pxHZr3llzO5NHrG0AsvgMrxRBsP/ADgZRQADvFBQ== X-Received: by 2002:a17:903:1208:b0:1fd:a0b9:2be7 with SMTP id d9443c01a7336-201d638d72fmr2751805ad.13.1723568721909; Tue, 13 Aug 2024 10:05:21 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201cd1a947fsm15946425ad.140.2024.08.13.10.05.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 10:05:21 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, o.rempel@pengutronix.de Subject: [PATCH net-next v2 3/3] net: ag71xx: use devm for register_netdev Date: Tue, 13 Aug 2024 10:04:59 -0700 Message-ID: <20240813170516.7301-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240813170516.7301-1-rosenp@gmail.com> References: <20240813170516.7301-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Allows completely removing the remove function. Nothing is being done manually now. Tested on TP-LINK Archer C7v2. Signed-off-by: Rosen Penev --- drivers/net/ethernet/atheros/ag71xx.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c index 3c16f6c5e75c..b74856760be3 100644 --- a/drivers/net/ethernet/atheros/ag71xx.c +++ b/drivers/net/ethernet/atheros/ag71xx.c @@ -1917,7 +1917,7 @@ static int ag71xx_probe(struct platform_device *pdev) return err; } - err = register_netdev(ndev); + err = devm_register_netdev(&pdev->dev, ndev); if (err) { netif_err(ag, probe, ndev, "unable to register net device\n"); platform_set_drvdata(pdev, NULL); @@ -1931,17 +1931,6 @@ static int ag71xx_probe(struct platform_device *pdev) return 0; } -static void ag71xx_remove(struct platform_device *pdev) -{ - struct net_device *ndev = platform_get_drvdata(pdev); - - if (!ndev) - return; - - unregister_netdev(ndev); - platform_set_drvdata(pdev, NULL); -} - static const u32 ar71xx_fifo_ar7100[] = { 0x0fff0000, 0x00001fff, 0x00780fff, }; @@ -2026,7 +2015,6 @@ static const struct of_device_id ag71xx_match[] = { static struct platform_driver ag71xx_driver = { .probe = ag71xx_probe, - .remove_new = ag71xx_remove, .driver = { .name = "ag71xx", .of_match_table = ag71xx_match,