Skip to contentSkip to conversation

ptp_ocp: use device_find_any_child() instead of custom approach

PATCH Applied Andy Shevchenko 3 participants 4 messages Sep 21, 2022 – Sep 23, 2022

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

PATCH 1/1 ptp_ocp: use device_find_any_child() instead of custom approach

We have already a helper to get the first child device, use it and drop custom approach.

---
 drivers/ptp/ptp_ocp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/ptp/ptp_ocp.c +1 -7
index 83da36e69361..ebed0161879e 100644
@@ -1311,12 +1311,6 @@ ptp_ocp_read_eeprom(struct ptp_ocp *bp)
 	goto out;
 }
 
-static int
-ptp_ocp_firstchild(struct device *dev, void *data)
-{
-	return 1;
-}
-
 static struct device *
 ptp_ocp_find_flash(struct ptp_ocp *bp)
 {
@@ -1325,7 +1319,7 @@ ptp_ocp_find_flash(struct ptp_ocp *bp)
 	last = NULL;
 	dev = &bp->spi_flash->dev;
 
-	while ((dev = device_find_child(dev, NULL, ptp_ocp_firstchild))) {
+	while ((dev = device_find_any_child(dev))) {
 		if (!strcmp("mtd", dev_bus_name(dev)))
 			break;
 		put_device(last);
Signature · 1 line
2.35.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Andy Shevchenko

We have already a helper to get the first child device, use it and drop custom approach.

LGTM. This patch should go to net-next, I believe.

Quoted 31 lines
---
  drivers/ptp/ptp_ocp.c | 8 +-------
  1 file changed, 1 insertion(+), 7 deletions(-)
drivers/ptp/ptp_ocp.c +1 -7
index 83da36e69361..ebed0161879e 100644
@@ -1311,12 +1311,6 @@ ptp_ocp_read_eeprom(struct ptp_ocp *bp)
  	goto out;
  }
 
-static int
-ptp_ocp_firstchild(struct device *dev, void *data)
-{
-	return 1;
-}
-
  static struct device *
  ptp_ocp_find_flash(struct ptp_ocp *bp)
  {
@@ -1325,7 +1319,7 @@ ptp_ocp_find_flash(struct ptp_ocp *bp)
  	last = NULL;
  	dev = &bp->spi_flash->dev;
 
-	while ((dev = device_find_child(dev, NULL, ptp_ocp_firstchild))) {
+	while ((dev = device_find_any_child(dev))) {
  		if (!strcmp("mtd", dev_bus_name(dev)))
  			break;
  		put_device(last);
#2 lore raw
Quoted 5 lines · Vadim Fedorenko
Quoted 2 lines · Andy Shevchenko

We have already a helper to get the first child device, use it and drop custom approach.

LGTM. This patch should go to net-next, I believe.

Yes, I forgot to add the 'net-next' to the Subject line.

Quoted 1 line

Thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
In reply to Andy Shevchenko
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 7 lines · On Wed, 21 Sep 2022 17:10:05 +0300 you wrote:

We have already a helper to get the first child device, use it and drop custom approach.

---
 drivers/ptp/ptp_ocp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Here is the summary with links:
- [v1,1/1] ptp_ocp: use device_find_any_child() instead of custom approach

    https://git.kernel.org/netdev/net-next/c/304843c7ac44

You are awesome, thank you!

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