From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Damien Le Moal <dlemoal@kernel.org>,
Himanshu Madhani <himanshu.madhani@oracle.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Subject: [PATCH v4 1/5] scsi: sd: Move the sd_remove() function definition
Date: Tue, 16 Dec 2025 13:07:13 -0800 [thread overview]
Message-ID: <20251216210719.57256-2-bvanassche@acm.org> (raw)
In-Reply-To: <20251216210719.57256-1-bvanassche@acm.org>
Move the sd_remove() function definition such that the sd_shutdown()
forward declaration can be removed.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/sd.c | 53 +++++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 27 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index f2c0744b4480..0b479153abb8 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -108,7 +108,6 @@ static void sd_config_write_same(struct scsi_disk *sdkp,
struct queue_limits *lim);
static void sd_revalidate_disk(struct gendisk *);
static void sd_unlock_native_capacity(struct gendisk *disk);
-static void sd_shutdown(struct device *);
static void scsi_disk_release(struct device *cdev);
static DEFINE_IDA(sd_index_ida);
@@ -4077,32 +4076,6 @@ static int sd_probe(struct device *dev)
return error;
}
-/**
- * sd_remove - called whenever a scsi disk (previously recognized by
- * sd_probe) is detached from the system. It is called (potentially
- * multiple times) during sd module unload.
- * @dev: pointer to device object
- *
- * Note: this function is invoked from the scsi mid-level.
- * This function potentially frees up a device name (e.g. /dev/sdc)
- * that could be re-used by a subsequent sd_probe().
- * This function is not called when the built-in sd driver is "exit-ed".
- **/
-static int sd_remove(struct device *dev)
-{
- struct scsi_disk *sdkp = dev_get_drvdata(dev);
-
- scsi_autopm_get_device(sdkp->device);
-
- device_del(&sdkp->disk_dev);
- del_gendisk(sdkp->disk);
- if (!sdkp->suspended)
- sd_shutdown(dev);
-
- put_disk(sdkp->disk);
- return 0;
-}
-
static void scsi_disk_release(struct device *dev)
{
struct scsi_disk *sdkp = to_scsi_disk(dev);
@@ -4215,6 +4188,32 @@ static void sd_shutdown(struct device *dev)
}
}
+/**
+ * sd_remove - called whenever a scsi disk (previously recognized by
+ * sd_probe) is detached from the system. It is called (potentially
+ * multiple times) during sd module unload.
+ * @dev: pointer to device object
+ *
+ * Note: this function is invoked from the scsi mid-level.
+ * This function potentially frees up a device name (e.g. /dev/sdc)
+ * that could be re-used by a subsequent sd_probe().
+ * This function is not called when the built-in sd driver is "exit-ed".
+ **/
+static int sd_remove(struct device *dev)
+{
+ struct scsi_disk *sdkp = dev_get_drvdata(dev);
+
+ scsi_autopm_get_device(sdkp->device);
+
+ device_del(&sdkp->disk_dev);
+ del_gendisk(sdkp->disk);
+ if (!sdkp->suspended)
+ sd_shutdown(dev);
+
+ put_disk(sdkp->disk);
+ return 0;
+}
+
static inline bool sd_do_start_stop(struct scsi_device *sdev, bool runtime)
{
return (sdev->manage_system_start_stop && !runtime) ||
next prev parent reply other threads:[~2025-12-16 21:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 21:07 [PATCH v4 0/5] Clean up the SCSI disk driver source code Bart Van Assche
2025-12-16 21:07 ` Bart Van Assche [this message]
2025-12-17 6:55 ` [PATCH v4 1/5] scsi: sd: Move the sd_remove() function definition Johannes Thumshirn
2025-12-16 21:07 ` [PATCH v4 2/5] scsi: sd: Move the sd_config_discard() " Bart Van Assche
2025-12-17 6:56 ` Johannes Thumshirn
2025-12-16 21:07 ` [PATCH v4 3/5] scsi: sd: Move the scsi_disk_release() " Bart Van Assche
2025-12-17 6:57 ` Johannes Thumshirn
2025-12-16 21:07 ` [PATCH v4 4/5] scsi: sd: Move the sd_fops definition Bart Van Assche
2025-12-17 6:58 ` Johannes Thumshirn
2025-12-16 21:07 ` [PATCH v4 5/5] scsi: sd: Do not split error messages Bart Van Assche
2025-12-17 6:59 ` Johannes Thumshirn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251216210719.57256-2-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dlemoal@kernel.org \
--cc=himanshu.madhani@oracle.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox