Move the scsi_disk_release() function definition such that its forward declaration can be removed. Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx> Reviewed-by: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> --- drivers/scsi/sd.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index b9a9b24ff027..0ee4c54401ec 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -105,7 +105,6 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_ZBC); static int sd_revalidate_disk(struct gendisk *); static void sd_unlock_native_capacity(struct gendisk *disk); -static void scsi_disk_release(struct device *cdev); static DEFINE_IDA(sd_index_ida); @@ -792,6 +791,17 @@ static struct attribute *sd_disk_attrs[] = { }; ATTRIBUTE_GROUPS(sd_disk); +static void scsi_disk_release(struct device *dev) +{ + struct scsi_disk *sdkp = to_scsi_disk(dev); + + ida_free(&sd_index_ida, sdkp->index); + put_device(&sdkp->device->sdev_gendev); + free_opal_dev(sdkp->opal_dev); + + kfree(sdkp); +} + static struct class sd_disk_class = { .name = "scsi_disk", .dev_release = scsi_disk_release, @@ -4037,17 +4047,6 @@ static int sd_probe(struct device *dev) return error; } -static void scsi_disk_release(struct device *dev) -{ - struct scsi_disk *sdkp = to_scsi_disk(dev); - - ida_free(&sd_index_ida, sdkp->index); - put_device(&sdkp->device->sdev_gendev); - free_opal_dev(sdkp->opal_dev); - - kfree(sdkp); -} - static int sd_start_stop_device(struct scsi_disk *sdkp, int start) { unsigned char cmd[6] = { START_STOP }; /* START_VALID */