All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] scsi: store owner from modules with scsi_register_driver()
@ 2024-03-28 20:45 Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 1/6] " Krzysztof Kozlowski
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-28 20:45 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Krzysztof Kozlowski

Merging
=======
All further patches depend on the first patch, therefore please ack
and this should go via one tree.

Best regards,
Krzysztof

---
Krzysztof Kozlowski (6):
      scsi: store owner from modules with scsi_register_driver()
      scsi: sd: drop driver owner initialization
      scsi: ses: drop driver owner initialization
      scsi: sr: drop driver owner initialization
      scsi: st: drop driver owner initialization
      ufs: core: drop driver owner initialization

 drivers/scsi/scsi_sysfs.c  | 5 +++--
 drivers/scsi/sd.c          | 1 -
 drivers/scsi/ses.c         | 1 -
 drivers/scsi/sr.c          | 1 -
 drivers/scsi/st.c          | 1 -
 drivers/ufs/core/ufshcd.c  | 1 -
 include/scsi/scsi_driver.h | 4 +++-
 7 files changed, 6 insertions(+), 8 deletions(-)
---
base-commit: 7fdcff3312e16ba8d1419f8a18f465c5cc235ecf
change-id: 20240328-b4-module-owner-scsi-91c327e55bc7

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


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

* [PATCH 1/6] scsi: store owner from modules with scsi_register_driver()
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
@ 2024-03-28 20:45 ` Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 2/6] scsi: sd: drop driver owner initialization Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-28 20:45 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Krzysztof Kozlowski

Modules registering driver with scsi_driver_register() might forget to
set .owner field.  The field is used by some of other kernel parts for
reference counting (try_module_get()), so it is expected that drivers
will set it.

Solve the problem by moving this task away from the drivers to the core
scsi code, just like we did for platform_driver in
commit 9447057eaff8 ("platform_device: use a macro instead of
platform_driver_register").

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/scsi/scsi_sysfs.c  | 5 +++--
 include/scsi/scsi_driver.h | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 775df00021e4..b5aae4e8ae33 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1609,13 +1609,14 @@ void scsi_remove_target(struct device *dev)
 }
 EXPORT_SYMBOL(scsi_remove_target);
 
-int scsi_register_driver(struct device_driver *drv)
+int __scsi_register_driver(struct device_driver *drv, struct module *owner)
 {
 	drv->bus = &scsi_bus_type;
+	drv->owner = owner;
 
 	return driver_register(drv);
 }
-EXPORT_SYMBOL(scsi_register_driver);
+EXPORT_SYMBOL(__scsi_register_driver);
 
 int scsi_register_interface(struct class_interface *intf)
 {
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 4ce1988b2ba0..5c6724322112 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -22,7 +22,9 @@ struct scsi_driver {
 #define to_scsi_driver(drv) \
 	container_of((drv), struct scsi_driver, gendrv)
 
-extern int scsi_register_driver(struct device_driver *);
+#define scsi_register_driver(drv) \
+	__scsi_register_driver(drv, THIS_MODULE)
+int __scsi_register_driver(struct device_driver *, struct module *);
 #define scsi_unregister_driver(drv) \
 	driver_unregister(drv);
 

-- 
2.34.1


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

* [PATCH 2/6] scsi: sd: drop driver owner initialization
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 1/6] " Krzysztof Kozlowski
@ 2024-03-28 20:45 ` Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 3/6] scsi: ses: " Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-28 20:45 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Krzysztof Kozlowski

