linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/drivers: Remove redundant driver match function
@ 2022-05-06  4:59 lizhe
  2022-05-06  6:49 ` Uwe Kleine-König
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: lizhe @ 2022-05-06  4:59 UTC (permalink / raw)
  To: lee.jones, fthain, akrowiak, pasic, jjherne, freude, hca, gor,
	agordeev, borntraeger, svens, jejb, martin.petersen, zbr, perex,
	tiwai, bvanassche, dan.j.williams, srinivas.kandagatla, wens,
	colin.king, u.kleine-koenig, hare, sensor1010
  Cc: linux-kernel, linux-m68k, linux-s390, linux-scsi, target-devel,
	alsa-devel

If there is no driver match function, the driver core assumes that each
candidate pair (driver, device) matches, see driver_match_device().

Signed-off-by: lizhe <sensor1010@163.com>
---
 drivers/mfd/mcp-core.c             |  6 ------
 drivers/nubus/bus.c                |  6 ------
 drivers/s390/crypto/vfio_ap_drv.c  |  6 ------
 drivers/scsi/scsi_debug.c          |  7 -------
 drivers/target/loopback/tcm_loop.c |  7 -------
 drivers/w1/w1.c                    |  6 ------
 sound/ac97_bus.c                   | 11 -----------
 7 files changed, 49 deletions(-)

diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c
index 2fa592c37c6f..281a9369f2b3 100644
--- a/drivers/mfd/mcp-core.c
+++ b/drivers/mfd/mcp-core.c
@@ -20,11 +20,6 @@
 #define to_mcp(d)		container_of(d, struct mcp, attached_device)
 #define to_mcp_driver(d)	container_of(d, struct mcp_driver, drv)
 
-static int mcp_bus_match(struct device *dev, struct device_driver *drv)
-{
-	return 1;
-}
-
 static int mcp_bus_probe(struct device *dev)
 {
 	struct mcp *mcp = to_mcp(dev);
@@ -43,7 +38,6 @@ static void mcp_bus_remove(struct device *dev)
 
 static struct bus_type mcp_bus_type = {
 	.name		= "mcp",
-	.match		= mcp_bus_match,
 	.probe		= mcp_bus_probe,
 	.remove		= mcp_bus_remove,
 };
diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
index 17fad660032c..72921e4f35f6 100644
--- a/drivers/nubus/bus.c
+++ b/drivers/nubus/bus.c
@@ -14,11 +14,6 @@
 #define to_nubus_board(d)       container_of(d, struct nubus_board, dev)
 #define to_nubus_driver(d)      container_of(d, struct nubus_driver, driver)
 
-static int nubus_bus_match(struct device *dev, struct device_driver *driver)
-{
-	return 1;
-}
-
 static int nubus_device_probe(struct device *dev)
 {
 	struct nubus_driver *ndrv = to_nubus_driver(dev->driver);
@@ -39,7 +34,6 @@ static void nubus_device_remove(struct device *dev)
 
 struct bus_type nubus_bus_type = {
 	.name		= "nubus",
-	.match		= nubus_bus_match,
 	.probe		= nubus_device_probe,
 	.remove		= nubus_device_remove,
 };
diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
index 29ebd54f8919..0a662c451f2a 100644
--- a/drivers/s390/crypto/vfio_ap_drv.c
+++ b/drivers/s390/crypto/vfio_ap_drv.c
@@ -172,14 +172,8 @@ static void vfio_ap_matrix_dev_release(struct device *dev)
 	kfree(matrix_dev);
 }
 
-static int matrix_bus_match(struct device *dev, struct device_driver *drv)
-{
-	return 1;
-}
-
 static struct bus_type matrix_bus = {
 	.name = "matrix",
-	.match = &matrix_bus_match,
 };
 
 static struct device_driver matrix_driver = {
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 592a290e6cfa..8107489b36e8 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -7844,15 +7844,8 @@ static void sdebug_driver_remove(struct device *dev)
 	scsi_host_put(sdbg_host->shost);
 }
 
-static int pseudo_lld_bus_match(struct device *dev,
-				struct device_driver *dev_driver)
-{
-	return 1;
-}
-
 static struct bus_type pseudo_lld_bus = {
 	.name = "pseudo",
-	.match = pseudo_lld_bus_match,
 	.probe = sdebug_driver_probe,
 	.remove = sdebug_driver_remove,
 	.drv_groups = sdebug_drv_groups,
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 4407b56aa6d1..eeb63deff94f 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -83,15 +83,8 @@ static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host)
 static int tcm_loop_driver_probe(struct device *);
 static void tcm_loop_driver_remove(struct device *);
 
-static int pseudo_lld_bus_match(struct device *dev,
-				struct device_driver *dev_driver)
-{
-	return 1;
-}
-
 static struct bus_type tcm_loop_lld_bus = {
 	.name			= "tcm_loop_bus",
-	.match			= pseudo_lld_bus_match,
 	.probe			= tcm_loop_driver_probe,
 	.remove			= tcm_loop_driver_remove,
 };
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index f2ae2e563dc5..a6ecfa1b3417 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -58,11 +58,6 @@ MODULE_PARM_DESC(slave_ttl,
 DEFINE_MUTEX(w1_mlock);
 LIST_HEAD(w1_masters);
 
-static int w1_master_match(struct device *dev, struct device_driver *drv)
-{
-	return 1;
-}
-
 static int w1_master_probe(struct device *dev)
 {
 	return -ENODEV;
@@ -174,7 +169,6 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env);
 
 static struct bus_type w1_bus_type = {
 	.name = "w1",
-	.match = w1_master_match,
 	.uevent = w1_uevent,
 };
 
diff --git a/sound/ac97_bus.c b/sound/ac97_bus.c
index b4685c53ff11..c7aee8c42c55 100644
--- a/sound/ac97_bus.c
+++ b/sound/ac97_bus.c
@@ -75,19 +75,8 @@ int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
 }
 EXPORT_SYMBOL_GPL(snd_ac97_reset);
 
-/*
- * Let drivers decide whether they want to support given codec from their
- * probe method. Drivers have direct access to the struct snd_ac97
- * structure and may  decide based on the id field amongst other things.
- */
-static int ac97_bus_match(struct device *dev, struct device_driver *drv)
-{
-	return 1;
-}
-
 struct bus_type ac97_bus_type = {
 	.name		= "ac97",
-	.match		= ac97_bus_match,
 };
 
 static int __init ac97_bus_init(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] kernel/drivers: Remove redundant driver match function
  2022-05-06  4:59 [PATCH] kernel/drivers: Remove redundant driver match function lizhe
@ 2022-05-06  6:49 ` Uwe Kleine-König
  2022-05-09  7:25   ` Takashi Iwai
  2022-05-06 22:35 ` Finn Thain
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2022-05-06  6:49 UTC (permalink / raw)
  To: lizhe
  Cc: lee.jones, fthain, akrowiak, pasic, jjherne, freude, hca, gor,
	agordeev, borntraeger, svens, jejb, martin.petersen, zbr, perex,
	tiwai, bvanassche, dan.j.williams, srinivas.kandagatla, wens,
	colin.king, hare, linux-kernel, linux-m68k, linux-s390,
	linux-scsi, target-devel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 691 bytes --]

