From 7d42bcea57ae139e2ed754425cc5fc44e260c890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 19 Dec 2025 10:25:30 +0100 Subject: scsi: core: Pass a struct scsi_driver to scsi_{,un}register_driver() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This aligns with what other subsystems do, reduces boilerplate a bit for device drivers and is less error prone. Reviewed-by: Peter Wang Signed-off-by: Uwe Kleine-König Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/ac17fdea58e384cb514c639306d48ce0005820b0.1766133330.git.u.kleine-koenig@baylibre.com Signed-off-by: Martin K. Petersen --- include/scsi/scsi_driver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h index c0e89996bdb3..40aba9a9349a 100644 --- a/include/scsi/scsi_driver.h +++ b/include/scsi/scsi_driver.h @@ -25,9 +25,9 @@ struct scsi_driver { #define scsi_register_driver(drv) \ __scsi_register_driver(drv, THIS_MODULE) -int __scsi_register_driver(struct device_driver *, struct module *); +int __scsi_register_driver(struct scsi_driver *, struct module *); #define scsi_unregister_driver(drv) \ - driver_unregister(drv); + driver_unregister(&(drv)->gendrv); extern int scsi_register_interface(struct class_interface *); #define scsi_unregister_interface(intf) \ -- cgit v1.2.3 From f7d4f1bf5724e52de049c619beddd53c62206624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 19 Dec 2025 10:25:31 +0100 Subject: scsi: core: sysfs: Make use of bus callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a bus-specific probe, remove and shutdown function. For now this only allows to get rid of a cast of the generic device to a SCSI device in the drivers and changes the remove prototype to return void---a non-zero return value is ignored anyhow. The objective is to get rid of users of struct device_driver callbacks .probe(), .remove() and .shutdown() to eventually remove these. Until all SCSI drivers are converted, this results in a runtime warning about the drivers needing an update because there is a bus probe function and a driver probe function. The in-tree drivers are fixed by the following commits. Signed-off-by: Uwe Kleine-König Reviewed-by: Peter Wang Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/a54e363a3fd2054fb924afd7df44bca7f444b5f1.1766133330.git.u.kleine-koenig@baylibre.com Signed-off-by: Martin K. Petersen --- include/scsi/scsi_driver.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h index 40aba9a9349a..249cea724abd 100644 --- a/include/scsi/scsi_driver.h +++ b/include/scsi/scsi_driver.h @@ -12,6 +12,9 @@ struct request; struct scsi_driver { struct device_driver gendrv; + int (*probe)(struct scsi_device *); + void (*remove)(struct scsi_device *); + void (*shutdown)(struct scsi_device *); int (*resume)(struct device *); void (*rescan)(struct device *); blk_status_t (*init_command)(struct scsi_cmnd *); -- cgit v1.2.3