Core in scsi_register_driver() already sets the .owner, so driver
does not need to.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/scsi/sd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ccff8f2e2e75..0b447f1bc1a9 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -4185,7 +4185,6 @@ static const struct dev_pm_ops sd_pm_ops = {
 static struct scsi_driver sd_template = {
 	.gendrv = {
 		.name		= "sd",
-		.owner		= THIS_MODULE,
 		.probe		= sd_probe,
 		.probe_type	= PROBE_PREFER_ASYNCHRONOUS,
 		.remove		= sd_remove,

-- 
2.34.1


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

* [PATCH 3/6] scsi: ses: drop driver owner initialization
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 1/6] " Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 2/6] scsi: sd: drop driver owner initialization Krzysztof Kozlowski
@ 2024-03-28 20:45 ` Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 4/6] scsi: sr: " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-28 20:45 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Krzysztof Kozlowski

Core in scsi_register_driver() already sets the .owner, so driver
does not need to.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/scsi/ses.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 0f2c87cc95e6..e22c7f5e652b 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -908,7 +908,6 @@ static struct class_interface ses_interface = {
 static struct scsi_driver ses_template = {
 	.gendrv = {
 		.name		= "ses",
-		.owner		= THIS_MODULE,
 		.probe		= ses_probe,
 		.remove		= ses_remove,
 	},

-- 
2.34.1


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

* [PATCH 4/6] scsi: sr: drop driver owner initialization
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2024-03-28 20:45 ` [PATCH 3/6] scsi: ses: " Krzysztof Kozlowski
@ 2024-03-28 20:45 ` Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 5/6] scsi: st: " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-28 20:45 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Krzysztof Kozlowski

Core in scsi_register_driver() already sets the .owner, so driver
does not need to.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/scsi/sr.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 268b3a40891e..7ab000942b97 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -95,7 +95,6 @@ static const struct dev_pm_ops sr_pm_ops = {
 static struct scsi_driver sr_template = {
 	.gendrv = {
 		.name   	= "sr",
-		.owner		= THIS_MODULE,
 		.probe		= sr_probe,
 		.remove		= sr_remove,
 		.pm		= &sr_pm_ops,

-- 
2.34.1


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

* [PATCH 5/6] scsi: st: drop driver owner initialization
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2024-03-28 20:45 ` [PATCH 4/6] scsi: sr: " Krzysztof Kozlowski
@ 2024-03-28 20:45 ` Krzysztof Kozlowski
  2024-03-28 20:45 ` [PATCH 6/6] ufs: core: " Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-28 20:45 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Krzysztof Kozlowski

Core in scsi_register_driver() already sets the .owner, so driver
does not need to.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/scsi/st.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 5a9bcf8e0792..0d8ce1a92168 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -206,7 +206,6 @@ static int st_remove(struct device *);
 static struct scsi_driver st_template = {
 	.gendrv = {
 		.name		= "st",
-		.owner		= THIS_MODULE,
 		.probe		= st_probe,
 		.remove		= st_remove,
 		.groups		= st_drv_groups,

-- 
2.34.1


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

* [PATCH 6/6] ufs: core: drop driver owner initialization
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2024-03-28 20:45 ` [PATCH 5/6] scsi: st: " Krzysztof Kozlowski
@ 2024-03-28 20:45 ` Krzysztof Kozlowski
  2024-04-06  0:59 ` [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Martin K. Petersen
  2024-04-09  3:08 ` Martin K. Petersen
  7 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-28 20:45 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Krzysztof Kozlowski

Core in scsi_register_driver() already sets the .owner, so driver
does not need to.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Depends on first SCSI patch.
---
 drivers/ufs/core/ufshcd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index e30fd125988d..77fb9b2261a7 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10896,7 +10896,6 @@ static void ufshcd_check_header_layout(void)
 static struct scsi_driver ufs_dev_wlun_template = {
 	.gendrv = {
 		.name = "ufs_device_wlun",
-		.owner = THIS_MODULE,
 		.probe = ufshcd_wl_probe,
 		.remove = ufshcd_wl_remove,
 		.pm = &ufshcd_wl_pm_ops,

-- 
2.34.1


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

* Re: [PATCH 0/6] scsi: store owner from modules with scsi_register_driver()
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2024-03-28 20:45 ` [PATCH 6/6] ufs: core: " Krzysztof Kozlowski
@ 2024-04-06  0:59 ` Martin K. Petersen
  2024-04-09  3:08 ` Martin K. Petersen
  7 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2024-04-06  0:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: James E.J. Bottomley, Martin K. Petersen, Kai Mäkisara,
	Alim Akhtar, Avri Altman, Bart Van Assche, linux-scsi,
	linux-kernel


Krzysztof,

> All further patches depend on the first patch, therefore please ack
> and this should go via one tree.

Applied to 6.10/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 0/6] scsi: store owner from modules with scsi_register_driver()
  2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2024-04-06  0:59 ` [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Martin K. Petersen
@ 2024-04-09  3:08 ` Martin K. Petersen
  7 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2024-04-09  3:08 UTC (permalink / raw)
  To: James E.J. Bottomley, Kai Mäkisara, Alim Akhtar,
	Avri Altman, Bart Van Assche, Krzysztof Kozlowski
  Cc: Martin K . Petersen, linux-scsi, linux-kernel

On Thu, 28 Mar 2024 21:45:44 +0100, Krzysztof Kozlowski wrote:

> Merging
> =======
> All further patches depend on the first patch, therefore please ack
> and this should go via one tree.
> 
> Best regards,
> Krzysztof
> 
> [...]

Applied to 6.10/scsi-queue, thanks!

[1/6] scsi: store owner from modules with scsi_register_driver()
      https://git.kernel.org/mkp/scsi/c/65a09ba26936
[2/6] scsi: sd: drop driver owner initialization
      https://git.kernel.org/mkp/scsi/c/aef9e4872684
[3/6] scsi: ses: drop driver owner initialization
      https://git.kernel.org/mkp/scsi/c/8d326b243c11
[4/6] scsi: sr: drop driver owner initialization
      https://git.kernel.org/mkp/scsi/c/dc916f7f0f5e
[5/6] scsi: st: drop driver owner initialization
      https://git.kernel.org/mkp/scsi/c/2ee2d99fe449
[6/6] ufs: core: drop driver owner initialization
      https://git.kernel.org/mkp/scsi/c/9282899e1e7e

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2024-04-09  3:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 20:45 [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Krzysztof Kozlowski
2024-03-28 20:45 ` [PATCH 1/6] " Krzysztof Kozlowski
2024-03-28 20:45 ` [PATCH 2/6] scsi: sd: drop driver owner initialization Krzysztof Kozlowski
2024-03-28 20:45 ` [PATCH 3/6] scsi: ses: " Krzysztof Kozlowski
2024-03-28 20:45 ` [PATCH 4/6] scsi: sr: " Krzysztof Kozlowski
2024-03-28 20:45 ` [PATCH 5/6] scsi: st: " Krzysztof Kozlowski
2024-03-28 20:45 ` [PATCH 6/6] ufs: core: " Krzysztof Kozlowski
2024-04-06  0:59 ` [PATCH 0/6] scsi: store owner from modules with scsi_register_driver() Martin K. Petersen
2024-04-09  3:08 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.