Skip to contentSkip to conversation

net: tulip: convert to devres

PATCH Superseded Rolf Eike Beer 3 participants 6 messages May 11, 2022 – May 19, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: tulip: convert to devres

Works fine on my HP C3600:

[  274.452394] tulip0: no phy info, aborting mtable build
[  274.499041] tulip0:  MII transceiver #1 config 1000 status 782d advertising 01e1
[  274.750691] net eth0: Digital DS21142/43 Tulip rev 65 at MMIO 0xf4008000, 00:30:6e:08:7d:21, IRQ 17
[  283.104520] net eth0: Setting full-duplex based on MII#1 link partner capability of c1e1
---
 drivers/net/ethernet/dec/tulip/eeprom.c     |  7 +--
 drivers/net/ethernet/dec/tulip/tulip_core.c | 59 ++++++---------------
 2 files changed, 19 insertions(+), 47 deletions(-)
drivers/net/ethernet/dec/tulip/eeprom.c +4 -3
index ba0a69b363f8..67a67cb78dbb 100644
@@ -117,8 +117,8 @@ static void tulip_build_fake_mediatable(struct tulip_private *tp)
 			  0x00, 0x06  /* ttm bit map */
 			};
 
-		tp->mtable = kmalloc(sizeof(struct mediatable) +
-				     sizeof(struct medialeaf), GFP_KERNEL);
+		tp->mtable = devm_kmalloc(&tp->pdev->pdev, sizeof(struct mediatable) +
+					  sizeof(struct medialeaf), GFP_KERNEL);
 
 		if (tp->mtable == NULL)
 			return; /* Horrible, impossible failure. */
@@ -224,7 +224,8 @@ void tulip_parse_eeprom(struct net_device *dev)
 		        return;
 		}
 
-		mtable = kmalloc(struct_size(mtable, mleaf, count), GFP_KERNEL);
+		mtable = devm_kmalloc(&tp->pdev->dev, struct_size(mtable, mleaf, count),
+				      GFP_KERNEL);
 		if (mtable == NULL)
 			return;				/* Horrible, impossible failure. */
 		last_mediatable = tp->mtable = mtable;
drivers/net/ethernet/dec/tulip/tulip_core.c +15 -44

114 lines not on this page · raw message

Signature · 1 line
2.35.3
maintainer
#1 lore raw
Quoted 8 lines · On Wed, 11 May 2022 23:57:30 +0200 Rolf Eike Beer wrote:

Works fine on my HP C3600:

[  274.452394] tulip0: no phy info, aborting mtable build
[  274.499041] tulip0:  MII transceiver #1 config 1000 status 782d advertising 01e1
[  274.750691] net eth0: Digital DS21142/43 Tulip rev 65 at MMIO 0xf4008000, 00:30:6e:08:7d:21, IRQ 17
[  283.104520] net eth0: Setting full-duplex based on MII#1 link partner capability of c1e1

Does not apply cleanly any more since the fix came in thru net. Please rebase / repost.

#2 lore raw

PATCH v2 1/1 net: tulip: convert to devres

In reply to Rolf Eike Beer

Works fine on my HP C3600:

[  274.452394] tulip0: no phy info, aborting mtable build
[  274.499041] tulip0:  MII transceiver #1 config 1000 status 782d advertising 01e1
[  274.750691] net eth0: Digital DS21142/43 Tulip rev 65 at MMIO 0xf4008000, 00:30:6e:08:7d:21, IRQ 17
[  283.104520] net eth0: Setting full-duplex based on MII#1 link partner capability of c1e1
---
 drivers/net/ethernet/dec/tulip/eeprom.c     |  7 ++-
 drivers/net/ethernet/dec/tulip/tulip_core.c | 64 ++++++---------------
 2 files changed, 20 insertions(+), 51 deletions(-)

v2: rebased

drivers/net/ethernet/dec/tulip/eeprom.c +4 -3
index ba0a69b363f8..67a67cb78dbb 100644
@@ -117,8 +117,8 @@ static void tulip_build_fake_mediatable(struct tulip_private *tp)
 			  0x00, 0x06  /* ttm bit map */
 			};
 
-		tp->mtable = kmalloc(sizeof(struct mediatable) +
-				     sizeof(struct medialeaf), GFP_KERNEL);
+		tp->mtable = devm_kmalloc(&tp->pdev->pdev, sizeof(struct mediatable) +
+					  sizeof(struct medialeaf), GFP_KERNEL);
 
 		if (tp->mtable == NULL)
 			return; /* Horrible, impossible failure. */
@@ -224,7 +224,8 @@ void tulip_parse_eeprom(struct net_device *dev)
 		        return;
 		}
 
