From patchwork Mon Nov 18 21:27:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13879101 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 9653E1D0DDE; Mon, 18 Nov 2024 21:27:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965241; cv=none; b=Ep6FohGFON61htI/bXWHuFb/cu3tdjI0WNePeMjcbBdoHPJKj+CfKMg6lPktP5YghyLmP8JYpouJfEI5hWsRj29FoIOZLk/37dwQapuNLMHizXB9Vb1NWdCGAI8kB0D8oHcHlPITlhuu+8DfLb0SpWG6frv2BFrYE1Hn7NPnSYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965241; c=relaxed/simple; bh=iRjLNPgDmXU0ZuDDvgb0y9voPktGU76lk4ona35Pyow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cncxy+w8WQz7X8VWbWXPZogu5+gW9NcExXLpEFb26rYV230yjk6sF6/CrlzZegAOJXukilv80Bi16SXJs05s/e9jAildfUycsp4dT1eMerfCLSgtJsZjqbMvsyOOw/CfTnC7TJapMTHO5nj7HVAWd2LwNeu6QbPiBiJ9DFCfezI= 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=GfZNILUX; arc=none smtp.client-ip=209.85.214.170 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="GfZNILUX" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-20c714cd9c8so21043495ad.0; Mon, 18 Nov 2024 13:27:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731965239; x=1732570039; 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=76UHKIQAAAPA6JLZt0grZFCa+jWHASsY2aHAhp9vWZ4=; b=GfZNILUXvwoeO7v6EqfM0lbe0atQLQ+y8G3vsCg24k1QTqojTUg/WQCLU1LGhmPwaK wWuH/jvkCPK4Q1W65u59E7ZgGubG4uEHeZwTjMIfrLguepg23VqeTlniujXf2aPsSehg 2A17PUyHhHPTKkoOcpNKfgcokE4wcEHUkto9V8VMHw/FbbliG3oUNf/uYRyRosQ/7Mng i4C3Q5ltnBhEQkm7XnWOoeaXE3Ql64ZnMElUjWws/7B1jZb42PUAsX2i0bCnMj4ASYtT OvldE0V3Z7uOk/XyaU+E8rj0htl9wQ6hPJ8bqBZcNs6/F39S9PxjG58gG9dZPzzfVUfK ORog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731965239; x=1732570039; 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=76UHKIQAAAPA6JLZt0grZFCa+jWHASsY2aHAhp9vWZ4=; b=g+nnMeKMUGsv5vM0JAtk5ws6s+zDXdFcwCN/Yw4dO5hahHoQqN2lKjHPFNAT/rIPiB x1QeB9V2FBTB2s2KqsU/8bXFsRWePh6YNdl/yt6/6zhI/NQRs+y4F2/t9HQQhALyAFQm ZQ0bgBfRrHNIZ31kpvVheZ4GShiMJZC1fcU8bnVAG5upgCbLMI20DsplfOw4vBgPpB4O vtBmVBcEYUGIGcbSTfcbp6veH7YAmF1qTw6TFKJYEHF65MzHp8y7oqk1JdgS60Txlc2i vWiWLQTuJJ/mwF1upaxkcoOzR3dXDNd76WNlc0epRI7HAD0ZJGlDGTBKIDOBep4nDv/h 0pAg== X-Forwarded-Encrypted: i=1; AJvYcCXF77TwxCH8AcKbzsQZ6RSu9WgfC/B/JZkeqk2tGSRK5BjhgbIj1bicj7Q0y2yeteq0oyrwrYDkINwARus=@vger.kernel.org X-Gm-Message-State: AOJu0YyzNOxESBT5x/0ODDHPnxtwYaH67j1hA3gPCSqIveoBTWa4aTZw FAhjidRb6lkCLCCy4CGH3IVEMfruMNF9GDwEm+ERjHGFQriF3BECZgRyYWKZ X-Google-Smtp-Source: AGHT+IFg4p9YzBLZWC1HdjgW8IYWRqrj5X6VXoRC7TGMmA3DT009mgnm8Fq/+atq9J8UbUJg+ISmUg== X-Received: by 2002:a17:902:d508:b0:20c:5c13:732e with SMTP id d9443c01a7336-211d0ebf9ffmr207065895ad.38.1731965238751; Mon, 18 Nov 2024 13:27:18 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211e4c48490sm50681455ad.38.2024.11.18.13.27.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 13:27:18 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Claudiu Manoil , maxime.chevallier@bootlin.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 net-next 1/6] net: gianfar: use devm_alloc_etherdev_mqs Date: Mon, 18 Nov 2024 13:27:10 -0800 Message-ID: <20241118212715.10808-2-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212715.10808-1-rosenp@gmail.com> References: <20241118212715.10808-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 There seems to be a mistake here. There's a num_rx_qs variable that is not being passed to the allocation function. The mq variant just calls mqs with the last parameter of the former duplicated to the last parameter of the latter. That's fine if they match. Not sure they do. Also avoids manual free_netdev Signed-off-by: Rosen Penev Reviewed-by: Maxime Chevallier --- drivers/net/ethernet/freescale/gianfar.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 435138f4699d..e486b77bc6f4 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -475,8 +475,6 @@ static void free_gfar_dev(struct gfar_private *priv) kfree(priv->gfargrp[i].irqinfo[j]); priv->gfargrp[i].irqinfo[j] = NULL; } - - free_netdev(priv->ndev); } static void disable_napi(struct gfar_private *priv) @@ -681,7 +679,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) return -EINVAL; } - *pdev = alloc_etherdev_mq(sizeof(*priv), num_tx_qs); + *pdev = devm_alloc_etherdev_mqs(&ofdev->dev, sizeof(*priv), num_tx_qs, + num_rx_qs); dev = *pdev; if (NULL == dev) return -ENOMEM; From patchwork Mon Nov 18 21:27:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13879102 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 C52041E7C1B; Mon, 18 Nov 2024 21:27:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965242; cv=none; b=mcJl+k+feNFGECMVJewDHQEamP3wHNgsv4KcglGjYW9GuymBg5KqEAENIQkevGSfW67Ojq7g/tPVMZTQ9G+8o2bh6EsA4CicSmenXdbx1rj98a8DW8vtfb+ZLA5Y6IUXzSnuVitvRoNE9d6h6JGQ3BTR57qMHwScg6wQGNU3jYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965242; c=relaxed/simple; bh=IXcltZehn2/3SyvTBeTFQotnSCT34NjXj0QE95LAAds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vgg+4CAiAemmtmK4YzGsSt7uIlvPxVvp2nw+lHP2EZnn+6z3h5tm4ITRRTiGlW3naF+HTkLOoHgMrIOa3e/2n1n65A+euvX/4Qifbibtu13BC6G7X/x8lSjrznfr4ZsYl1FT7tPn1kksBnrIVV/G3EFg1O/e4k14vmxWR6WpsCE= 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=M3P6DB0/; arc=none smtp.client-ip=209.85.214.177 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="M3P6DB0/" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20c714cd9c8so21043645ad.0; Mon, 18 Nov 2024 13:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731965240; x=1732570040; 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=2OGc9m7b1KRhFbZ7uSZDHwwlt5GMFJZQQcjtXg4RTOY=; b=M3P6DB0/2+BJv5YK1lKqAuM3ct9ivnHeqQ165PGkHxupMD31m6rwt2Dv6/ipsTNPpu qnIlKyXYOys0PaQxy98Pig+1rav60F5OET14idztb2EW8lzKSs/Dx+hZS7G82e+utlL8 BYwuSqtyKyhrtHmu+w/502xQAWNaHAT4MkAD018enXnIuJExlsizD/Xkp/Qhd669aigF Y2IeXTU7I7JSHrBr28uRWXbNWAJ/W8SH7yGyfcFagLsLdR58lEv2QZvrQ06V7krelxEP s3iOdobo+lPBPAnkruner1eKOa6/5eR0RLaPwEWb3M+J/k3QYpUBOK+f7SN9JdSgHYcq 3d3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731965240; x=1732570040; 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=2OGc9m7b1KRhFbZ7uSZDHwwlt5GMFJZQQcjtXg4RTOY=; b=sjSPGarx8c8iGykwA6IM2e8jkAeJz55xN1lO5KHQRmBX6OtPXogCc6vNJw/Wo8PwJ2 YMddCB4XiYhgukbgXJtOO0FruERspqavJ7AmofrqtBcjwxJ6SN8Kgj9+MUh+z74vy+t1 0Vnh7Og128NokzGUw1td0YFoA4yhICdEgjJPGHxCbIzwpRkbvtXqhNkoWQudfW67RnN7 CP7fpgFwQ5eS1CmWBSMg6GKJYqpI+JVY8NQT3EK+rGXPTo9KR+OfqtZoAx9HRFbqpGqi PJ0HXglUyo5Icy57oV0NKnrxJoo1Q9IKQaSlkdRCXrrzkyFXZs7VvgYNmxa2Ds6mFqip jECw== X-Forwarded-Encrypted: i=1; AJvYcCUK4ludBPwCzHMCLeB1st6AYx+ZJuutfIFKCK1RSNvb8BSDDvlenOtOtMTObhiF7sUTC1MWqf1F2KYaggQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzD4SIzBe9lGf34o65OJFjUek/bQHUvwYntnUUGJSoSdRJ/nfk8 uLnRQMTdX4D/Nrlad0IPr6Apx7J07WQZLCSVQQrCfN+2F4JR/2Narga6cDGt X-Google-Smtp-Source: AGHT+IEXyChbEnTIOAQHmNvWShE/OZleJ8erpeEtv+l0n5lLJ2/2mXkBv5OURjCEegWUlYwlEb9OGw== X-Received: by 2002:a17:902:ce81:b0:212:6a4:9b0 with SMTP id d9443c01a7336-21206a40f36mr108779305ad.43.1731965239958; Mon, 18 Nov 2024 13:27:19 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211e4c48490sm50681455ad.38.2024.11.18.13.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 13:27:19 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Claudiu Manoil , maxime.chevallier@bootlin.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 net-next 2/6] net: gianfar: use devm for register_netdev Date: Mon, 18 Nov 2024 13:27:11 -0800 Message-ID: <20241118212715.10808-3-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212715.10808-1-rosenp@gmail.com> References: <20241118212715.10808-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 Avoid manual unregister of netdev. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/gianfar.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index e486b77bc6f4..9ff756130ba8 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -3305,7 +3305,7 @@ static int gfar_probe(struct platform_device *ofdev) /* Carrier starts down, phylib will bring it up */ netif_carrier_off(dev); - err = register_netdev(dev); + err = devm_register_netdev(&ofdev->dev, dev); if (err) { pr_err("%s: Cannot register net device, aborting\n", dev->name); @@ -3374,8 +3374,6 @@ static void gfar_remove(struct platform_device *ofdev) of_node_put(priv->phy_node); of_node_put(priv->tbi_node); - unregister_netdev(priv->ndev); - if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); From patchwork Mon Nov 18 21:27:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13879103 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 297141E8840; Mon, 18 Nov 2024 21:27:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965243; cv=none; b=ZH6sCO9QNtrPi86VtX9lSZUsXsbshzz0Zy2up5WR2xF6aoYVM4fuPGsrt1rHHeUIueMhhGLTCorkOKk/J5BikBtfvqVbGPHs0nhafrWjjeg0YNWrEvgMrEdtHt7rpXWGPsID0uL1S/lQXQ5p3yry6IbuQP/aruj+FTzUVPsun2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965243; c=relaxed/simple; bh=Hg2YJCbKPvRfVlyXe4AKKc1T/lU4ZsS8zwKr1Q4Wu+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ilDyn/q1pRlyAZ9lFQT/zCHLG6eqseV19wg9hT8TQ3qbvkltWVJorUPNGrj7zVnY0qfF9du46Fmi97Z0kn3B8cj8omc7pbxnSZE9xj84fDEEZBTLXgxUwdPt02CcbjHi88M6LNY35zmEcn00yEWkqQVMafWsq68r+akWiB9E0x0= 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=IYOyYA6c; arc=none smtp.client-ip=209.85.214.180 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="IYOyYA6c" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-212008b0d6eso17445095ad.3; Mon, 18 Nov 2024 13:27:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731965241; x=1732570041; 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=JnM6r/uVITTRqw7KKlw64GThaVylgqvEAeVcWJSdEdE=; b=IYOyYA6cwqtcagrF1C/d/+nEAzSPfxxn7pEIiISrlKXUq6+CNplmXIsf0djd0kuSIM yMw0mgWLjM1W3xQFQ/5jbPLUFwzJCyFoc5O0gCuQ8fUh3CpNfwTxPhO+UoC0svRzcMw8 o5A71bgGQt9uqn7GaXOOkGi88kXIlIEJe+0j/r9deqz283/S5qMhidELtj2qJ03qDXmM xcfnnG7NGh7SC6vm+mn+bngxVPwrT+OZ+cy4CoDIiCRbS+GEBP8lQK4fXMV9FXJpoeDK /meIuFVl2ZxsvkPZWEQ7xvE4vVPdgXO78WwZFIVzICOhCb0mjLLyfnArnzsFM1v9TOIJ K4xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731965241; x=1732570041; 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=JnM6r/uVITTRqw7KKlw64GThaVylgqvEAeVcWJSdEdE=; b=FqUNbwOKusYOBaFEucc7onoMxDH+3pC8nKBKoKsydLIGH5aDP7ou/69YxeOt2alKU6 xvjsN5UdbY7kQg7NzdW5eZ6Ju85CRcJSEu9zee97feaB0LYMISueOJ7B14J81NQL/JhJ GP/QQGigWm0xQGr8pJ9WRyOVcHVa0b6kmF7pTM2eeTk6JKmPv28G9+j96pTIUySQkTqb KolrnpMNt1VhqfCeE/3jDeuqSaITSr3ysRfFbd20f63eYX+/yIoRMT3MAiUY7e8e0IxN H/KrRQtQ2K31q3LBPBhpOUeUU3fgiViHt+602SctWIptneOI72b1FBEA0wfTdi4/lLKh K20g== X-Forwarded-Encrypted: i=1; AJvYcCVuMRvLTcyOFdxbSEjrz+fJNSvTwmSl8EI8zYvUUnsy2LqLbwGrEHxg7oJtSkP9pXZxf6znJbrvxIt3l5E=@vger.kernel.org X-Gm-Message-State: AOJu0YxTd6FaqFMzhGsCIR3q4P1/Gy7U//gyOxqjq5Z7y+yh/MwyfYk6 f6Ku0N2sU8AA2M37aCAv6Z6OuN6Vb9VWYOQz1SM7oZ9x6ZmZb+XbKNO/U7bl X-Google-Smtp-Source: AGHT+IEwlKoO352VLH1G3bBhpD+GpkKZq3uHSUz2Sop/YQYmOKQ1JaIurcZWd27f1U+xqmQ0jSr2bw== X-Received: by 2002:a17:903:191:b0:20b:920e:8fd3 with SMTP id d9443c01a7336-211d0ebef76mr213177955ad.35.1731965241142; Mon, 18 Nov 2024 13:27:21 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211e4c48490sm50681455ad.38.2024.11.18.13.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 13:27:20 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Claudiu Manoil , maxime.chevallier@bootlin.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 net-next 3/6] net: gianfar: assign ofdev to priv struct Date: Mon, 18 Nov 2024 13:27:12 -0800 Message-ID: <20241118212715.10808-4-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212715.10808-1-rosenp@gmail.com> References: <20241118212715.10808-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 This is done in probe but not of_init. This will be used for further devm conversions. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/gianfar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 9ff756130ba8..4b023beaa0b1 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -687,6 +687,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) priv = netdev_priv(dev); priv->ndev = dev; + priv->ofdev = ofdev; + priv->dev = &ofdev->dev; priv->mode = mode; From patchwork Mon Nov 18 21:27:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13879104 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 75D881E9095; Mon, 18 Nov 2024 21:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965244; cv=none; b=meeXKWmAbkb1SqdBO+KV/hoWqzmkKOf6y2h4WySnQTqqRLQUaG22rzTFerTuUtfzJUnEcsJN5cOB4auN8KMtt830FJrfpYaQ02zquXLhG4AKU8x8pgII+h1gzsUPA1M1R4MjdIXBjqWZl+wdJAAHT30oz4Jv9YZpJk7EwicHub0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965244; c=relaxed/simple; bh=o29Loz/wKRoCklR+Xw7+059RvxWhYbZTaNT9c2QM0ew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rd+DLwbf5Rq91+W617s2E7tKx1j8oF6lXIPwhYnI3YEDmTocPI3YQRVpPebCf6aocj0uM5MltoVoNatBJLqlmb0iJKN1WMXy5/5CAbQM9h4Vyw0EhjOA+6/qMh3mI9tV6TWm/SVMKfCpG7OgwkxcuouAqv6kE/PnxTlHU2TzCr8= 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=isZ/E6eY; arc=none smtp.client-ip=209.85.214.177 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="isZ/E6eY" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20c714cd9c8so21044065ad.0; Mon, 18 Nov 2024 13:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731965242; x=1732570042; 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=GZyjhkLJ98gZ41XXUPuf7JMsN/z0ZiIcAJfeyap8K3g=; b=isZ/E6eYH43PZPMXGR9FCAY8xs4xPiMe5uGPMqMOru1XjweiAWLEIfyUkkDTSy64CC JYl2GPcCof1JfMfMjyaXco4dpAZB01Rae3quueBSWeyM6moPnVKIbBvIIsI3OF3zHFT6 ybHaCYgcbVspUvy5jBvtBOLKlQtiazoHbUCaW4ayXJ4NasvNIjCVv+TblCc6Ewelig3W MkCiu7cHvCA2DcWKbW1RStj2JkqvhpXAZqKGFR+pxY0UbghKddHO/4q3zeDDDQPW+PTQ Rd8w4GLA65jM7q2Sr2JbO50sP+dLWjm3INX17ORdhNsUW4rkirU6p+/ZDGMvsD51i8Jx Y/GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731965242; x=1732570042; 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=GZyjhkLJ98gZ41XXUPuf7JMsN/z0ZiIcAJfeyap8K3g=; b=AydGPGhWKanDvpoKwvGzRGjLo5O6qGsd8xJvqVd68eoQa3wpc7wXt0/wLnbqZ/KRon saH4iWpfqSc6OTdkMJohYPM2MjFiQ3OnhIoQeJB4uOApXrxLypaHi47cTFescjOrYjYD jshV/MsPAWbf+Op/e99Qar5ycFzlX+qSf/85rBEufjMs5g1z1jgXgu/nWuPlqsV0CcD7 ecjyQjuqMeAkvK7DEiWirlcj/My6iF3zmcCRVz39dUNZXedycohUOX7KqOTGuKYYR/yY 3cOU5bbxyoGnpoQT0SPV/AW1gMusNTyPqlqGUeTMOgwDXxhpFKDgTFFJlFfvgM3JqxGq veaA== X-Forwarded-Encrypted: i=1; AJvYcCXiOCr1adjcDneWHjh+sjVVTyz8+jTnFlI+9vssFocofQ9SzHxL3kHGIYw5pb8sOnIZTERUPWxbUQ4LxPE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7+lKL6OOu20zhRmUSZgkM8plGa5061aFvZS9NUho7jVp8UyQ+ hhtnUg2mb3i979o+u8gxy7usoulnvhoeNTVm4zsTkK15FkI4x6sItwtV0ZVG X-Google-Smtp-Source: AGHT+IG0Kur2muv6q1tSYo8C5H1hQUWXttelk3lUBeD6pMxvx1wwyTAZ008wpbQvavQpui6swAiwnQ== X-Received: by 2002:a17:903:32cf:b0:20c:774b:5aeb with SMTP id d9443c01a7336-211d0d6003bmr199577555ad.3.1731965242594; Mon, 18 Nov 2024 13:27:22 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211e4c48490sm50681455ad.38.2024.11.18.13.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 13:27:22 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Claudiu Manoil , maxime.chevallier@bootlin.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 net-next 4/6] net: gianfar: remove free_gfar_dev Date: Mon, 18 Nov 2024 13:27:13 -0800 Message-ID: <20241118212715.10808-5-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212715.10808-1-rosenp@gmail.com> References: <20241118212715.10808-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 Use devm for kzalloc. Allows to remove free_gfar_dev as devm handles freeing it now. Signed-off-by: Rosen Penev Reviewed-by: Maxime Chevallier --- drivers/net/ethernet/freescale/gianfar.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 4b023beaa0b1..4799779c9cbe 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -466,17 +466,6 @@ static void unmap_group_regs(struct gfar_private *priv) iounmap(priv->gfargrp[i].regs); } -static void free_gfar_dev(struct gfar_private *priv) -{ - int i, j; - - for (i = 0; i < priv->num_grps; i++) - for (j = 0; j < GFAR_NUM_IRQS; j++) { - kfree(priv->gfargrp[i].irqinfo[j]); - priv->gfargrp[i].irqinfo[j] = NULL; - } -} - static void disable_napi(struct gfar_private *priv) { int i; @@ -504,8 +493,8 @@ static int gfar_parse_group(struct device_node *np, int i; for (i = 0; i < GFAR_NUM_IRQS; i++) { - grp->irqinfo[i] = kzalloc(sizeof(struct gfar_irqinfo), - GFP_KERNEL); + grp->irqinfo[i] = devm_kzalloc( + priv->dev, sizeof(struct gfar_irqinfo), GFP_KERNEL); if (!grp->irqinfo[i]) return -ENOMEM; } @@ -820,7 +809,6 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) gfar_free_rx_queues(priv); tx_alloc_failed: gfar_free_tx_queues(priv); - free_gfar_dev(priv); return err; } @@ -3364,7 +3352,6 @@ static int gfar_probe(struct platform_device *ofdev) gfar_free_tx_queues(priv); of_node_put(priv->phy_node); of_node_put(priv->tbi_node); - free_gfar_dev(priv); return err; } @@ -3382,7 +3369,6 @@ static void gfar_remove(struct platform_device *ofdev) unmap_group_regs(priv); gfar_free_rx_queues(priv); gfar_free_tx_queues(priv); - free_gfar_dev(priv); } #ifdef CONFIG_PM From patchwork Mon Nov 18 21:27:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13879105 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 7587F1EABBE; Mon, 18 Nov 2024 21:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965245; cv=none; b=hkgM/WBvutIxMEHm5Oeyfg1GWXlQPr6XDwjTwGZNCnnUrcb8Dj3qVV2LAHghbGYkKMtfIUIetvDm6Z2RKJd5Jz35rkzRha3v/vTe3NLMHgPhnnnU+MEWSlTdA0j8ZulvHl1AN1IkYonD+U7rkyf4HVqgOEb/GavSKOQm8HhxThc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965245; c=relaxed/simple; bh=d5WVrbA2ZIXi7QcPy+mO8gXOberPzyE3RYUplpOiGoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gr2Z1uhnKtP2roAPMuX7RWP5mWWKPr7uDOCDeLVugvyIpu+uIEO0idWkPPSLbw7NG3KnpI8onPvXrpPDfJGvk0h8vrNs1R6JeFWpXjJhh3ITITh/abaROvkI1YSdD4ghiAJyg99HGleWZ4+4u6U4KAGL9bqrxzNs5a8mlmK/h2Y= 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=QKS5fkjr; arc=none smtp.client-ip=209.85.214.170 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="QKS5fkjr" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21210eaa803so17064245ad.2; Mon, 18 Nov 2024 13:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731965244; x=1732570044; 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=TY9xPEHIS8lZ7d7wfdwH0uN/rXxhSahcYAQWeagLArI=; b=QKS5fkjry5HcUFZVVeBibxxwAwNtIFbWI/hUcOCscIEBWZLKOhYrLXqBuPmN1EMGh6 +VIziHV20aY4pJ+ITP5YGdUWlXEI1a1272UGvx2xG0fazv9leMzQq5lwCZN5E6L97MkE Sk6aQ37AaoFBr9CWkyXOjcGjDS37VZPE4Vh9VJ7ttTDimr+tAXtYOqDZiRZy/Fy8RhiM oVnTYX0FAW14ZscXglDhGxgsd889lqWeaYPZWKFuFjeKQz3uJDKLUa3sC690BoeRI60A F7LqFizC8fgxuOVvarM/8f8ZsnbU4BhBpPXKQNf9AEu59A+SGscit7TzTx3Dnk5lHS3b 05jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731965244; x=1732570044; 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=TY9xPEHIS8lZ7d7wfdwH0uN/rXxhSahcYAQWeagLArI=; b=hxfAmCimTSqVvoBXj3oiUGpM3Qhu8gNxZBQjhHGLPHOjeKRxV5kXM9CxPemGnYS8ke qN4iILL47BnuJ67ZM1yKP3YJqRkqhh3he4K7wlETcv7CRLg84cOlHeRwBv+gKEFjoCBc rCiaFHXa7b/PdcT3P+M0pJndNYPsXhDYr1gK9FKtomPNu3WP0aSYAxFaOZnZheIEzbOB yX73ggrGQdZlvApDfQFftX9D5xJs91ofZPbmgD4kMMkj+7RXvsdxw0i4bcvw/uCnTDJ6 mpUMdpQXoYo9PnWE1UokXmVMlEQ5SntD4NZUMP/ArhvXupldtdYoAW5lPMDf/aGQFWr1 8P7Q== X-Forwarded-Encrypted: i=1; AJvYcCVQnlG+3yBNQ1Plt7f+HL3PExaZvhVpjLV7i8tzWkQF76EmhrWtDBPrME2lhQHYyJAoEQfN01nEUpkxGbc=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg1Hc38NwrulRxaeMopVF2MCJsGCRwDTtBeiwPr8NE4h13kioX lD4CHzgEtPsxHQ5HoDqthX0eNtpPMz8sFss7fqIWsn2Ilp5WFyh4a8+ClmWh X-Google-Smtp-Source: AGHT+IHqAZDOHOSlbBJMfVyIc7Aov2eDoOfssAJpNRUf3h+YmYRYabS1kA57JHvwICDjIcT7uACvog== X-Received: by 2002:a17:903:228f:b0:211:6b37:7e67 with SMTP id d9443c01a7336-211d0d5ff64mr191842835ad.9.1731965243828; Mon, 18 Nov 2024 13:27:23 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211e4c48490sm50681455ad.38.2024.11.18.13.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 13:27:23 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Claudiu Manoil , maxime.chevallier@bootlin.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 net-next 5/6] net: gianfar: alloc queues with devm Date: Mon, 18 Nov 2024 13:27:14 -0800 Message-ID: <20241118212715.10808-6-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212715.10808-1-rosenp@gmail.com> References: <20241118212715.10808-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 Remove the freeing functions as they no longer serve a purpose. devm handles this automatically. There seems to be a mistake here where free_tx_queue is called on failure. Just let devm deal with it. Signed-off-by: Rosen Penev Reviewed-by: Maxime Chevallier --- drivers/net/ethernet/freescale/gianfar.c | 38 +++++------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 4799779c9cbe..f333ceb11e47 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -412,8 +412,8 @@ static int gfar_alloc_tx_queues(struct gfar_private *priv) int i; for (i = 0; i < priv->num_tx_queues; i++) { - priv->tx_queue[i] = kzalloc(sizeof(struct gfar_priv_tx_q), - GFP_KERNEL); + priv->tx_queue[i] = devm_kzalloc( + priv->dev, sizeof(struct gfar_priv_tx_q), GFP_KERNEL); if (!priv->tx_queue[i]) return -ENOMEM; @@ -430,8 +430,8 @@ static int gfar_alloc_rx_queues(struct gfar_private *priv) int i; for (i = 0; i < priv->num_rx_queues; i++) { - priv->rx_queue[i] = kzalloc(sizeof(struct gfar_priv_rx_q), - GFP_KERNEL); + priv->rx_queue[i] = devm_kzalloc( + priv->dev, sizeof(struct gfar_priv_rx_q), GFP_KERNEL); if (!priv->rx_queue[i]) return -ENOMEM; @@ -441,22 +441,6 @@ static int gfar_alloc_rx_queues(struct gfar_private *priv) return 0; } -static void gfar_free_tx_queues(struct gfar_private *priv) -{ - int i; - - for (i = 0; i < priv->num_tx_queues; i++) - kfree(priv->tx_queue[i]); -} - -static void gfar_free_rx_queues(struct gfar_private *priv) -{ - int i; - - for (i = 0; i < priv->num_rx_queues; i++) - kfree(priv->rx_queue[i]); -} - static void unmap_group_regs(struct gfar_private *priv) { int i; @@ -687,16 +671,16 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) err = gfar_alloc_tx_queues(priv); if (err) - goto tx_alloc_failed; + return err; err = gfar_alloc_rx_queues(priv); if (err) - goto rx_alloc_failed; + return err; err = of_property_read_string(np, "model", &model); if (err) { pr_err("Device model property missing, aborting\n"); - goto rx_alloc_failed; + return err; } /* Init Rx queue filer rule set linked list */ @@ -805,10 +789,6 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) err_grp_init: unmap_group_regs(priv); -rx_alloc_failed: - gfar_free_rx_queues(priv); -tx_alloc_failed: - gfar_free_tx_queues(priv); return err; } @@ -3348,8 +3328,6 @@ static int gfar_probe(struct platform_device *ofdev) if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); unmap_group_regs(priv); - gfar_free_rx_queues(priv); - gfar_free_tx_queues(priv); of_node_put(priv->phy_node); of_node_put(priv->tbi_node); return err; @@ -3367,8 +3345,6 @@ static void gfar_remove(struct platform_device *ofdev) of_phy_deregister_fixed_link(np); unmap_group_regs(priv); - gfar_free_rx_queues(priv); - gfar_free_tx_queues(priv); } #ifdef CONFIG_PM From patchwork Mon Nov 18 21:27:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13879106 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 E0D901EC017; Mon, 18 Nov 2024 21:27:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965249; cv=none; b=eASmW2H1GA5kLSzFFViluieZXxERlGO9N9S25+4eN2XqaZHFlehzNOsH5f3oYdO8mdlu0hhdNS04Ywuux1OAze2DIT6AThS+4EwXwzynmXYfDDvZCLRGZL4MgKycF04fA/7veNi6pTBK2At1gNUNE6wvwNdMDpKn3i9+/GWhhKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965249; c=relaxed/simple; bh=//y4HhrPotue02nBUtPgcflgl/boQHqvOPQ9RixjeGo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bIoZaXtqj+sns+AC9sOa7oIz+30OUGZtsoT5lFSvQD9nuNp6C6gzcBFIS41u5DatNdQIJGHVOblKWr1EJ8YTWecbgFUh2q5+kz/SScCjo5xrpDI9utc3an+OGpvvM5O0XFE4NjU81CUFvTwMjTI1cs+J9Iw+84SVBrHGPvXt3PU= 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=mbEgTBmf; arc=none smtp.client-ip=209.85.214.177 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="mbEgTBmf" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2110a622d76so1412545ad.3; Mon, 18 Nov 2024 13:27:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731965245; x=1732570045; 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=0Y8CkbhLK5PllQroqtL9wsJUlt2pSyGEhrKOQZgaXUg=; b=mbEgTBmfw9UU6gStMA9Age3C73ZINucD8S036Vr4M3FO3HAHFnwBY9+/DAZuvKrzZL NngvW8lbsuUGQGN1/jm2tO6dUoBR1Vq/9sH0M81xWuWuhDk4wanoj9TWeJ4I6MLNX6Qr 7nEeoqHjS66tezEsEqwmGjcQYS7faOv3uBlmIE/aFR5sADaDNp8mQANdmjw6aWE5eZ9D CnQcRQJnclpecpQtzeP3/gO0lUbhEYL6ZfX5za+7/ucq5ovqUe+xWFG5zlpgQKhqgOze b9rJ2ITVZGYuzdVOBagGk/lRlfuTi8S+xgbRg3nY1vX+a4DJLBFnpJ4/7Qs3m9pQTa8v mOlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731965245; x=1732570045; 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=0Y8CkbhLK5PllQroqtL9wsJUlt2pSyGEhrKOQZgaXUg=; b=wrphUFF67hdDLJ2hTsVpmAF1vGdQPBJU/1xuPoMD8tQqxLGohsWuueIjaTjKZxUBHN 0XdMXvvXfEZZ5aZufHLogbSr9U0tVCo/JFpPvOjDuob+56tkjepvbgQEqHX3kZJZrEKZ 8Kt8xOekP5RA2i4WBrcTdv/rZv0zY2ce+n52BhVvx5nGmzFM2lgyPbHObn0PdEc+eM/F lbyrDQ3cwUkJnvszQMQKsPIDdWG0Sc2pVf30ccXK/OsJeL44NcFvvK5rFZD6615k9S7V IH6YobZ9mwJWqG8Wi/XYlCRiXF21ZsE+eCXb+hSQZ/3nZIodlND3TgRCdkhtv4y5iqyh jrFw== X-Forwarded-Encrypted: i=1; AJvYcCXgWnJhSLswNwjpK+ewSqylEPemcGUw1UEvrz2ndCCddc21sdSc57UNTC6JbwmSyjcLjOrf1qkvu3kwBrA=@vger.kernel.org X-Gm-Message-State: AOJu0YytUsFixBqDNax6AZ+SYrSv29dzPw++qJMZuC62aBHs/QRj6yGz m8EqqpivtZ4g/dtWGII3txma4RTHkEl1ZbsU52zRDGSx17CBJrOBlDdGPvDF X-Google-Smtp-Source: AGHT+IFSoR4L26mtGCz279nXOPwjTGPqxRzsJhJYaw9htne1+z6wXZfw1wlPcAYNGm+sDrTaFIgx4A== X-Received: by 2002:a17:902:f601:b0:211:ef94:7a92 with SMTP id d9443c01a7336-211ef947babmr111063075ad.55.1731965245050; Mon, 18 Nov 2024 13:27:25 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211e4c48490sm50681455ad.38.2024.11.18.13.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 13:27:24 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Claudiu Manoil , maxime.chevallier@bootlin.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 net-next 6/6] net: gianfar: iomap with devm Date: Mon, 18 Nov 2024 13:27:15 -0800 Message-ID: <20241118212715.10808-7-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212715.10808-1-rosenp@gmail.com> References: <20241118212715.10808-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 Remove unmap_group_regs as it no longer served a purpose. devm can handle this automatically. Remove gotos as they are no longer needed. Signed-off-by: Rosen Penev Reviewed-by: Maxime Chevallier --- drivers/net/ethernet/freescale/gianfar.c | 26 +++++------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index f333ceb11e47..d610adc485f7 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -441,15 +441,6 @@ static int gfar_alloc_rx_queues(struct gfar_private *priv) return 0; } -static void unmap_group_regs(struct gfar_private *priv) -{ - int i; - - for (i = 0; i < MAXGROUPS; i++) - if (priv->gfargrp[i].regs) - iounmap(priv->gfargrp[i].regs); -} - static void disable_napi(struct gfar_private *priv) { int i; @@ -483,7 +474,7 @@ static int gfar_parse_group(struct device_node *np, return -ENOMEM; } - grp->regs = of_iomap(np, 0); + grp->regs = devm_of_iomap(priv->dev, np, 0, NULL); if (!grp->regs) return -ENOMEM; @@ -700,13 +691,13 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) err = gfar_parse_group(child, priv, model); if (err) { of_node_put(child); - goto err_grp_init; + return err; } } } else { /* SQ_SG_MODE */ err = gfar_parse_group(np, priv, model); if (err) - goto err_grp_init; + return err; } if (of_property_read_bool(np, "bd-stash")) { @@ -729,7 +720,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) err = of_get_ethdev_address(np, dev); if (err == -EPROBE_DEFER) - goto err_grp_init; + return err; if (err) { eth_hw_addr_random(dev); dev_info(&ofdev->dev, "Using random MAC address: %pM\n", dev->dev_addr); @@ -777,7 +768,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) if (!priv->phy_node && of_phy_is_fixed_link(np)) { err = of_phy_register_fixed_link(np); if (err) - goto err_grp_init; + return err; priv->phy_node = of_node_get(np); } @@ -786,10 +777,6 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0); return 0; - -err_grp_init: - unmap_group_regs(priv); - return err; } static u32 cluster_entry_per_class(struct gfar_private *priv, u32 rqfar, @@ -3327,7 +3314,6 @@ static int gfar_probe(struct platform_device *ofdev) register_fail: if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); - unmap_group_regs(priv); of_node_put(priv->phy_node); of_node_put(priv->tbi_node); return err; @@ -3343,8 +3329,6 @@ static void gfar_remove(struct platform_device *ofdev) if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); - - unmap_group_regs(priv); } #ifdef CONFIG_PM