From patchwork Mon Dec 2 21:23:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891319 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 6FED21DF26D; Mon, 2 Dec 2024 21:23:35 +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=1733174616; cv=none; b=SPzBFJixvAaK52kY2Hv72N/dXMTcpMKCRP95jbhfExQmlwm4fMSMqbOCI98QWZn0gTLxcKvNS2eGLGRNe/tIFMobfxRc646pERrwe8vagXhCdrQqqT8ySNoPpSMoFIia09x7Aqw3phLigFtP6darZEu/y+sXWrDtv93WLqi17vg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174616; c=relaxed/simple; bh=pu3JL68bu1cSv6fdM/I/ECn8R8R6/lc6ICYA0qYjMkc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rc7wUrLtnbuI/42vDUSCD5iuBQDV4DqOcqIPydC08SAvi4EDqA7PxL1Ic1IWgWbDFAqaLm7hPBOh7/npzyrB+2PAlP/bsgj1KBvtMoPgUnS7FbnQ2oDdeUSXws/gkutnjVeD0F4797qpgNWWrDik82RajRMOjx1fbZ5JtfcIxYo= 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=XRWf2WUS; 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="XRWf2WUS" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2153e642114so32538905ad.0; Mon, 02 Dec 2024 13:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174615; x=1733779415; 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=RYLEpqANoyEmd5NTjy3oJeHuyxF++RP3Dua5hSNSzO4=; b=XRWf2WUSLR9HOlUN5XoUGEDLRGL0YR99vZUR47kED5NVDsPd+GxbHhjlGWm4KNEHv/ 0/XE/g+MR6B3CiTGwpqGz2oo5udEkoaeiGysscvZCAlsHCOaxpbTqi9xOuFhBA74MEfm FjX9yzeImtukRTqHSSHpqBhJk76aL0ti3N4K4Ez+55cCR12OMp+CkB5z/N88SjwIzdfr pozhOXBsL9dyJgdHykrHi9YG2ucbH1R1avIggq/QXtsZfJ3aUthVYjl8CRLmxtqnI25M KEHmtd0CK1HV0wzC1DZvnnnqxb2Po57YLKVpR7xOUElhaDwtH9m2LjqmPNMhHo55JZrE dXkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174615; x=1733779415; 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=RYLEpqANoyEmd5NTjy3oJeHuyxF++RP3Dua5hSNSzO4=; b=arlmFpB2dFak2NJ+1KhwlgaWATbwsyXORDZsY5Jh1X7ZAmTTsBXQF4L2b8aGkrj4tV QJSWM7lgPRclnhIRtYFuNQC5zsBf6Hi2bmzEz9a3Zz6fwKBwUW+5knIyzXKbIE8V1Y18 GqHUz9gZmZlSQyJaUTk1VoDwSctysF6kKxFdMiJ19SEj2IdqVCK9BO9bn9eqyl/qd01C uh2dt9visGmrc4AzgfSGIDAAX4CeulEhfrtnZChw/I2ny2QgiOXoYupZQGF5RD+03OvT efLbIIkg4uWUfIDCIstRptRXqZjZCgX1DxZ12bSla2WUuYHaNCQCQLodqCF4sufqs9jS muDw== X-Forwarded-Encrypted: i=1; AJvYcCUCyhOytCdSiMxaPprfktWHZ/YzWQNKGwfP4U8iYMAh4zIrUsoIrGyaDbMN6aq/jgc7JaFqWEJ8QlXOcFI=@vger.kernel.org X-Gm-Message-State: AOJu0YyjkkFQqYM8lI6q9X5QVWDBl6dinet2rlp/5/7ATCzHSULosldA EnF0aa+Z0ADe+7mC7ajeH+ie+I+gbjCXefdH6NEjDxXoRfddsgMEsBtJK9gH X-Gm-Gg: ASbGncs+qNmk5wfnqhtp3tJJHKcLGnV41mDVIy7j5rKGAFy1EmQcfK5VPRRW69+i1eO 8Rr31slymMiZvy1AUkYpI/zDebLJH89dzT9b+GQDmCSl2ZyycvBm4E7r2Kuue65/RwcuBa/lDnj ib4TheNztJzm0udnw0nfeTib0CuB9THfErx6Es1uzs12nDDvF5p1S1H3mmL+lh6xTpMmho1x4WI 3/wsf2KXMyLHAIzm8lziENYbA== X-Google-Smtp-Source: AGHT+IHFfS3IU2Gj69V4BiMoyDgoz3RJ/anNr/fXp6LjBWwKcyPZQCzA9WannTWRwJSGYwqzHwoUlw== X-Received: by 2002:a17:902:e5d0:b0:215:5a53:eded with SMTP id d9443c01a7336-2155a53eff1mr175456915ad.39.1733174614781; Mon, 02 Dec 2024 13:23:34 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:34 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 01/11] net: fsl_pq_mdio: use dev variable in _probe Date: Mon, 2 Dec 2024 13:23:21 -0800 Message-ID: <20241202212331.7238-2-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Moving &pdev->dev to its own variable makes the code slightly more readable. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 56d2f79fb7e3..108e760c7a5f 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -409,16 +409,17 @@ static void set_tbipa(const u32 tbipa_val, struct platform_device *pdev, static int fsl_pq_mdio_probe(struct platform_device *pdev) { const struct fsl_pq_mdio_data *data; - struct device_node *np = pdev->dev.of_node; - struct resource res; - struct device_node *tbi; + struct device *dev = &pdev->dev; struct fsl_pq_mdio_priv *priv; + struct device_node *tbi; struct mii_bus *new_bus; + struct device_node *np; + struct resource res; int err; - data = device_get_match_data(&pdev->dev); + data = device_get_match_data(dev); if (!data) { - dev_err(&pdev->dev, "Failed to match device\n"); + dev_err(dev, "Failed to match device\n"); return -ENODEV; } @@ -432,9 +433,10 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) new_bus->write = &fsl_pq_mdio_write; new_bus->reset = &fsl_pq_mdio_reset; + np = dev->of_node; err = of_address_to_resource(np, 0, &res); if (err < 0) { - dev_err(&pdev->dev, "could not obtain address information\n"); + dev_err(dev, "could not obtain address information\n"); goto error; } @@ -454,20 +456,19 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) * space. */ if (data->mii_offset > resource_size(&res)) { - dev_err(&pdev->dev, "invalid register map\n"); + dev_err(dev, "invalid register map\n"); err = -EINVAL; goto error; } priv->regs = priv->map + data->mii_offset; - new_bus->parent = &pdev->dev; + new_bus->parent = dev; platform_set_drvdata(pdev, new_bus); if (data->get_tbipa) { for_each_child_of_node(np, tbi) { if (of_node_is_type(tbi, "tbi-phy")) { - dev_dbg(&pdev->dev, "found TBI PHY node %pOFP\n", - tbi); + dev_dbg(dev, "found TBI PHY node %pOFP\n", tbi); break; } } @@ -475,7 +476,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) if (tbi) { const u32 *prop = of_get_property(tbi, "reg", NULL); if (!prop) { - dev_err(&pdev->dev, + dev_err(dev, "missing 'reg' property in node %pOF\n", tbi); err = -EBUSY; @@ -491,8 +492,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) err = of_mdiobus_register(new_bus, np); if (err) { - dev_err(&pdev->dev, "cannot register %s as MDIO bus\n", - new_bus->name); + dev_err(dev, "cannot register %s as MDIO bus\n", new_bus->name); goto error; } From patchwork Mon Dec 2 21:23:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891320 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 16F091DF740; Mon, 2 Dec 2024 21:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174618; cv=none; b=rPJWQLRtPXYDCfiAFUchotJToOTBVd8dLRGt8OqCmZFRVMb723Q4Akpm1JGPZ2HhgCmTxCQDD1GpcB6QgnKTFBuVvTe8YBoHe7slOARgCAijRA2YTpkTG8K+c9J3wQBwJ7UuVx5VGIljiSTBsxT1Getry7zVG/XMtOh3eM5O8JQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174618; c=relaxed/simple; bh=XL14k83axPDHYcjLckdEaN0RAzq7HGpUmxCP8iY2EFE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CUs7tRG/yMX3TRuRr1QdrAlhQF3qJ9N93ka2pkf5hQReNJKUeYOtNVFWXlkgfybRiLRHtY+wQj8kb75B5GlKN5PxnGnOj+CxDWnlWy2IvehkQRRhcOJGHGka2lnXIro3OfbaxQaugum+22XLqZiFlwI+dWiFvRu8+/0EAjdKOK0= 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=C+Oc3XFW; arc=none smtp.client-ip=209.85.214.179 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="C+Oc3XFW" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-21539e1d09cso43212705ad.1; Mon, 02 Dec 2024 13:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174616; x=1733779416; 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=jRRatnkW2FFvyyS1UCowv2cxjzV8z8dktdXmCRcfyfY=; b=C+Oc3XFWDIc9SQoncpRRvNQwqI1dBdzQVtctIDhMpq0T9WpEIK73VHfdBzTBTfPumY EBUSrIxFB33kn6cljayrp4ua2MLZ+FeA+zJUgPDmPhLxlKhNLwLEXQ/J1uye7BWQRvkL 3P0aPSLWX0e5FpfzRwMHyjBYRLVhyKlk7BveCOzBt/1TRldqcPi2BXnHokxXKfHZ4U2J 4C489UHYwS0ZJOEZ6LwttjEn+jaHp1DBp2zVyCMonaYJfAQsB/QZFYIVPVtFL/nJmJRT MN7RnEdDYAI9CxZwpjz/B7tcuUSyQu7crtrYoSu7N2+QuxCmfXDizqw9wvYr8h85DOBF GwlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174616; x=1733779416; 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=jRRatnkW2FFvyyS1UCowv2cxjzV8z8dktdXmCRcfyfY=; b=UKSeeKVnDsoIAzYVhvanqZTv7XxywCzBZpWaTmqtizs93lbAIyfb9ZKof0jmfq6iVK zdffc5aXqm3knWVLx2dK9FZ0Korl7bCrBqckgKWxhtonVbStjTQAn+FaW5ocGEJXyVcT bLUF+602XN3MDKeAxbtxE1UDf67riYpBhAxtPPUnjYoj5Aq+gKv8103yhHTkn8JTsg68 4TpS4aUDQJ9KTvXCN+3hFLMk7AVb0rBucrcfgUKeM+GSJx/N8lwNnkmGZbUtcbA4bYIQ zD6WItnqMnnXtIMcgMaAzDW7gSGWvkuKyic/3j8WbeX/crb8+z64tEvQ1yGvkVIKm1yU n0tg== X-Forwarded-Encrypted: i=1; AJvYcCXHlSr4FkVaQD1Jv+5lQ75MdLalZvlqPYbhbDNkML6Dy1CTp/X6KTTq3kTrNDcYSCRbyx4097INYcr1kTM=@vger.kernel.org X-Gm-Message-State: AOJu0YzaeCVrUcpeG52cLAcIf1/62zwpb7Yp7WQVpXNxgovE6voEeAtb loa+tQKJnkvzFmdlE5nQF1DuwuB5DSOAOhMThdzinRle1XyJt92nKudwN0rW X-Gm-Gg: ASbGncuf9A4Yo7ct4xp4LbSGYBJlOq3Wk/gCIhaOYuZ27lAsLRAb7DY725KDzDgqE4L NHu55aXE+eYlSb2D+P9JSO3ECvhuleh4YgAq4uznK4UD8HX0quR7ok+5wZCM7IOS71o69eGsVew 968hjIzyWyeuDCeBOP+NM21lTKalFwUzus+de/DFqiZajv2eBRS7da6Du6PGYATA94ik+HUUJxt DLwDMSCaV93N7D3y27SDw+89w== X-Google-Smtp-Source: AGHT+IHyoADsXSYWCNjOIOEWnMQZv6NkeQvstYGxDU1iCY4YgqIAPemGrKNn5nkNzYwEm7+NYf10iA== X-Received: by 2002:a17:902:dacc:b0:215:94eb:adb6 with SMTP id d9443c01a7336-21594ebb238mr83643765ad.40.1733174616073; Mon, 02 Dec 2024 13:23:36 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:35 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 02/11] net: fsl_pq_mdio: use devm for mdiobus_alloc_size Date: Mon, 2 Dec 2024 13:23:22 -0800 Message-ID: <20241202212331.7238-3-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Using devm avoids having to manually free. In the case of this driver, it's simple enough that it's ideal for devm. There also seems to be a mistake here. Using kfree instead of mdiobus_free. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 108e760c7a5f..d7f9d99fe782 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -423,7 +423,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) return -ENODEV; } - new_bus = mdiobus_alloc_size(sizeof(*priv)); + new_bus = devm_mdiobus_alloc_size(dev, sizeof(*priv)); if (!new_bus) return -ENOMEM; @@ -437,17 +437,15 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) err = of_address_to_resource(np, 0, &res); if (err < 0) { dev_err(dev, "could not obtain address information\n"); - goto error; + return err; } snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@%llx", np, (unsigned long long)res.start); priv->map = of_iomap(np, 0); - if (!priv->map) { - err = -ENOMEM; - goto error; - } + if (!priv->map) + return -ENOMEM; /* * Some device tree nodes represent only the MII registers, and @@ -502,8 +500,6 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) if (priv->map) iounmap(priv->map); - kfree(new_bus); - return err; } @@ -517,7 +513,6 @@ static void fsl_pq_mdio_remove(struct platform_device *pdev) mdiobus_unregister(bus); iounmap(priv->map); - mdiobus_free(bus); } static struct platform_driver fsl_pq_mdio_driver = { From patchwork Mon Dec 2 21:23:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891321 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.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 43B0E1DF974; Mon, 2 Dec 2024 21:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174619; cv=none; b=aBM3qdoctt1ssiBS+66twRG/0d0MwogzmT+70ZAjm9rt+PqJY2ePcEIVb6OAiEwxOqqu/McJcmlVgE21wkgZb4OAbBbqpn4v78FzQ81QUeTHnSp84lVSZDM4i3lrygb99xlNPtliOBLscQesV9YMnoMk5y2M0GSipncXFfYGtX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174619; c=relaxed/simple; bh=UEe+01wXcA/6Vp2tXaLjKWUBpnQy8abf4E5ymq4FAlE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dcPdSaVOdpIa2xPeytfQjzkZyRmNqCtdkT/x86libvKLIZ7jOOARi8pcrxRO8wAbOkKh66pNrr4XileDIx+CHbCouphV2OemAuhlPpAlH/Cu35icf3hB6LRTSWJ5iAnXieTtw+wVEI/BwWclgku85pFJbox9FAqXs4bBfOC2Mp8= 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=kpNSlh/V; arc=none smtp.client-ip=209.85.214.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="kpNSlh/V" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-21145812538so38297065ad.0; Mon, 02 Dec 2024 13:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174617; x=1733779417; 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=HCzzR8j2iKtf3UdeUk+5jPhNrUS+V0xjiwUoH7xZuyk=; b=kpNSlh/VDIeEe9yBJOor9nDRSU/yqWWdpHmKuynyymYCKuPfm/7qYa8ktDiB2g9eTi 9r+NFooOAyplpXVXaFtO668KmXCm/oVqkVt0eg44+O51Ot0J8/IudI56SGYoJKjoh4cH BDJ6lXAwkrCnQ0IijE+SzISoFsC3pNtcMOzmHuBcaPAC1BZQV+H70A/JtXUx8NYW0dkX tL7WT1vPqKlSXpyBzBjecW5CiqPU/4ODzj+dHXqxmKVoxNmLwNrl1yI8wF5XnFsl7pAU oTIifxWRSmSTXK0l3LEBwl32tFcLMJdPAYtDknEC/tfsllC2la5rebDQJK4FzG/uRAOG HwFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174617; x=1733779417; 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=HCzzR8j2iKtf3UdeUk+5jPhNrUS+V0xjiwUoH7xZuyk=; b=sm5lY2it41IEYWhTsMv3LsiBA6/yCeds3XCwEEGKL9CUGai5w3ixEoer2PlmoIR9HM CuJT9mCexH95QUqw75229WHWKxw0uTHzGeaC3NZ6WaHv/d5KZmVEvgtHeIrv/0aranC/ V8XV/X3MxNSAP8CazHbJ9IVPkWqxTiAmuFE8bxMJglGZeLgwU3l7FPu5tCmq+/kJjxtG HCwqdPZn/1u9yiPdulbnzXVRaCps1w2jsgz+o4UcSZ/Xl37dn18qK1r6fptx3VFvyX6N oTWSMDBibXBtm4vj+qAo9RkRgggOYfcDrEKRIT5DwYN3hRr0/5BtMavbvzXrfcs7GTms KiBw== X-Forwarded-Encrypted: i=1; AJvYcCUpKQ4cu+ZXSBmkfF2mXVMNiRfmSRd5uJG8I0vg8FVEiuW6LUE6WEI7B6w9aO/jZkUpWavepY2/YGZI7AI=@vger.kernel.org X-Gm-Message-State: AOJu0Yyvjddhgdhxl7wf5q5ogjuTTUXnSCu1brJRET/KPPyqtGDrW2Y8 4MU/byBHO/AeFlevYBo77uzv/vUEAi73a+CWk3thDL/x7mn2qbF1lEnYADMO X-Gm-Gg: ASbGncsuqzr+hBbxcNc40rXTSBG2f/ewEYZJEHCoFAn5ROSQUY1sOs4GWho5dwBlQ3L G7igZq/rPKPrbXUotknO2dJWepv8nYzJ9xcbecteDWIRM4zObPzkc/NInbrMMXxc415LL/GgqjA bxkwvbFLlGcU1YawK/hUHyWy409ramXeV2WLJOcDrdnDzKeKwzcaxAd43kmI4VlO2ZrG21PkNNm /2dw3LsEi7J4WAvl0poMOq3Ug== X-Google-Smtp-Source: AGHT+IE4lBI6lzn4RyCfB1wFHwD7sFSecH49TpJcGomfAcAWTV1f9q4iLVA0yjhRU/LwrGSu6p1yig== X-Received: by 2002:a17:902:cec7:b0:215:3661:747e with SMTP id d9443c01a7336-215bcfc5c76mr608535ad.8.1733174617312; Mon, 02 Dec 2024 13:23:37 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:36 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 03/11] net: fsl_pq_mdio: use platform_get_resource Date: Mon, 2 Dec 2024 13:23:23 -0800 Message-ID: <20241202212331.7238-4-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Replace of_address_to_resource with platform_get_resource. No need to use the of_node when the pdev is sufficient. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index d7f9d99fe782..f14607555f33 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -414,7 +414,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) struct device_node *tbi; struct mii_bus *new_bus; struct device_node *np; - struct resource res; + struct resource *res; int err; data = device_get_match_data(dev); @@ -433,15 +433,15 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) new_bus->write = &fsl_pq_mdio_write; new_bus->reset = &fsl_pq_mdio_reset; - np = dev->of_node; - err = of_address_to_resource(np, 0, &res); - if (err < 0) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { dev_err(dev, "could not obtain address information\n"); - return err; + return -ENOMEM; } + np = dev->of_node; snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@%llx", np, - (unsigned long long)res.start); + (unsigned long long)res->start); priv->map = of_iomap(np, 0); if (!priv->map) @@ -453,7 +453,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) * contains the offset of the MII registers inside the mapped register * space. */ - if (data->mii_offset > resource_size(&res)) { + if (data->mii_offset > resource_size(res)) { dev_err(dev, "invalid register map\n"); err = -EINVAL; goto error; @@ -480,13 +480,12 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) err = -EBUSY; goto error; } - set_tbipa(*prop, pdev, - data->get_tbipa, priv->map, &res); + set_tbipa(*prop, pdev, data->get_tbipa, priv->map, res); } } if (data->ucc_configure) - data->ucc_configure(res.start, res.end); + data->ucc_configure(res->start, res->end); err = of_mdiobus_register(new_bus, np); if (err) { From patchwork Mon Dec 2 21:23:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891322 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 6E2EC1DFD8D; Mon, 2 Dec 2024 21:23:39 +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=1733174620; cv=none; b=F2Sw/x6BdZnckoRmrOMfKqX777vmNIzODBEOUk9oAUuXLT/0PLQnJQ34C0txph+yVoXWnfzh8swvcEmmcZ8LPDZqUCKTaTWdN9cRXNW6Qw96Pvj13nUevgX/ZLt+ewSs3fxkFy/VIHjlqorN/aM3vfJ3Fu6dRXu8cZRNir1Y5iU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174620; c=relaxed/simple; bh=bxNdSWBFOuU160wYi2ZuwoNG6N1rmqN5rH4LXYxLWWI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lBFphsRHwPCTx/zPPeM4CKMKt5ABEqN9p9B5MFHTZ+jfZ/bHueibs0QpDc7P1wlUzSAIpS/pEupCAM4rcEqOupXLIZ5b1lIRiJZvoboyd4TTmw087lV2yxIHqsktLqy3ttzna9Ld3lJrPXmbzlN1IqWtgxj0qASNGhDqJaGhKno= 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=Tg6qpsAz; 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="Tg6qpsAz" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-215b9a754fbso1507515ad.1; Mon, 02 Dec 2024 13:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174618; x=1733779418; 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=iQ2w1hRvX2gv5YNJeLZGgNGigEr7WSReYY3PlM5Kufw=; b=Tg6qpsAzEbiJx2Mv9IWz+ilyXGX249HMYWvwDx9JQcCVc8aGyTXZLyMwvvG50wzwH5 IF9SXw8ORWDsv5gZdC/hi38xtBwBFBAhj4xLTvi9aWVvA3a2wXE7HWtbBUgROZZ8V+BD E9zTpwl/RneU+QY9kRc2X65EM5ap0xx4ife6AaoJ5Y7WIEljzEEgS2w60KFwAN/Mqsae 9ZYTN4S/MU59eoGYx8tXNNyzHEULFf241SJNb8WCeQp/4IXQlWVe5786mRhmiLA3MKpn zDY6JZi+wbIYaa072/goEgVgHlL9BsBBmQA6rn67NlEWFP4xenXh8TNeMrnRDuYo0W3N +E2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174618; x=1733779418; 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=iQ2w1hRvX2gv5YNJeLZGgNGigEr7WSReYY3PlM5Kufw=; b=eS7kFa4HwNQk1X9Ks2SOG8D2L/TnxmvOn4/JyG28Yu9NoH6v6iibu23pUXoCcsmvw/ OEA5FMQ7w40bu1cTC6h28zL8LM3jARLy2wGdnbSEGXde4z9y6JFr2kaKL/Yf4wcpAtJo irldEqECaK+SIw0HJgXXcRNH980QTjS8EANzeg+ZMpAgKd1pDoOiVdRfTqLD1dfmyuhz yW1Zfw9rA4emVBCSv7t9CEhy5ubJzi3cab2lnSi+emmS2o9L0uiK3+Gc4ue4kam3lShi /dd6NhmyouC1R2kjytV+MCoNzJpq5agycUflbOcpo/Z/9EtK9PaVqiv8wBty09DYOffU PC4g== X-Forwarded-Encrypted: i=1; AJvYcCVh2VZa7hZ4FeHQ0FX5RFpBhoApcoM9PCp8ycdiHSv50va3HJYr38w9felxbyBc2kn+EWy2Rji8MFrDEMQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxSd5KigPnr533O0B3I/1rin8TFP6RopLbqDVPfHSG98w/QQatr cpQqudkJ+zoz1ZlSJ3ju4J3J0O8K7XMEGlYl5YBO9daHKcnEn/+DXbfjOMy1 X-Gm-Gg: ASbGnctrzF1iVwlxkqtqInS3mVEhiM1fMIcL/hCE4IdsgN0Iqk/D9UPGT/1v0/gBXvN Ek8xojPJblORPnyQYRz7SfIuwYi/Kfw6j53zIM8UBSceq/+DucrWFrpTVrztz4mx6S57/BQGl2O IiH+gYqoxa8jY/gi1BMQFwys7DyNRFVPRPJlG7sDAMgrqPQBo/Hzltqn+sx4Uzi0W0BcsGn/a9q lKHNhO0PQ/EFya8ON/ZS/3IXA== X-Google-Smtp-Source: AGHT+IHkKJR6eZ9FXINF3O++8Jx9b855BP3/uRz999zRe1Uw7yDq0t+se/JtFnPAIWtQTwx2gwmNRw== X-Received: by 2002:a17:902:db06:b0:215:7dbf:f3de with SMTP id d9443c01a7336-215bd2005a9mr77445ad.28.1733174618501; Mon, 02 Dec 2024 13:23:38 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:38 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 04/11] net: fsl_pq_mdio: use devm for of_iomap Date: Mon, 2 Dec 2024 13:23:24 -0800 Message-ID: <20241202212331.7238-5-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Using devm for of_iomap avoids having to manually iounmap in error paths for this simple driver. Add a note for why not devm_platform helper. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index f14607555f33..640929a4562d 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -443,7 +443,12 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@%llx", np, (unsigned long long)res->start); - priv->map = of_iomap(np, 0); + /* + * While tempting, this cannot be converted to + * devm_platform_get_and_ioremap_resource as some platforms overlap the + * memory regions with the ethernet node. + */ + priv->map = devm_of_iomap(dev, np, 0, NULL); if (!priv->map) return -ENOMEM; @@ -455,8 +460,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) */ if (data->mii_offset > resource_size(res)) { dev_err(dev, "invalid register map\n"); - err = -EINVAL; - goto error; + return -EINVAL; } priv->regs = priv->map + data->mii_offset; @@ -477,8 +481,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) dev_err(dev, "missing 'reg' property in node %pOF\n", tbi); - err = -EBUSY; - goto error; + return -EBUSY; } set_tbipa(*prop, pdev, data->get_tbipa, priv->map, res); } @@ -490,16 +493,10 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) err = of_mdiobus_register(new_bus, np); if (err) { dev_err(dev, "cannot register %s as MDIO bus\n", new_bus->name); - goto error; + return err; } return 0; - -error: - if (priv->map) - iounmap(priv->map); - - return err; } @@ -507,11 +504,8 @@ static void fsl_pq_mdio_remove(struct platform_device *pdev) { struct device *device = &pdev->dev; struct mii_bus *bus = dev_get_drvdata(device); - struct fsl_pq_mdio_priv *priv = bus->priv; mdiobus_unregister(bus); - - iounmap(priv->map); } static struct platform_driver fsl_pq_mdio_driver = { From patchwork Mon Dec 2 21:23:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891323 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 9A3211DF98B; Mon, 2 Dec 2024 21:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174622; cv=none; b=Tud3l6hKO8dPcIQHclX4NJVkTbDAmCQMpDzo+Kn6J4vrEjo1JqKMjGlr2yCsRSOB2v3HbO1R/66dVMeZMG6lGnBMed/qkLMmVgUd3CjSh804Mc1InrS9AexB1GVZ03dX4W1dJ/XmkwkQL5YnpVEILXgU9kZetxfr64NKoUySzzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174622; c=relaxed/simple; bh=atjNlLzigxLFocWOYZ3P9pm/bgS/RCNfQxHKO7I/vHw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kirbp1xCq4WGvlwco9fBgxbinR4PAZYBzFtuu2Xx0bLI5KpDC4dMnfBjOHgjf/Oi49wKrfdL2+Od8DA6I8Wmvk5dkBDXQOi4M//QwfZ0m4JghPzal2bIlpq1yj+FR7b6lJ3ADd+57e5NhQtxOcFM+8BM/vG58CXi/NhEm1FJmoM= 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=DDk+l1GN; arc=none smtp.client-ip=209.85.210.173 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="DDk+l1GN" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7242f559a9fso4661590b3a.1; Mon, 02 Dec 2024 13:23:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174620; x=1733779420; 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=fNJMkhvDACNxbVOybBT2qMig0uprGHP3aEgGM+RIyTQ=; b=DDk+l1GN9nLLhXdiYphRrRV7o8R2wyZNf4oTYuD2MAd684+g09jbu06GAOxnrvy5Gk HqaqPZA9rPDsuNocaoKZNTjRZ6+I2jbj0X/LEROOD4l88/NzkNLUV8PvXxxlIsnMV3GY aLEs6+gqnKH7WEKC/E/vUUdGvzLXvN4oLAYK0GuPA6fnJ433gQRlB7M+i/orRH/lzrvn KrDacqhhddoqDduyXmV7wopgU++tR6Th1orJKfnA7QMp2ctqZkbl4RUd27t47XGx9nPu WtzZaNezz1rWEyn6VXFbN9i7KpmnbfaJec9lwNWb03RstegWLlYvb6apupWMwfG0NCiE gmDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174620; x=1733779420; 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=fNJMkhvDACNxbVOybBT2qMig0uprGHP3aEgGM+RIyTQ=; b=tQhzygiGKlyEOVCy9YrD8MhCj0qqAqYBXGF+doUfl9Fj6xNK1zOJeFfL+37jp/CxG0 TBe/dXWu1T2pp0at9z19Ws1jDjLAYaN1OtbSXmmeW3rOFlX4525NbEMo7hibDnxZmcSH UXe4zGvIdULEAvB+zBa9jUc5fy8YPrN2pRAMU0oDXvZDBkDOqVSsK5LMQroVd3bjktEz t58I5ZMT4ZHeuoJgkX2FKUNtNs8P3bmIAweTvoobAHPHJLScqDSZHUlwIhwjKitJ2tZf SCwPv7EthfZ/t01q3wGoDjA/h9S2af4oYISKgBn41FUOhb+Uaq5QTzUxtik7ajSzlCBv KNwA== X-Forwarded-Encrypted: i=1; AJvYcCXHimOZ6TcEakGOGJpcAR0ZXyE9XjRYcPMyimxIAXRh6aipBVLst7FnZTtx9+OUOs5c1S9ydc92RJssr1U=@vger.kernel.org X-Gm-Message-State: AOJu0YxOpR8AyTaFUAv+K/rZAVSG90MefOs7MJqZUVSA/bbY6ae6RnC4 p31kOaenWYAPxY1vEwjptCqNSTMnlDkNOPLQC+FGyssWPxw5IJpeUw888GbY X-Gm-Gg: ASbGncsYy9wDcM5LKKP6PLDEimGagjGpUB8d839E084b7UId0DJC5cPNGhSJaoJtQZo dFoTEfpyjwP/ZmaLuJB94+5sG6HBC22NKiosTyWeJ05jTBa01xkT7EN2Y6P5DPb3LRpxNXLOo0Z cON69AjI+erb1aIqcEmPwG3yzxpCBAQUXz+VtDx1Ip3KairYIh4n2XUO3p/24QOCM9kwOn1kBgj qLwZtskAb1U9K5jliW0NkFGzw== X-Google-Smtp-Source: AGHT+IG6SUCrlWHPfaz0GCAKMj23gwP3mzyXq8TY3Y186ZE337VT1kUHxY84bxpVywFPvDXaXpVG4A== X-Received: by 2002:a17:902:e743:b0:215:4f98:da0d with SMTP id d9443c01a7336-215bd0d8968mr711855ad.15.1733174619770; Mon, 02 Dec 2024 13:23:39 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:39 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 05/11] net: fsl_pq_mdio: return directly in probe Date: Mon, 2 Dec 2024 13:23:25 -0800 Message-ID: <20241202212331.7238-6-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Instead of generating two errors in probe, just return directly to generate one. mdiobus_register was switched away from the of_ variant as no children are being used. No more need for a _remove function. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 640929a4562d..12b6c11d9cf9 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -415,7 +415,6 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) struct mii_bus *new_bus; struct device_node *np; struct resource *res; - int err; data = device_get_match_data(dev); if (!data) { @@ -465,7 +464,6 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) priv->regs = priv->map + data->mii_offset; new_bus->parent = dev; - platform_set_drvdata(pdev, new_bus); if (data->get_tbipa) { for_each_child_of_node(np, tbi) { @@ -490,22 +488,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) if (data->ucc_configure) data->ucc_configure(res->start, res->end); - err = of_mdiobus_register(new_bus, np); - if (err) { - dev_err(dev, "cannot register %s as MDIO bus\n", new_bus->name); - return err; - } - - return 0; -} - - -static void fsl_pq_mdio_remove(struct platform_device *pdev) -{ - struct device *device = &pdev->dev; - struct mii_bus *bus = dev_get_drvdata(device); - - mdiobus_unregister(bus); + return devm_mdiobus_register(dev, new_bus); } static struct platform_driver fsl_pq_mdio_driver = { @@ -514,7 +497,6 @@ static struct platform_driver fsl_pq_mdio_driver = { .of_match_table = fsl_pq_mdio_match, }, .probe = fsl_pq_mdio_probe, - .remove = fsl_pq_mdio_remove, }; module_platform_driver(fsl_pq_mdio_driver); From patchwork Mon Dec 2 21:23:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891324 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 C50BB1DFE35; Mon, 2 Dec 2024 21:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174623; cv=none; b=EClh5lPt257OmjigJh7jG0pgCgEA5EBHoINImRmNXX3nzUQhzBjras4fOIh9VqdjW+btcQw5Xp3Sgi3EsIzSry5DtsLLpiPeE9TpcD7dMOXb4LXaJX3+d7qPM/194ZmlLwoykvpqI1ZNStGa4KB05BPJiqnKQV+OaO6gz3U2cP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174623; c=relaxed/simple; bh=iRjLNPgDmXU0ZuDDvgb0y9voPktGU76lk4ona35Pyow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=smP+26PCnGda3MShdFUYRT1h248itRTJq+VLa+G76Waw/Wc7spSWCx9KNzJEcKYSRFBCOZOkbkrC9Mh9jrKcyLObgJrbpNpAxaV9eBYAreT+bNUBTATLqty51bg3h5pJvOdlDHlu9h6Wb0TWyj4RXSiavcXq/6RFWYiUWnQREgs= 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=QZ7cqSFw; arc=none smtp.client-ip=209.85.214.182 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="QZ7cqSFw" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2127d4140bbso44642445ad.1; Mon, 02 Dec 2024 13:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174621; x=1733779421; 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=QZ7cqSFwXMuWlKZvXmLuw6z6rM+3PXp3RS0GF52oA6q/L59RAQBZhJpLl0IzP+WQJu dCjYwi99xX7t9o2tNVF3h8CocnxpS0du2M5GnvtzFRSeWjicjc7bBCaRazprVLS5ih4F iwDD1qsBWR02znxtnIvY1MFU/sXJ1pIXX0aA9JfekrdicdVAiQYI+vsG1ib7KKwkJbb8 agiQKnQCe1AOz/DpJPd8Uxquq+mXuYDHCX37AAgy/mzn83IQE8sclgEwy6NR0ogZsVgl K1vCSHq6+91ijnRGTqMDAh1ZjBVJOA0bICptJ2a0nqRtj1hvNr9bKsp0aWUQ9u2PcNOO Athw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174621; x=1733779421; 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=pFcQfE/dwuCQYGJTAoz3Vct4/TRFX4Zo0txuZe49BfwPG/6WzOEde18kPab0De/FoZ EFuQtsX0xe2hQk5nOd5XW2Wb128T6k6ULi8Tx8pcl2BNHAuxoGH/BvQdW1gcseIsiGnh PwHvBF+u2PmE1dn839xhPc9f+BcRpr2wLgjCkDgngKkmP2qqk6YQSJMBgksfnF4lgtX/ tCoixwQ6z/+CZcybw+Smv+HPGyEPFSN86GoPw96lnFj6irtfSHrDssqoEsWO04FRwz43 yzsCbY2j7z0RJ+qi4XjiUGXS4Oi0/Fx+jlriMtl5aqo7tQyX0zyzDabU7N2ci5LBdDQR CgpQ== X-Forwarded-Encrypted: i=1; AJvYcCXxczoZUwSa2w5kTKnC3GiGPgTDiZV1zEcmKJpfiwvTlmE0x0slFmnzRazGL+nGrARSfFit8aNmEmagbfQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxBqlk2jbfAdAFeQ/bpCLhBjbfz29U6NLwVH6fSQSHz//02IkbR 4c8jt+99jOeFfJnMxElateDAmWrauPkW7u0RCM9j4shqr6JsKfWR35UbjMNi X-Gm-Gg: ASbGnctGaFkD3njr6CtpCKMD4EcnyNQmq4fkzAlzisY3hlhP1SKp2X0UZQpfyFpRUNT P2Yi2eNgFXiiH7tUPZJDR/pYZbJGO+OFtjh7n85egNpfjRUEflL/yWdbvonkXEwYEstk7jjRRQ3 QB1SMS3se5mJUPlRJ7McrH5YnPc7PEHeDxuBacFRxnXitQoCPZmwfZ2g3EoVXx1JhMT8RAQRmYI D/6hK3wTYV4ZG9XucOOwV/TlA== X-Google-Smtp-Source: AGHT+IEDtBbIuru+g3X+1c/jZsmy2wYOm/dIW+uoYt3RRTsLQW0OQFcVMZ43qbOl9sGw66YOPv9Gsg== X-Received: by 2002:a17:902:d2c9:b0:215:681d:7a52 with SMTP id d9443c01a7336-215bd17a76cmr360175ad.55.1733174620944; Mon, 02 Dec 2024 13:23:40 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:40 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 06/11] net: gianfar: use devm_alloc_etherdev_mqs Date: Mon, 2 Dec 2024 13:23:26 -0800 Message-ID: <20241202212331.7238-7-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Dec 2 21:23:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891325 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 3433C1E0480; Mon, 2 Dec 2024 21:23:43 +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=1733174624; cv=none; b=NK2IfqCxWzTlNX0VRdLT1+MQ9fhCpbBRrwRMV0T3qETBKOPWDEmjNwuLYB2QIl3SuCas8u9uefQCa8eHs+FZjKj11DVLlys4sJxwkuwYq4cx1stJR+xYBa30xl4G8e6mpND8ZlxODVFu61GdBY3q5aMUWn2jBdBxxTvdlGOL+MA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174624; c=relaxed/simple; bh=IXcltZehn2/3SyvTBeTFQotnSCT34NjXj0QE95LAAds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F0WSQKILXhEtCOcgSIe4ZD7e9HK5mDX2xltOnlY3U2i0tGYDiotKzBljQJYpb8EuhSDyy5xk3w647utSsXHXH89raFMh8ZvCbIMXotMwMq6bkGt4PGCCzH17d+Y7sv1plUJUdFB8PChlPv9xftZ4jVSlr3GjsI80y9NQyKn8QO4= 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=g4yCCVkc; 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="g4yCCVkc" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-215b9a754fbso1507975ad.1; Mon, 02 Dec 2024 13:23:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174622; x=1733779422; 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=g4yCCVkcCttW5YU6aL5PwYAYMPg81HBwCQ73eNm/BRrxNLX/xIy6MM2E+BtWYu8jM9 AnPu0pkda1gxsM8pdgBLIaNNPyA/TejnfU2MNBCA9jToxFD1oW0YInZeS53Yn0mpefDK kitrzR2W/gKJePPS4K7w+3Gi4MXFJ8Q0ThJRcau+wBjbucWNptx22UH4IQWNjfTYgf5+ a6Y7KCNr4zL9lNvdg0/AXfp28VYnDRlLdlypzhxRsMKXRgDU+bupH6KP4azWyrHlfAB6 bH8c5PTFMybVC+gN5UxHVWLLWJytmQOpgBgKPF7EoqBH9AoOeEj9K6uNKuLPDXr1n4Ny WwNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174622; x=1733779422; 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=sNGdPZsVb6kg8aCJ2b1nFYJStwT6PIpJydJffO51+667SpBNEp7adzmDZypJELIct/ gcoSVb5ulDvqjcm3hfYvEmfoa31r9XWPGXgirQE7mZqnpTcEUS+oxI2An5dM7Cel6bT9 qDHrcLTbFWAXZouS8fDXLZYFzkVjolzlqL2U1rqHkJXTNm01e5bHU47m0FyMAxwdEM+l l3mtsrpfgI6pW8yCmlmR7NyYm7C6S5L/ULFEZFwb+x0Kr+X1YOjIN9OIUMtLyl3dGYWU h9/lDkDU2Etd6gQxNXbffG+YdfRa6QBax7dD5omnJPl9oZ0tc6KZfH32wjKta5zxwwdz A1wQ== X-Forwarded-Encrypted: i=1; AJvYcCV4iDTS+GSnqxLFjaxzbLEsgJu9HzclrwoKs9yhuL44PT1iBIE07isjL5WSwpGGHr2LSWnScrQEbWSY1n8=@vger.kernel.org X-Gm-Message-State: AOJu0YwWMFp8XULh9anU7wBeIhBZyfncfYnd9egML1PliBHy6+bDGuiE ngkb13EWDdULQdZK2kUIB0/7f7x7KuuuKk+Rk9Lm3IrQNvxjNlwYZN7e6GVS X-Gm-Gg: ASbGncusaFRV7Ym0aORs4PAvPG9lWbte4ZQTM8RWMY5Piu2r+JHPUilhSySYrPMI5GJ 8mBl+kOgKotDyyxh1ER6QcBb0VYIpc3ixm9GqxWhe6vbhqTkNx40fwAZ8NLfp+LHT4n0SexZln/ fKNVRY3zg5WduNeqXcsy0IGV+m5mx3RKqY0JAcZ2FKea6LdTjZIyuOUtBc5CbSZwpgwZ2y0KOEr GjTeTAbpqIsGlVW68yUWOR8RA== X-Google-Smtp-Source: AGHT+IH8hjNECaWA7HdBpu+vfjxaam9yKVKhbl1rSKe8TMovwBq6iDjlz0SSZbFtgiRYxUzjj5zK5Q== X-Received: by 2002:a17:902:cec2:b0:215:b8c6:338a with SMTP id d9443c01a7336-215bd1b4373mr290205ad.4.1733174622249; Mon, 02 Dec 2024 13:23:42 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:41 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 07/11] net: gianfar: use devm for register_netdev Date: Mon, 2 Dec 2024 13:23:27 -0800 Message-ID: <20241202212331.7238-8-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Dec 2 21:23:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891326 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 D22F21E0B75; Mon, 2 Dec 2024 21:23:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174626; cv=none; b=ZbFLZEkRMBZx3/pz7Q2sJyF8kEOn+ksxIX4MWbyZr/u4NAOAVnrIzvdAA8Be3ePKXR3Gsy12iiOgO1Sdlktqt+hlKTkJ/9lFVAuv2EffTdsD/B1CMKEhLrqfKxANX9svhnjmIQdgYGsMEy7i25E9I/5tyPrWzcTXYQELR0hk2ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174626; c=relaxed/simple; bh=Hg2YJCbKPvRfVlyXe4AKKc1T/lU4ZsS8zwKr1Q4Wu+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g7xsVLeABe/ZKJ0KirDRDmv/i+q6VVAGZHOYeHkLpjGa8fHvttluM9zX2Q5WFi/C1/4xgOWci0x+w6hPeqQsR1BgfiYhyoeVsDu5ZgpiHkM8Ll9UvLX6T+qdSyLN/BRUxG+JJYdMM78qiRny45r7S9VHXWPrz+jFWSH0io08VvM= 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=YKJcJmDw; arc=none smtp.client-ip=209.85.214.169 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="YKJcJmDw" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-21561af95c3so20134665ad.3; Mon, 02 Dec 2024 13:23:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174624; x=1733779424; 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=YKJcJmDwVn4dg9K2p+hxY/AcPlnb3oxZv4ryQDLVIaMm6SLHKoc8vRv3SbT0nyPJbr 4iCMpA7ZRRyjzjIC8iq9DABtX7A3aOiYXAAZVDcU3rFAxmBGhJ1EHvEu5EjH3faJoMvQ wyWa5QABm8AB1SRFZYNhgBmy2yCuISbk0wtzVKGDOxJk59dDh9vQGye2rzxS8i/na2rC vvUKnDJYpIMeW2PDyiQgC7yNkfYkTGMNRtN5slqn48cTGdKuylfLdKsiXq90fyCZRlIk QQwOJLA2RL47lfK5pae58xU+8DdLCa58yWMOoou1xvo3B/UkBtglx0eEtV2tAhVPTMTa fXAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174624; x=1733779424; 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=PZVgP382VxKs8vWZLVp17/smh/+akEHEniusXgKMkNN0l+0EVCjIIpePQ1nMNtBfId dvjQ0vbp8Va586rrqFA2ZjTAc79DQ6h6NcVoY9Ln8yrJhXX4VN5cVxSyMD1KLlJhuDdz Xb8WSKhpbzSR9PrO+De4s46Z/ow0/ogbBxag1bgxlBYgPpBE83/VNQq3WBbNgq2mJNct whGWQuYtVQVoG7SWrjuoX2gWxWZDlRLMGzo+gNJ2oRNKGxdPeOKJfeFn4cHbsWfhgAJI r4ZKsYLTjQkXb8/mzGGM2SKo0Y9TU/YNMUnMA4soIpTnNzrgpnlY7q5ETad7klrTGjc2 AW1A== X-Forwarded-Encrypted: i=1; AJvYcCVxk+AKZ/evGpqxoYkF8eBjKkhzOGOmRl/ONJhhQ3aSrmVFiujTRKaxMX50P9gYqwsCJphkzMBFyPZ6Uuc=@vger.kernel.org X-Gm-Message-State: AOJu0YwVRCQR6UG4rs7Puy+lwv4pWtTJMjM6kZBK6sFBoNE4wEvwMX2r 0Opn4cU5z5ei+jzLeJOEFZoypkYYiNAsx5BHOG0uijaVvgxDbkKPzxEH/Fnq X-Gm-Gg: ASbGncuuAKL95BALcrN+4vCB5VdnrUHBGtjKDBFBcC0xIZo0VWv4U4dcgP1IfYDJKGm IoHRfUp1Dz/3CvgoJquubG+sPYA52+7wfOg7OprnWbFLy0CABD83RgQIsh/cDRaS7p0WAQF9qEs Ll2ZFQmKZ54dgpjjeWxGTIgEgHitzBojMdaEJtl0X0e+VUa+bHCDgK0cngHjf4RgjvPAZu9rMkQ enusfdOwglhxZj0TkamRmysSg== X-Google-Smtp-Source: AGHT+IHp5Bvo2l6KxjQOljcmZ82naHQkbnKwlj3SfCeCIggC8uoeNwkOMMZOgZHud27sBM+Kvcakyg== X-Received: by 2002:a17:902:d489:b0:215:401b:9535 with SMTP id d9443c01a7336-215bd13edf3mr312885ad.47.1733174624038; Mon, 02 Dec 2024 13:23:44 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:43 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 08/11] net: gianfar: assign ofdev to priv struct Date: Mon, 2 Dec 2024 13:23:28 -0800 Message-ID: <20241202212331.7238-9-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Dec 2 21:23:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891327 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 E80A51E0DEB; Mon, 2 Dec 2024 21:23:47 +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=1733174629; cv=none; b=njobbwLz28W9OA7RYxVQcOpLwGYk7ZlJnynwBJEcZKRzIxjmNqsJVg9kX4Q0B3shDxHzQH30/gHv8+DyKCWXcO4OMWB2MfmvV7zegLvJevAue6UlPLW+KOprDj32nnbnr0s0aI2H+pR5+dYsxliAegnHkt2Bh1xd+VkDFqYP0tU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174629; c=relaxed/simple; bh=o29Loz/wKRoCklR+Xw7+059RvxWhYbZTaNT9c2QM0ew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l5jv0EVTidwURtER8Zhzj7Xaqnv5gQJUVwTsQN4/oscDj3VGB24VwN7s5z/3xyhbg/l2zJQuE+iEKbHEmC0KQT570Sx6Xj0kC9ghvdGV+Kugz3eXt5J9gfbWRuuWDtXFLCJy6o08QJKNp6FukkkoINgJA1UHrs1hicrES9o7Zu8= 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=WntSXaYd; 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="WntSXaYd" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-211fb27cc6bso37984825ad.0; Mon, 02 Dec 2024 13:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174627; x=1733779427; 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=WntSXaYd095CEr3/KChBUJ7j31N21lkbkKWhVkZS3sAt+gE7/1/MVJLxRCgEWmXrnt y/o3zOm3UE0mLYWmMpjA+rr4qMsCEB+NRG6wMLqhlri5BNfv2++1zYrfVmftClR5rVIt ZKAR77gRMO8wnVXRTxmDP4DrwQ8WoA5x1/rXmFfAMzHrfpStM22lDnkWdjbvL0y7RzMd kOTgqdRTojTqcP290r2/Ek0y+YxRSX46L2HcUjt39cVHE2HA8RqpIffm0uhNQHQoJBuF BrhQDuD1vzKTdJlR6Y4GQzW+BRDDzh9V1qLM5CFwi93I3T24Mdiqo/8kl3wmQ8qvekQL QjjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174627; x=1733779427; 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=evr0iND5o5xLteD0VDM7m6SPbIp4vO8Nrp4+SW9mxPuQzdWvmskwUGqO25WVptY2BO iWSkQYTNjdNRGkc7WHPIdIkjV5gZ5BnTgefESQjnKgWLkfWC3N5chG8Ex/0s7JLW9EQ5 zrvwRIvwAC5pIWV4b/nvMyOjIQDVrJfonAr04gm0oYKHLjv1pRtN26Q3jFFNRJKX0zC0 y7Tezm71mGk0nJEUzvdT1TdYWkwckyfE5/3wKK9As3EpF26HAIVk7VgoAkrX+nt987E2 U2EqJrgm/LZQlS0j+HI7zqertkzKppZ/iMzbXwuxBs42JFTWGQqTcd7HTcq34tCXNZro w1Fg== X-Forwarded-Encrypted: i=1; AJvYcCWQgd5nCZ37yg0M8j5TtsOo73kCwOoTqz9wUPaSZ9yWFnZxRzj9bLXWQBpcBFp82gvCFRYW4bscBnLOnMY=@vger.kernel.org X-Gm-Message-State: AOJu0YwRBh/rpGCadpk2KmrXHO75HNyUgc50CjZdQ2VGY2OpfH+iU713 2igblw5SaM5UCkuktOhl0YnK8txzKEdfPAlnStkqKDRB0iA09W1wkqtVoM6p X-Gm-Gg: ASbGncsGaP8LlI75eNtJeHeIaJB+Ko2ZSAgQ00d++jdjBroNd0J8ABmNOBP/YiqY8mP /NhLRxeQ5AN5kVNlVgBvuHPQdt8IH3OgmghC4LjWFqG/m4BPCp8STusGKS6vGNmG4TtSeMVwd2+ FPq3josLp9OhLzv6ybNwUqdjzhxXO+DM9bGkiNSMtI2BZgvzfn4ywmEh5SkdjDpGV0Gs1mvMMz7 9IG0PeZKyjTX7BuXLMmpeDXyA== X-Google-Smtp-Source: AGHT+IGz+LyrZDzvfCoKDhErZ+b/JaQjJiXvjgJkFwTA738KB46n0B3huiI/heNm8CMJy3bBB07lhg== X-Received: by 2002:a17:902:da90:b0:20c:af5c:fc90 with SMTP id d9443c01a7336-215bd13df48mr302575ad.49.1733174625572; Mon, 02 Dec 2024 13:23:45 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:45 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 09/11] net: gianfar: remove free_gfar_dev Date: Mon, 2 Dec 2024 13:23:29 -0800 Message-ID: <20241202212331.7238-10-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Dec 2 21:23:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891328 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 3CB111E0480; Mon, 2 Dec 2024 21:23:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174629; cv=none; b=JGZUdrDMsGJ0fTYAI/C0wLEqQBUpnqWNdDdbPTv90nqfPyesHsIcoGPJEeLPy03AUpuZS4tYHFSLZ6QrKXvBn6C2H6bnMOn6noleuvllBkabOD//PFP4Jtdp1BtcnmbuNeyfJzops4L5uFc+XNzU3A15YmOdNMyuL1bG+EIc6C0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174629; c=relaxed/simple; bh=d5WVrbA2ZIXi7QcPy+mO8gXOberPzyE3RYUplpOiGoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rM3xge4mhgOnqZ27lIEiXoTvk/PnUD7udnQy2/I58SAtzRyLsJG2OZ3dBzlqvYbbGO8qODCxoJ3B7wiLczAJawoaW3FFj6qAWhDxd4l50M2gmkAIZt+ve4G4+nP7JunHBhfNWIcpoyrDYpA9i4+exI4e4FNI9c8dNulPT23MAQA= 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=DZ0JKaiE; arc=none smtp.client-ip=209.85.214.169 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="DZ0JKaiE" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2127d4140bbso44643445ad.1; Mon, 02 Dec 2024 13:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174627; x=1733779427; 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=DZ0JKaiE7jOIAEF+dCg8zxJ5FpaKYzjvmyXd/g32sHe3DiE7i1JQS4V6Mn3hA/KvXS Ey9ACYv10BpOMeRPZUPnN4Wz6shJFbAbRW40/cRM9/lOlFagSZu3FH5xa6iuPfvR9d1k PX2n+dXL6nhMWDUpdnrQ7snoisz5T8QbOkBaAN8p7g5RaH/KCINm7pjLtA4mG0GGIole aPrbP7+rKWX2RR+eb53DSkvYKr03hXA6n/2NGOV3WdkmxwuND84kGDwKY73CdqMgVUHj Cba/0qbOg6aJkPhAXw9MSDKl4UsHd0IYOIgBapr8VWKbbqkCVN02dfCZgstQ3u+SPeFG 58nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174627; x=1733779427; 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=El8LmTck2IuSZcoqkOrC6CrBmpkJ6B1LEG7dr1YkxafEn9VDRHgZX2kROKQC/JA0Di Sj5NN25VVvxCahELhrBLV8Hzf81CSN+zOpVDlzkYjr3M3hsLPLqZEe8t2QgtUnhi/RsK ckBle44na0zXb8LLohoLKiujKj3xK82INWiTIVTM2ml6qc3PSdhJvFMZNGlyLCGn4ouL yH9kKvNiGY2od+YebYvb1qi1MuxLbipydE7c+bezaWnrFyNTAhm8Awjp6rkQFDYVttpX gHvO7+IlbqossBPKrl/u9sLjjWW6CX1QoiY7banGs2NHmIrZn2pRElQrBw9PUcNd0aac 3irQ== X-Forwarded-Encrypted: i=1; AJvYcCWMoF1HBsYCr4/Hyh4mQlI6EAL7pJsYct1ihesqd7QNsC2Mw8Vdp4kp9PlF/tJsf0HBmHvEI4nbaOekyY8=@vger.kernel.org X-Gm-Message-State: AOJu0YyjOJm9eBid0ZE6gZevrSbW5o/Z22FBetn5YMmJ2gGOiK6dkp2H DZTLeqfpjwmsDQUJYXWo2DENdpmjVbkycPqAeegqcYhkvNyGCgtgNWPdHA13 X-Gm-Gg: ASbGncuOINOH7zsZYacueZRhKaOPveIXj/wFxZlxk8xpz8V09r5TYUB+Z0qCPJs/XXC +rcWRqLzXiYzJZzv41AesfTY5uxtLMtIZAeDZO5H7z2TtCioqDRH6wxTAE0QScXJ6xoK8DaYeJc We1wW8RpIlf5IisJYHW54w5xMiQ3RnWjrMsZ6YzoWvBqlTuhKkLfr1rwT6Tfhp2KykNT8I95Lm1 FJ2vx3/+WcOnal/zxdALi6nCg== X-Google-Smtp-Source: AGHT+IEAKapgf9LlQcMpkbNAnZyi9RJocZ6dBjrVz8dJI3b3jqCfUDB848BRGpo1rXM2KqWOKV/h2Q== X-Received: by 2002:a17:902:f687:b0:215:5a53:edee with SMTP id d9443c01a7336-215bcfc52f9mr521305ad.9.1733174626933; Mon, 02 Dec 2024 13:23:46 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:46 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 10/11] net: gianfar: alloc queues with devm Date: Mon, 2 Dec 2024 13:23:30 -0800 Message-ID: <20241202212331.7238-11-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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 Dec 2 21:23:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13891329 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 1004E1E0DF9; Mon, 2 Dec 2024 21:23:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174630; cv=none; b=qeuVtlIVT1OIxixzBPtQ/8tFQ46uR2dT1/j9C06DC+cN3hRoDtCn0/9FR/cTgA1as98fFaLu+OgjQHQKtQPwr6helHmGDzaL/gLbrjPXXyF70djrlZneIJjq5rftBWlRAHyNk8Ulj9h4U7RlwIQ49f8tLOYlPzt4t++K6ccdLlg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733174630; c=relaxed/simple; bh=//y4HhrPotue02nBUtPgcflgl/boQHqvOPQ9RixjeGo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wv8JZkBafIpaX3T5t0eF1kj5ovxL4f3Dg4myVKBKytww8l2U+5zf63E4a75wufS+Q2jaBSw1HU4a2jircYa8xGCdqU7f4FCoKuL8B+Ql+1fWT/vuhw5k8TME6qdbVWT9vsHFWnvViMkWGp4Bz8j4RA8nIr7A1JLAhfbma3IGbIM= 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=A89o9x61; arc=none smtp.client-ip=209.85.214.172 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="A89o9x61" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-21145812538so38297785ad.0; Mon, 02 Dec 2024 13:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733174628; x=1733779428; 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=A89o9x611FodRN7IDuFEQAtgJD79aBndDtYupmPK9UN8S+/LAKxY6v7bexDdP6k/iR q00NB/hDYijXTvsJa8FXS/PionCRaDpuyLre/si16Zgz90v7GnKiiNQocwaTOfYcRLLf fIq9XrRprshfMI+rLgOl3NdHa+jJa8zNisBAOmBmCgnyqlNMRKkYvubWkpusHeSdrOdO U2515VWcVsQMpUyvE4MeqBwiA6JeWkZ4fi3lEzGsJMXFxzOA62u+PDrNVwA+oy8yOyUB cWTPnWAovYbugir10Sna7EEzJc15jo3uK610MHnOOFfUwYKr23vCjc3Yoe9LOVIxHhaT Et3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733174628; x=1733779428; 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=cHr8CZbyvF8n7N6MM0D40JNC7WBIwH1+MpNRgqEaDibUCvHe3jIVm4eoLQI8F/fXKk jNN7vHCybL0+ohS0EaQ289cNiTD/r+64UYCmCCtxef+LlRKHq0DQRuBqXZSWcDP54te6 l6v4NaHDQt8GFqipo9v9ZTO9Vojx+QgufdLdIgaZB8e/JCTEbLz+MzBNS+utuvwFoogQ 14DaGDdePWJcot45/NP4FHhQnmUpOXlYoFN4UK6pf7+8Ml8fx5vQrpGr9tBLmfrc5Wvv ZI5qDon2sIhYL/LUZv0PvEp4YeE4gHhc4GU3XwZ6uBVHKNE+H2uXaGXDjhhJUOJuR455 fD2A== X-Forwarded-Encrypted: i=1; AJvYcCXlHTBhX/prNP9OdUNm1X2J90k+W1Gf7lWnJHEVpCeSubE9WGJsN7fu/m1FemCZ+xm6gX25E4TWPYFstjU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/HS44UOoSbfYsQAlCakZaVfj9eniTBCx8v1HMQHoCTCfwKII+ /K/g1nRsCcZuJlGuePYAHY/s/c8u0qPIGCmLSUuf01Kc/AihgyjR26FfrPmR X-Gm-Gg: ASbGnctvCX0T1pFu9Q/EfUy5HLHFPOowzYiFly/JY0V+CyrmYCWt5Z3ddut6xOUYRxc KjW/opuhPsCJCkD1Eewa216+jGBu6PsO9qdXRF4dLUxLgJ+YcoyQnaa5vIa7ZWUmPQ3Dq9mkzm0 EccM2ZT3rqgYNvXIkBHI7KkG+YsRzJ51vJ3a0PFeaQRskTFxbiqzpFnXN4VYKzqL4jLol265kSu 1edUPIzlrKCvH3YxQDfaBLJAw== X-Google-Smtp-Source: AGHT+IFIan+i6PUAZhU/fBWXEd1C1hzWZPqVCUaEHLsb7o3ZsFobpXVRU4VdgRDlO7dqbXAOFR55GQ== X-Received: by 2002:a17:902:e743:b0:215:4f98:da0d with SMTP id d9443c01a7336-215bd0d8968mr719445ad.15.1733174628186; Mon, 02 Dec 2024 13:23:48 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21598f3281fsm20729515ad.279.2024.12.02.13.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 13:23:47 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 11/11] net: gianfar: iomap with devm Date: Mon, 2 Dec 2024 13:23:31 -0800 Message-ID: <20241202212331.7238-12-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202212331.7238-1-rosenp@gmail.com> References: <20241202212331.7238-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