scsi: sr: Convert to SCSI bus methods

The SCSI subsystem has implemented dedicated callbacks for probe, remove
and shutdown. Make use of them. This fixes a runtime warning about the
driver needing to be converted to the bus probe method.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/ff6e8421f9efa84be3c37a11637aa435899160bf.1766133330.git.u.kleine-koenig@baylibre.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Uwe Kleine-König 2025-12-19 10:25:35 +01:00 committed by Martin K. Petersen
parent a71d5deea6
commit 9ccda35df7

View file

@ -82,8 +82,8 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_DVD_RAM|CDC_GENERIC_PACKET| \
CDC_MRW|CDC_MRW_W|CDC_RAM)
static int sr_probe(struct device *);
static int sr_remove(struct device *);
static int sr_probe(struct scsi_device *);
static void sr_remove(struct scsi_device *);
static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt);
static int sr_done(struct scsi_cmnd *);
static int sr_runtime_suspend(struct device *dev);
@ -93,10 +93,10 @@ static const struct dev_pm_ops sr_pm_ops = {
};
static struct scsi_driver sr_template = {
.probe = sr_probe,
.remove = sr_remove,
.gendrv = {
.name = "sr",
.probe = sr_probe,
.remove = sr_remove,
.pm = &sr_pm_ops,
},
.init_command = sr_init_command,
@ -616,9 +616,9 @@ static void sr_release(struct cdrom_device_info *cdi)
{
}
static int sr_probe(struct device *dev)
static int sr_probe(struct scsi_device *sdev)
{
struct scsi_device *sdev = to_scsi_device(dev);
struct device *dev = &sdev->sdev_gendev;
struct gendisk *disk;
struct scsi_cd *cd;
int minor, error;
@ -982,16 +982,15 @@ out_put_request:
return ret;
}
static int sr_remove(struct device *dev)
static void sr_remove(struct scsi_device *sdev)
{
struct device *dev = &sdev->sdev_gendev;
struct scsi_cd *cd = dev_get_drvdata(dev);
scsi_autopm_get_device(cd->device);
del_gendisk(cd->disk);
put_disk(cd->disk);
return 0;
}
static int __init init_sr(void)