Skip to content

Commit efcf965

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: sd: Remove the number of forward declarations
Move the sd_pm_ops and sd_template data structures to just above init_sd() such that the number of forward function declarations can be reduced. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230823210628.523244-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 9604eea commit efcf965

File tree

1 file changed

+27
-39
lines changed

1 file changed

+27
-39
lines changed

drivers/scsi/sd.c

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,7 @@ static void sd_config_discard(struct scsi_disk *, unsigned int);
104104
static void sd_config_write_same(struct scsi_disk *);
105105
static int sd_revalidate_disk(struct gendisk *);
106106
static void sd_unlock_native_capacity(struct gendisk *disk);
107-
static int sd_probe(struct device *);
108-
static int sd_remove(struct device *);
109107
static void sd_shutdown(struct device *);
110-
static int sd_suspend_system(struct device *);
111-
static int sd_suspend_runtime(struct device *);
112-
static int sd_resume_system(struct device *);
113-
static int sd_resume_runtime(struct device *);
114-
static void sd_rescan(struct device *);
115-
static blk_status_t sd_init_command(struct scsi_cmnd *SCpnt);
116-
static void sd_uninit_command(struct scsi_cmnd *SCpnt);
117-
static int sd_done(struct scsi_cmnd *);
118-
static void sd_eh_reset(struct scsi_cmnd *);
119-
static int sd_eh_action(struct scsi_cmnd *, int);
120108
static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
121109
static void scsi_disk_release(struct device *cdev);
122110

@@ -592,33 +580,6 @@ static struct class sd_disk_class = {
592580
.dev_groups = sd_disk_groups,
593581
};
594582

595-
static const struct dev_pm_ops sd_pm_ops = {
596-
.suspend = sd_suspend_system,
597-
.resume = sd_resume_system,
598-
.poweroff = sd_suspend_system,
599-
.restore = sd_resume_system,
600-
.runtime_suspend = sd_suspend_runtime,
601-
.runtime_resume = sd_resume_runtime,
602-
};
603-
604-
static struct scsi_driver sd_template = {
605-
.gendrv = {
606-
.name = "sd",
607-
.owner = THIS_MODULE,
608-
.probe = sd_probe,
609-
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
610-
.remove = sd_remove,
611-
.shutdown = sd_shutdown,
612-
.pm = &sd_pm_ops,
613-
},
614-
.rescan = sd_rescan,
615-
.init_command = sd_init_command,
616-
.uninit_command = sd_uninit_command,
617-
.done = sd_done,
618-
.eh_action = sd_eh_action,
619-
.eh_reset = sd_eh_reset,
620-
};
621-
622583
/*
623584
* Don't request a new module, as that could deadlock in multipath
624585
* environment.
@@ -3926,6 +3887,33 @@ static int sd_resume_runtime(struct device *dev)
39263887
return sd_resume(dev);
39273888
}
39283889

3890+
static const struct dev_pm_ops sd_pm_ops = {
3891+
.suspend = sd_suspend_system,
3892+
.resume = sd_resume_system,
3893+
.poweroff = sd_suspend_system,
3894+
.restore = sd_resume_system,
3895+
.runtime_suspend = sd_suspend_runtime,
3896+
.runtime_resume = sd_resume_runtime,
3897+
};
3898+
3899+
static struct scsi_driver sd_template = {
3900+
.gendrv = {
3901+
.name = "sd",
3902+
.owner = THIS_MODULE,
3903+
.probe = sd_probe,
3904+
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
3905+
.remove = sd_remove,
3906+
.shutdown = sd_shutdown,
3907+
.pm = &sd_pm_ops,
3908+
},
3909+
.rescan = sd_rescan,
3910+
.init_command = sd_init_command,
3911+
.uninit_command = sd_uninit_command,
3912+
.done = sd_done,
3913+
.eh_action = sd_eh_action,
3914+
.eh_reset = sd_eh_reset,
3915+
};
3916+
39293917
/**
39303918
* init_sd - entry point for this driver (both when built in or when
39313919
* a module).

0 commit comments

Comments
 (0)