Hello,

On Thu, May 05, 2022 at 09:59:52PM -0700, lizhe wrote:
> If there is no driver match function, the driver core assumes that each
> candidate pair (driver, device) matches, see driver_match_device().
> 
> Signed-off-by: lizhe <sensor1010@163.com>

Reviewed-by: Uwe Kleine-König <u.kleine-koenig.org>

Side note: While looking through this patch I was surprised to see there
are two different busses for ac97: sound/ac97/bus.c + sound/ac97_bus.c .
It seems the duplication exists since 2017.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kernel/drivers: Remove redundant driver match function
  2022-05-06  4:59 [PATCH] kernel/drivers: Remove redundant driver match function lizhe
  2022-05-06  6:49 ` Uwe Kleine-König
@ 2022-05-06 22:35 ` Finn Thain
  2022-05-07  8:21 ` Uwe Kleine-König
  2022-05-09 11:36 ` Tony Krowiak
  3 siblings, 0 replies; 7+ messages in thread
From: Finn Thain @ 2022-05-06 22:35 UTC (permalink / raw)
  To: lizhe
  Cc: lee.jones, akrowiak, pasic, jjherne, freude, hca, gor, agordeev,
	borntraeger, svens, jejb, martin.petersen, zbr, perex, tiwai,
	bvanassche, dan.j.williams, srinivas.kandagatla, wens,
	colin.king, u.kleine-koenig, hare, linux-kernel, linux-m68k,
	linux-s390, linux-scsi, target-devel, alsa-devel


