Skip to contentSkip to conversation

vfio/cdx: Remove redundant initialization owner in vfio_cdx_driver

PATCH Applied Li Zetao 3 participants 4 messages Aug 8, 2023 – Aug 17, 2023

Subsystems (3)
lore
Share & tools
lore

Li Zetao

author
#0 lore raw

PATCH 1/1 vfio/cdx: Remove redundant initialization owner in vfio_cdx_driver

The cdx_driver_register() will set "THIS_MODULE" to driver.owner when register a cdx_driver driver, so it is redundant initialization to set driver.owner in the statement. Remove it for clean code.

---
 drivers/vfio/cdx/main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/vfio/cdx/main.c +0 -1
index c376a69d2db2..de56686581ae 100644
@@ -223,7 +223,6 @@ static struct cdx_driver vfio_cdx_driver = {
 	.match_id_table	= vfio_cdx_table,
 	.driver	= {
 		.name	= "vfio-cdx",
-		.owner	= THIS_MODULE,
 	},
 	.driver_managed_dma = true,
 };
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Li Zetao <[email protected]>
Sent: Tuesday, August 8, 2023 7:40 AM
To: Gupta, Nipun <[email protected]>; Agarwal, Nikhil <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH -next] vfio/cdx: Remove redundant initialization owner in vfio_cdx_driver

Quoted 5 lines

The cdx_driver_register() will set "THIS_MODULE" to driver.owner when register a cdx_driver driver, so it is redundant initialization to set driver.owner in the statement. Remove it for clean code.

#2 lore raw
In reply to Li Zetao
Quoted 14 lines · On Tue, 8 Aug 2023 10:09:37 +0800 Li Zetao <[email protected]> wrote:

The cdx_driver_register() will set "THIS_MODULE" to driver.owner when register a cdx_driver driver, so it is redundant initialization to set driver.owner in the statement. Remove it for clean code.

---
 drivers/vfio/cdx/main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/vfio/cdx/main.c +0 -0
index c376a69d2db2..de56686581ae 100644

drivers/vfio/cdx/main.c static struct cdx_driver vfio_cdx_driver = { · line 228

Quoted 7 lines
drivers/vfio/cdx/main.c +0 -1
@@ -223,7 +223,6 @@ static struct cdx_driver vfio_cdx_driver = {
 	.match_id_table	= vfio_cdx_table,
 	.driver	= {
 		.name	= "vfio-cdx",
-		.owner	= THIS_MODULE,
 	},
 	.driver_managed_dma = true,
 };

Doesn't vfio_fsl_mc_driver have the same issue?

#define fsl_mc_driver_register(drv) \
__fsl_mc_driver_register(drv, THIS_MODULE)

static struct fsl_mc_driver vfio_fsl_mc_driver = {
.probe = vfio_fsl_mc_probe,
.remove = vfio_fsl_mc_remove,
.driver = {
.name = "vfio-fsl-mc",
.owner = THIS_MODULE,
},
.driver_managed_dma = true,
};

That driver could also be converted to use module_driver(). Thanks,

Alex

#3 lore raw
In reply to Li Zetao
Quoted 8 lines · On Tue, 8 Aug 2023 10:09:37 +0800 Li Zetao <[email protected]> wrote:

The cdx_driver_register() will set "THIS_MODULE" to driver.owner when register a cdx_driver driver, so it is redundant initialization to set driver.owner in the statement. Remove it for clean code.

---
 drivers/vfio/cdx/main.c | 1 -
 1 file changed, 1 deletion(-)

Applied to vfio next branch for v6.6. Thanks!

Alex

Quoted 13 lines
drivers/vfio/cdx/main.c +0 -1
index c376a69d2db2..de56686581ae 100644
@@ -223,7 +223,6 @@ static struct cdx_driver vfio_cdx_driver = {
 	.match_id_table	= vfio_cdx_table,
 	.driver	= {
 		.name	= "vfio-cdx",
-		.owner	= THIS_MODULE,
 	},
 	.driver_managed_dma = true,
 };