-		mtable = kmalloc(struct_size(mtable, mleaf, count), GFP_KERNEL);
+		mtable = devm_kmalloc(&tp->pdev->dev, struct_size(mtable, mleaf, count),
+				      GFP_KERNEL);
 		if (mtable == NULL)
 			return;				/* Horrible, impossible failure. */
 		last_mediatable = tp->mtable = mtable;
drivers/net/ethernet/dec/tulip/tulip_core.c +16 -48

120 lines not on this page · raw message

Signature · 1 line
2.35.3
#3 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Fri, 13 May 2022 19:23:59 +0200 you wrote:

Works fine on my HP C3600:

[  274.452394] tulip0: no phy info, aborting mtable build
[  274.499041] tulip0:  MII transceiver #1 config 1000 status 782d advertising 01e1
[  274.750691] net eth0: Digital DS21142/43 Tulip rev 65 at MMIO 0xf4008000, 00:30:6e:08:7d:21, IRQ 17
[  283.104520] net eth0: Setting full-duplex based on MII#1 link partner capability of c1e1

[...]

Here is the summary with links:
- [v2] net: tulip: convert to devres

    https://git.kernel.org/netdev/net-next/c/3daebfbeb455

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#4 lore raw

PATCH v3 1/1 tulip: convert to devres

Works fine on my HP C3600:

[  274.452394] tulip0: no phy info, aborting mtable build
[  274.499041] tulip0:  MII transceiver #1 config 1000 status 782d advertising 01e1
[  274.750691] net eth0: Digital DS21142/43 Tulip rev 65 at MMIO 0xf4008000, 00:30:6e:08:7d:21, IRQ 17
[  283.104520] net eth0: Setting full-duplex based on MII#1 link partner capability of c1e1
---
 drivers/net/ethernet/dec/tulip/eeprom.c     |  7 ++-
 drivers/net/ethernet/dec/tulip/tulip_core.c | 64 ++++++---------------
 2 files changed, 20 insertions(+), 51 deletions(-)

v2: rebased

v3: fixed typo in variable for CONFIG_GSC code

drivers/net/ethernet/dec/tulip/eeprom.c +4 -3
index ba0a69b363f8..d5657ff15e3c 100644
@@ -117,8 +117,8 @@ static void tulip_build_fake_mediatable(struct tulip_private *tp)
 			  0x00, 0x06  /* ttm bit map */
 			};
 
-		tp->mtable = kmalloc(sizeof(struct mediatable) +
-				     sizeof(struct medialeaf), GFP_KERNEL);
+		tp->mtable = devm_kmalloc(&tp->pdev->dev, sizeof(struct mediatable) +
+					  sizeof(struct medialeaf), GFP_KERNEL);
 
 		if (tp->mtable == NULL)
 			return; /* Horrible, impossible failure. */
@@ -224,7 +224,8 @@ void tulip_parse_eeprom(struct net_device *dev)
 		        return;
 		}
 
-		mtable = kmalloc(struct_size(mtable, mleaf, count), GFP_KERNEL);
+		mtable = devm_kmalloc(&tp->pdev->dev, struct_size(mtable, mleaf, count),
+				      GFP_KERNEL);
 		if (mtable == NULL)
 			return;				/* Horrible, impossible failure. */
 		last_mediatable = tp->mtable = mtable;
drivers/net/ethernet/dec/tulip/tulip_core.c +16 -48

120 lines not on this page · raw message

Signature · 1 line
2.35.3
maintainer
#5 lore raw

Re: [PATCH v3] tulip: convert to devres

Quoted 8 lines · On Thu, 19 May 2022 15:40:44 +0200 Rolf Eike Beer wrote:

Works fine on my HP C3600:

[  274.452394] tulip0: no phy info, aborting mtable build
[  274.499041] tulip0:  MII transceiver #1 config 1000 status 782d advertising 01e1
[  274.750691] net eth0: Digital DS21142/43 Tulip rev 65 at MMIO 0xf4008000, 00:30:6e:08:7d:21, IRQ 17
[  283.104520] net eth0: Setting full-duplex based on MII#1 link partner capability of c1e1
Quoted 8 lines
---
 drivers/net/ethernet/dec/tulip/eeprom.c     |  7 ++-
 drivers/net/ethernet/dec/tulip/tulip_core.c | 64 ++++++---------------
 2 files changed, 20 insertions(+), 51 deletions(-)

v2: rebased

v3: fixed typo in variable for CONFIG_GSC code

Thanks for following up. Unfortunately net-next is "stable" in terms of commits it contains, we can swap the old patch for the new one. You need to send an incremental change.

Please provide a Fixes tag, and if you prefer to reply to something with the patch please reply to the report of breakage, that's better context for this work. Or just post independently (which is generally recommended)