On Thu, 5 May 2022, lizhe wrote:

> If there is no driver match function, the driver core assumes that each
> candidate pair (driver, device) matches, see driver_match_device().
> 
> Signed-off-by: lizhe <sensor1010@163.com>

Acked-by: Finn Thain <fthain@linux-m68k.org>
for the nubus changes.

> ---
>  drivers/mfd/mcp-core.c             |  6 ------
>  drivers/nubus/bus.c                |  6 ------
>  drivers/s390/crypto/vfio_ap_drv.c  |  6 ------
>  drivers/scsi/scsi_debug.c          |  7 -------
>  drivers/target/loopback/tcm_loop.c |  7 -------
>  drivers/w1/w1.c                    |  6 ------
>  sound/ac97_bus.c                   | 11 -----------
>  7 files changed, 49 deletions(-)
> 
> diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c
> index 2fa592c37c6f..281a9369f2b3 100644
> --- a/drivers/mfd/mcp-core.c
> +++ b/drivers/mfd/mcp-core.c
> @@ -20,11 +20,6 @@
>  #define to_mcp(d)		container_of(d, struct mcp, attached_device)
>  #define to_mcp_driver(d)	container_of(d, struct mcp_driver, drv)
>  
> -static int mcp_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  static int mcp_bus_probe(struct device *dev)
>  {
>  	struct mcp *mcp = to_mcp(dev);
> @@ -43,7 +38,6 @@ static void mcp_bus_remove(struct device *dev)
>  
>  static struct bus_type mcp_bus_type = {
>  	.name		= "mcp",
> -	.match		= mcp_bus_match,
>  	.probe		= mcp_bus_probe,
>  	.remove		= mcp_bus_remove,
>  };
> diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
> index 17fad660032c..72921e4f35f6 100644
> --- a/drivers/nubus/bus.c
> +++ b/drivers/nubus/bus.c
> @@ -14,11 +14,6 @@
>  #define to_nubus_board(d)       container_of(d, struct nubus_board, dev)
>  #define to_nubus_driver(d)      container_of(d, struct nubus_driver, driver)
>  
> -static int nubus_bus_match(struct device *dev, struct device_driver *driver)
> -{
> -	return 1;
> -}
> -
>  static int nubus_device_probe(struct device *dev)
>  {
>  	struct nubus_driver *ndrv = to_nubus_driver(dev->driver);
> @@ -39,7 +34,6 @@ static void nubus_device_remove(struct device *dev)
>  
>  struct bus_type nubus_bus_type = {
>  	.name		= "nubus",
> -	.match		= nubus_bus_match,
>  	.probe		= nubus_device_probe,
>  	.remove		= nubus_device_remove,
>  };
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
> index 29ebd54f8919..0a662c451f2a 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -172,14 +172,8 @@ static void vfio_ap_matrix_dev_release(struct device *dev)
>  	kfree(matrix_dev);
>  }
>  
> -static int matrix_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  static struct bus_type matrix_bus = {
>  	.name = "matrix",
> -	.match = &matrix_bus_match,
>  };
>  
>  static struct device_driver matrix_driver = {
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 592a290e6cfa..8107489b36e8 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -7844,15 +7844,8 @@ static void sdebug_driver_remove(struct device *dev)
>  	scsi_host_put(sdbg_host->shost);
>  }
>  
> -static int pseudo_lld_bus_match(struct device *dev,
> -				struct device_driver *dev_driver)
> -{
> -	return 1;
> -}
> -
>  static struct bus_type pseudo_lld_bus = {
>  	.name = "pseudo",
> -	.match = pseudo_lld_bus_match,
>  	.probe = sdebug_driver_probe,
>  	.remove = sdebug_driver_remove,
>  	.drv_groups = sdebug_drv_groups,
> diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
> index 4407b56aa6d1..eeb63deff94f 100644
> --- a/drivers/target/loopback/tcm_loop.c
> +++ b/drivers/target/loopback/tcm_loop.c
> @@ -83,15 +83,8 @@ static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host)
>  static int tcm_loop_driver_probe(struct device *);
>  static void tcm_loop_driver_remove(struct device *);
>  
> -static int pseudo_lld_bus_match(struct device *dev,
> -				struct device_driver *dev_driver)
> -{
> -	return 1;
> -}
> -
>  static struct bus_type tcm_loop_lld_bus = {
>  	.name			= "tcm_loop_bus",
> -	.match			= pseudo_lld_bus_match,
>  	.probe			= tcm_loop_driver_probe,
>  	.remove			= tcm_loop_driver_remove,
>  };
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index f2ae2e563dc5..a6ecfa1b3417 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -58,11 +58,6 @@ MODULE_PARM_DESC(slave_ttl,
>  DEFINE_MUTEX(w1_mlock);
>  LIST_HEAD(w1_masters);
>  
> -static int w1_master_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  static int w1_master_probe(struct device *dev)
>  {
>  	return -ENODEV;
> @@ -174,7 +169,6 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env);
>  
>  static struct bus_type w1_bus_type = {
>  	.name = "w1",
> -	.match = w1_master_match,
>  	.uevent = w1_uevent,
>  };
>  
> diff --git a/sound/ac97_bus.c b/sound/ac97_bus.c
> index b4685c53ff11..c7aee8c42c55 100644
> --- a/sound/ac97_bus.c
> +++ b/sound/ac97_bus.c
> @@ -75,19 +75,8 @@ int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
>  }
>  EXPORT_SYMBOL_GPL(snd_ac97_reset);
>  
> -/*
> - * Let drivers decide whether they want to support given codec from their
> - * probe method. Drivers have direct access to the struct snd_ac97
> - * structure and may  decide based on the id field amongst other things.
> - */
> -static int ac97_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  struct bus_type ac97_bus_type = {
>  	.name		= "ac97",
> -	.match		= ac97_bus_match,
>  };
>  
>  static int __init ac97_bus_init(void)
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kernel/drivers: Remove redundant driver match function
  2022-05-06  4:59 [PATCH] kernel/drivers: Remove redundant driver match function lizhe
  2022-05-06  6:49 ` Uwe Kleine-König
  2022-05-06 22:35 ` Finn Thain
@ 2022-05-07  8:21 ` Uwe Kleine-König
  2022-05-07  8:33   ` Greg Kroah-Hartman
  2022-05-09 11:36 ` Tony Krowiak
  3 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2022-05-07  8:21 UTC (permalink / raw)
  To: lizhe, Greg Kroah-Hartman
  Cc: lee.jones, fthain, akrowiak, pasic, jjherne, freude, hca, gor,
	agordeev, borntraeger, svens, jejb, martin.petersen, zbr, perex,
	tiwai, bvanassche, dan.j.williams, srinivas.kandagatla, wens,
	colin.king, hare, linux-kernel, linux-m68k, linux-s390,
	linux-scsi, target-devel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 6163 bytes --]

Hello,

On Thu, May 05, 2022 at 09:59:52PM -0700, lizhe wrote:
> If there is no driver match function, the driver core assumes that each
> candidate pair (driver, device) matches, see driver_match_device().

I wonder who is supposed to apply this patch. Either it should be split
by file and go in via the respective maintainers, or it goes in via
Greg's tree? I added Greg to To: for him to chime in.

Best regards
Uwe
 
> Signed-off-by: lizhe <sensor1010@163.com>
> ---
>  drivers/mfd/mcp-core.c             |  6 ------
>  drivers/nubus/bus.c                |  6 ------
>  drivers/s390/crypto/vfio_ap_drv.c  |  6 ------
>  drivers/scsi/scsi_debug.c          |  7 -------
>  drivers/target/loopback/tcm_loop.c |  7 -------
>  drivers/w1/w1.c                    |  6 ------
>  sound/ac97_bus.c                   | 11 -----------
>  7 files changed, 49 deletions(-)
> 
> diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c
> index 2fa592c37c6f..281a9369f2b3 100644
> --- a/drivers/mfd/mcp-core.c
> +++ b/drivers/mfd/mcp-core.c
> @@ -20,11 +20,6 @@
>  #define to_mcp(d)		container_of(d, struct mcp, attached_device)
>  #define to_mcp_driver(d)	container_of(d, struct mcp_driver, drv)
>  
> -static int mcp_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  static int mcp_bus_probe(struct device *dev)
>  {
>  	struct mcp *mcp = to_mcp(dev);
> @@ -43,7 +38,6 @@ static void mcp_bus_remove(struct device *dev)
>  
>  static struct bus_type mcp_bus_type = {
>  	.name		= "mcp",
> -	.match		= mcp_bus_match,
>  	.probe		= mcp_bus_probe,
>  	.remove		= mcp_bus_remove,
>  };
> diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
> index 17fad660032c..72921e4f35f6 100644
> --- a/drivers/nubus/bus.c
> +++ b/drivers/nubus/bus.c
> @@ -14,11 +14,6 @@
>  #define to_nubus_board(d)       container_of(d, struct nubus_board, dev)
>  #define to_nubus_driver(d)      container_of(d, struct nubus_driver, driver)
>  
> -static int nubus_bus_match(struct device *dev, struct device_driver *driver)
> -{
> -	return 1;
> -}
> -
>  static int nubus_device_probe(struct device *dev)
>  {
>  	struct nubus_driver *ndrv = to_nubus_driver(dev->driver);
> @@ -39,7 +34,6 @@ static void nubus_device_remove(struct device *dev)
>  
>  struct bus_type nubus_bus_type = {
>  	.name		= "nubus",
> -	.match		= nubus_bus_match,
>  	.probe		= nubus_device_probe,
>  	.remove		= nubus_device_remove,
>  };
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
> index 29ebd54f8919..0a662c451f2a 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -172,14 +172,8 @@ static void vfio_ap_matrix_dev_release(struct device *dev)
>  	kfree(matrix_dev);
>  }
>  
> -static int matrix_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  static struct bus_type matrix_bus = {
>  	.name = "matrix",
> -	.match = &matrix_bus_match,
>  };
>  
>  static struct device_driver matrix_driver = {
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 592a290e6cfa..8107489b36e8 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -7844,15 +7844,8 @@ static void sdebug_driver_remove(struct device *dev)
>  	scsi_host_put(sdbg_host->shost);
>  }
>  
> -static int pseudo_lld_bus_match(struct device *dev,
> -				struct device_driver *dev_driver)
> -{
> -	return 1;
> -}
> -
>  static struct bus_type pseudo_lld_bus = {
>  	.name = "pseudo",
> -	.match = pseudo_lld_bus_match,
>  	.probe = sdebug_driver_probe,
>  	.remove = sdebug_driver_remove,
>  	.drv_groups = sdebug_drv_groups,
> diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
> index 4407b56aa6d1..eeb63deff94f 100644
> --- a/drivers/target/loopback/tcm_loop.c
> +++ b/drivers/target/loopback/tcm_loop.c
> @@ -83,15 +83,8 @@ static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host)
>  static int tcm_loop_driver_probe(struct device *);
>  static void tcm_loop_driver_remove(struct device *);
>  
> -static int pseudo_lld_bus_match(struct device *dev,
> -				struct device_driver *dev_driver)
> -{
> -	return 1;
> -}
> -
>  static struct bus_type tcm_loop_lld_bus = {
>  	.name			= "tcm_loop_bus",
> -	.match			= pseudo_lld_bus_match,
>  	.probe			= tcm_loop_driver_probe,
>  	.remove			= tcm_loop_driver_remove,
>  };
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index f2ae2e563dc5..a6ecfa1b3417 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -58,11 +58,6 @@ MODULE_PARM_DESC(slave_ttl,
>  DEFINE_MUTEX(w1_mlock);
>  LIST_HEAD(w1_masters);
>  
> -static int w1_master_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  static int w1_master_probe(struct device *dev)
>  {
>  	return -ENODEV;
> @@ -174,7 +169,6 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env);
>  
>  static struct bus_type w1_bus_type = {
>  	.name = "w1",
> -	.match = w1_master_match,
>  	.uevent = w1_uevent,
>  };
>  
> diff --git a/sound/ac97_bus.c b/sound/ac97_bus.c
> index b4685c53ff11..c7aee8c42c55 100644
> --- a/sound/ac97_bus.c
> +++ b/sound/ac97_bus.c
> @@ -75,19 +75,8 @@ int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
>  }
>  EXPORT_SYMBOL_GPL(snd_ac97_reset);
>  
> -/*
> - * Let drivers decide whether they want to support given codec from their
> - * probe method. Drivers have direct access to the struct snd_ac97
> - * structure and may  decide based on the id field amongst other things.
> - */
> -static int ac97_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>  struct bus_type ac97_bus_type = {
>  	.name		= "ac97",
> -	.match		= ac97_bus_match,
>  };
>  
>  static int __init ac97_bus_init(void)
> -- 
> 2.25.1
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kernel/drivers: Remove redundant driver match function
  2022-05-07  8:21 ` Uwe Kleine-König
@ 2022-05-07  8:33   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-05-07  8:33 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: lizhe, lee.jones, fthain, akrowiak, pasic, jjherne, freude, hca,
	gor, agordeev, borntraeger, svens, jejb, martin.petersen, zbr,
	perex, tiwai, bvanassche, dan.j.williams, srinivas.kandagatla,
	wens, colin.king, hare, linux-kernel, linux-m68k, linux-s390,
	linux-scsi, target-devel, alsa-devel

On Sat, May 07, 2022 at 10:21:37AM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> On Thu, May 05, 2022 at 09:59:52PM -0700, lizhe wrote:
> > If there is no driver match function, the driver core assumes that each
> > candidate pair (driver, device) matches, see driver_match_device().
> 
> I wonder who is supposed to apply this patch. Either it should be split
> by file and go in via the respective maintainers, or it goes in via
> Greg's tree? I added Greg to To: for him to chime in.

It should be split up into each subsystem patch and submitted that way.

> Best regards
> Uwe
>  
> > Signed-off-by: lizhe <sensor1010@163.com>

We also need a "real name" here that is used to sign legal documents.  I
doubt an all-lower-case name is used that way, so I have to ask.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kernel/drivers: Remove redundant driver match function
  2022-05-06  6:49 ` Uwe Kleine-König
@ 2022-05-09  7:25   ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2022-05-09  7:25 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: lizhe, lee.jones, fthain, akrowiak, pasic, jjherne, freude, hca,
	gor, agordeev, borntraeger, svens, jejb, martin.petersen, zbr,
	perex, tiwai, bvanassche, dan.j.williams, srinivas.kandagatla,
	wens, colin.king, hare, linux-kernel, linux-m68k, linux-s390,
	linux-scsi, target-devel, alsa-devel

On Fri, 06 May 2022 08:49:27 +0200,
Uwe Kleine-König wrote:
> 
> Hello,
> 
> On Thu, May 05, 2022 at 09:59:52PM -0700, lizhe wrote:
> > If there is no driver match function, the driver core assumes that each
> > candidate pair (driver, device) matches, see driver_match_device().
> > 
> > Signed-off-by: lizhe <sensor1010@163.com>
> 
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig.org>
> 
> Side note: While looking through this patch I was surprised to see there
> are two different busses for ac97: sound/ac97/bus.c + sound/ac97_bus.c .
> It seems the duplication exists since 2017.

Those are intentional and will be likely kept as-is.  In theory those
could be unified, but there are quite lots of quirk codes for the old
bus implementations and it'll be way too much work to rewrite for the
new bus.


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kernel/drivers: Remove redundant driver match function
  2022-05-06  4:59 [PATCH] kernel/drivers: Remove redundant driver match function lizhe
                   ` (2 preceding siblings ...)
  2022-05-07  8:21 ` Uwe Kleine-König
@ 2022-05-09 11:36 ` Tony Krowiak
  3 siblings, 0 replies; 7+ messages in thread
From: Tony Krowiak @ 2022-05-09 11:36 UTC (permalink / raw)
  To: lizhe, lee.jones, fthain, pasic, jjherne, freude, hca, gor,
	agordeev, borntraeger, svens, jejb, martin.petersen, zbr, perex,
	tiwai, bvanassche, dan.j.williams, srinivas.kandagatla, wens,
	colin.king, u.kleine-koenig, hare
  Cc: linux-kernel, linux-m68k, linux-s390, linux-scsi, target-devel,
	alsa-devel

For the drivers/s390/crypto/vfio_ap_drv.c device driver:
Reviewed-by: Tony Krowiak <akrowiak@stny.rr.com>

On 5/6/22 12:59 AM, lizhe wrote:
> If there is no driver match function, the driver core assumes that each
> candidate pair (driver, device) matches, see driver_match_device().
>
> Signed-off-by: lizhe <sensor1010@163.com>
> ---
>   drivers/mfd/mcp-core.c             |  6 ------
>   drivers/nubus/bus.c                |  6 ------
>   drivers/s390/crypto/vfio_ap_drv.c  |  6 ------
>   drivers/scsi/scsi_debug.c          |  7 -------
>   drivers/target/loopback/tcm_loop.c |  7 -------
>   drivers/w1/w1.c                    |  6 ------
>   sound/ac97_bus.c                   | 11 -----------
>   7 files changed, 49 deletions(-)
>
> diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c
> index 2fa592c37c6f..281a9369f2b3 100644
> --- a/drivers/mfd/mcp-core.c
> +++ b/drivers/mfd/mcp-core.c
> @@ -20,11 +20,6 @@
>   #define to_mcp(d)		container_of(d, struct mcp, attached_device)
>   #define to_mcp_driver(d)	container_of(d, struct mcp_driver, drv)
>   
> -static int mcp_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>   static int mcp_bus_probe(struct device *dev)
>   {
>   	struct mcp *mcp = to_mcp(dev);
> @@ -43,7 +38,6 @@ static void mcp_bus_remove(struct device *dev)
>   
>   static struct bus_type mcp_bus_type = {
>   	.name		= "mcp",
> -	.match		= mcp_bus_match,
>   	.probe		= mcp_bus_probe,
>   	.remove		= mcp_bus_remove,
>   };
> diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
> index 17fad660032c..72921e4f35f6 100644
> --- a/drivers/nubus/bus.c
> +++ b/drivers/nubus/bus.c
> @@ -14,11 +14,6 @@
>   #define to_nubus_board(d)       container_of(d, struct nubus_board, dev)
>   #define to_nubus_driver(d)      container_of(d, struct nubus_driver, driver)
>   
> -static int nubus_bus_match(struct device *dev, struct device_driver *driver)
> -{
> -	return 1;
> -}
> -
>   static int nubus_device_probe(struct device *dev)
>   {
>   	struct nubus_driver *ndrv = to_nubus_driver(dev->driver);
> @@ -39,7 +34,6 @@ static void nubus_device_remove(struct device *dev)
>   
>   struct bus_type nubus_bus_type = {
>   	.name		= "nubus",
> -	.match		= nubus_bus_match,
>   	.probe		= nubus_device_probe,
>   	.remove		= nubus_device_remove,
>   };
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
> index 29ebd54f8919..0a662c451f2a 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -172,14 +172,8 @@ static void vfio_ap_matrix_dev_release(struct device *dev)
>   	kfree(matrix_dev);
>   }
>   
> -static int matrix_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>   static struct bus_type matrix_bus = {
>   	.name = "matrix",
> -	.match = &matrix_bus_match,
>   };
>   
>   static struct device_driver matrix_driver = {
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 592a290e6cfa..8107489b36e8 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -7844,15 +7844,8 @@ static void sdebug_driver_remove(struct device *dev)
>   	scsi_host_put(sdbg_host->shost);
>   }
>   
> -static int pseudo_lld_bus_match(struct device *dev,
> -				struct device_driver *dev_driver)
> -{
> -	return 1;
> -}
> -
>   static struct bus_type pseudo_lld_bus = {
>   	.name = "pseudo",
> -	.match = pseudo_lld_bus_match,
>   	.probe = sdebug_driver_probe,
>   	.remove = sdebug_driver_remove,
>   	.drv_groups = sdebug_drv_groups,
> diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
> index 4407b56aa6d1..eeb63deff94f 100644
> --- a/drivers/target/loopback/tcm_loop.c
> +++ b/drivers/target/loopback/tcm_loop.c
> @@ -83,15 +83,8 @@ static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host)
>   static int tcm_loop_driver_probe(struct device *);
>   static void tcm_loop_driver_remove(struct device *);
>   
> -static int pseudo_lld_bus_match(struct device *dev,
> -				struct device_driver *dev_driver)
> -{
> -	return 1;
> -}
> -
>   static struct bus_type tcm_loop_lld_bus = {
>   	.name			= "tcm_loop_bus",
> -	.match			= pseudo_lld_bus_match,
>   	.probe			= tcm_loop_driver_probe,
>   	.remove			= tcm_loop_driver_remove,
>   };
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index f2ae2e563dc5..a6ecfa1b3417 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -58,11 +58,6 @@ MODULE_PARM_DESC(slave_ttl,
>   DEFINE_MUTEX(w1_mlock);
>   LIST_HEAD(w1_masters);
>   
> -static int w1_master_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>   static int w1_master_probe(struct device *dev)
>   {
>   	return -ENODEV;
> @@ -174,7 +169,6 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env);
>   
>   static struct bus_type w1_bus_type = {
>   	.name = "w1",
> -	.match = w1_master_match,
>   	.uevent = w1_uevent,
>   };
>   
> diff --git a/sound/ac97_bus.c b/sound/ac97_bus.c
> index b4685c53ff11..c7aee8c42c55 100644
> --- a/sound/ac97_bus.c
> +++ b/sound/ac97_bus.c
> @@ -75,19 +75,8 @@ int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
>   }
>   EXPORT_SYMBOL_GPL(snd_ac97_reset);
>   
> -/*
> - * Let drivers decide whether they want to support given codec from their
> - * probe method. Drivers have direct access to the struct snd_ac97
> - * structure and may  decide based on the id field amongst other things.
> - */
> -static int ac97_bus_match(struct device *dev, struct device_driver *drv)
> -{
> -	return 1;
> -}
> -
>   struct bus_type ac97_bus_type = {
>   	.name		= "ac97",
> -	.match		= ac97_bus_match,
>   };
>   
>   static int __init ac97_bus_init(void)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-09 11:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  4:59 [PATCH] kernel/drivers: Remove redundant driver match function lizhe
2022-05-06  6:49 ` Uwe Kleine-König
2022-05-09  7:25   ` Takashi Iwai
2022-05-06 22:35 ` Finn Thain
2022-05-07  8:21 ` Uwe Kleine-König
2022-05-07  8:33   ` Greg Kroah-Hartman
2022-05-09 11:36 ` Tony Krowiak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).