From a7c0520669869c088dc207735c2e85888a10b0eb Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 17 Sep 2021 14:27:51 -0700 Subject: scsi: core: Remove include from scsi_cmnd.h There are no dependencies in on the header file. Hence remove the scsi_host.h include directive from scsi_cmnd.h. This include directive was introduced in February 2021 by commit af1830956dc3 ("scsi: core: Add mq_poll support to SCSI layer"). Link: https://lore.kernel.org/r/20210917212751.2676054-1-bvanassche@acm.org Cc: Kashyap Desai Reviewed-by: Himanshu Madhani Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- include/scsi/scsi_cmnd.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/scsi') diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index eaf04c9a1dfc..a2315aac93c7 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -10,7 +10,6 @@ #include #include #include -#include #include struct Scsi_Host; -- cgit v1.2.3 From 6bd49b1a8d43ec118c55f3aaa7577729b52bde15 Mon Sep 17 00:00:00 2001 From: John Garry Date: Mon, 13 Sep 2021 18:14:07 +0800 Subject: scsi: core: Delete scsi_{get,free}_host_dev() Since commit 0653c358d2dc ("scsi: Drop gdth driver"), functions scsi_{get,free}_host_dev() no longer have any in-tree users, so delete them. Link: https://lore.kernel.org/r/1631528047-30150-1-git-send-email-john.garry@huawei.com Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Nacked-by: Hannes Reinecke --- drivers/scsi/scsi_scan.c | 57 ------------------------------------------------ include/scsi/scsi_host.h | 10 --------- 2 files changed, 67 deletions(-) (limited to 'include/scsi') diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index fe22191522a3..0d0381df25f7 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1902,60 +1902,3 @@ void scsi_forget_host(struct Scsi_Host *shost) spin_unlock_irqrestore(shost->host_lock, flags); } -/** - * scsi_get_host_dev - Create a scsi_device that points to the host adapter itself - * @shost: Host that needs a scsi_device - * - * Lock status: None assumed. - * - * Returns: The scsi_device or NULL - * - * Notes: - * Attach a single scsi_device to the Scsi_Host - this should - * be made to look like a "pseudo-device" that points to the - * HA itself. - * - * Note - this device is not accessible from any high-level - * drivers (including generics), which is probably not - * optimal. We can add hooks later to attach. - */ -struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost) -{ - struct scsi_device *sdev = NULL; - struct scsi_target *starget; - - mutex_lock(&shost->scan_mutex); - if (!scsi_host_scan_allowed(shost)) - goto out; - starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id); - if (!starget) - goto out; - - sdev = scsi_alloc_sdev(starget, 0, NULL); - if (sdev) - sdev->borken = 0; - else - scsi_target_reap(starget); - put_device(&starget->dev); - out: - mutex_unlock(&shost->scan_mutex); - return sdev; -} -EXPORT_SYMBOL(scsi_get_host_dev); - -/** - * scsi_free_host_dev - Free a scsi_device that points to the host adapter itself - * @sdev: Host device to be freed - * - * Lock status: None assumed. - * - * Returns: Nothing - */ -void scsi_free_host_dev(struct scsi_device *sdev) -{ - BUG_ON(sdev->id != sdev->host->this_id); - - __scsi_remove_device(sdev); -} -EXPORT_SYMBOL(scsi_free_host_dev); - diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 75363707b73f..bc9c45ced145 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -797,16 +797,6 @@ void scsi_host_busy_iter(struct Scsi_Host *, struct class_container; -/* - * These two functions are used to allocate and free a pseudo device - * which will connect to the host adapter itself rather than any - * physical device. You must deallocate when you are done with the - * thing. This physical pseudo-device isn't real and won't be available - * from any high-level drivers. - */ -extern void scsi_free_host_dev(struct scsi_device *); -extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *); - /* * DIF defines the exchange of protection information between * initiator and SBC block device. -- cgit v1.2.3 From 00aeaf329a3a1ea3d3606fefa1d29f69f828bd21 Mon Sep 17 00:00:00 2001 From: Luo Jiaxing Date: Tue, 12 Oct 2021 20:26:27 +0800 Subject: scsi: libsas: Export sas_phy_enable() Export sas_phy_enable() so LLDDs can directly use it to control remote phys. We already do this for companion function sas_phy_reset(). Link: https://lore.kernel.org/r/1634041588-74824-4-git-send-email-john.garry@huawei.com Signed-off-by: Luo Jiaxing Signed-off-by: John Garry Signed-off-by: Martin K. Petersen --- drivers/scsi/libsas/sas_init.c | 3 ++- include/scsi/libsas.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include/scsi') diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 37cc92837fdf..b640e09af6a4 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c @@ -254,7 +254,7 @@ static int transport_sas_phy_reset(struct sas_phy *phy, int hard_reset) } } -static int sas_phy_enable(struct sas_phy *phy, int enable) +int sas_phy_enable(struct sas_phy *phy, int enable) { int ret; enum phy_func cmd; @@ -286,6 +286,7 @@ static int sas_phy_enable(struct sas_phy *phy, int enable) } return ret; } +EXPORT_SYMBOL_GPL(sas_phy_enable); int sas_phy_reset(struct sas_phy *phy, int hard_reset) { diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 6fe125a71b60..79e4903bd414 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -664,6 +664,7 @@ extern void sas_suspend_ha(struct sas_ha_struct *sas_ha); int sas_set_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates); int sas_phy_reset(struct sas_phy *phy, int hard_reset); +int sas_phy_enable(struct sas_phy *phy, int enable); extern int sas_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); extern int sas_target_alloc(struct scsi_target *); extern int sas_slave_configure(struct scsi_device *); -- cgit v1.2.3 From bf23e619039d360d503b7282d030daf2277a5d47 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 7 Oct 2021 13:27:56 -0700 Subject: scsi: core: Use a structure member to track the SCSI command submitter Conditional statements are faster than indirect calls. Use a structure member to track the SCSI command submitter such that later patches can call scsi_done(scmd) instead of scmd->scsi_done(scmd). The asymmetric behavior that scsi_send_eh_cmnd() sets the submission context to the SCSI error handler and that it does not restore the submission context to the SCSI core is retained. Link: https://lore.kernel.org/r/20211007202923.2174984-2-bvanassche@acm.org Cc: Hannes Reinecke Cc: Ming Lei Cc: Christoph Hellwig Reviewed-by: Benjamin Block Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/scsi_error.c | 17 ++++++----------- drivers/scsi/scsi_lib.c | 10 ++++++++++ drivers/scsi/scsi_priv.h | 1 + include/scsi/scsi_cmnd.h | 7 +++++++ 4 files changed, 24 insertions(+), 11 deletions(-) (limited to 'include/scsi') diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index b6c86cce57bf..3de03925550e 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -50,8 +50,6 @@ #include -static void scsi_eh_done(struct scsi_cmnd *scmd); - /* * These should *probably* be handled by the host itself. * Since it is allowed to sleep, it probably should. @@ -520,7 +518,8 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) /* handler does not care. Drop down to default handling */ } - if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) + if (scmd->cmnd[0] == TEST_UNIT_READY && + scmd->submitter != SUBMITTED_BY_SCSI_ERROR_HANDLER) /* * nasty: for mid-layer issued TURs, we need to return the * actual sense data without any recovery attempt. For eh @@ -782,7 +781,7 @@ static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd) * scsi_eh_done - Completion function for error handling. * @scmd: Cmd that is done. */ -static void scsi_eh_done(struct scsi_cmnd *scmd) +void scsi_eh_done(struct scsi_cmnd *scmd) { struct completion *eh_action; @@ -1082,7 +1081,7 @@ retry: shost->eh_action = &done; scsi_log_send(scmd); - scmd->scsi_done = scsi_eh_done; + scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER; /* * Lock sdev->state_mutex to avoid that scsi_device_quiesce() can @@ -1109,6 +1108,7 @@ retry: if (rtn) { if (timeleft > stall_for) { scsi_eh_restore_cmnd(scmd, &ses); + timeleft -= stall_for; msleep(jiffies_to_msecs(stall_for)); goto retry; @@ -2338,11 +2338,6 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target) } EXPORT_SYMBOL(scsi_report_device_reset); -static void -scsi_reset_provider_done_command(struct scsi_cmnd *scmd) -{ -} - /** * scsi_ioctl_reset: explicitly reset a host/bus/target/device * @dev: scsi_device to operate on @@ -2379,7 +2374,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg) scsi_init_command(dev, scmd); scmd->cmnd = scsi_req(rq)->cmd; - scmd->scsi_done = scsi_reset_provider_done_command; + scmd->submitter = SUBMITTED_BY_SCSI_RESET_IOCTL; memset(&scmd->sdb, 0, sizeof(scmd->sdb)); scmd->cmd_len = 0; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 5f5ad22512f5..3fd24144b805 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1577,6 +1577,15 @@ static blk_status_t scsi_prepare_cmd(struct request *req) static void scsi_mq_done(struct scsi_cmnd *cmd) { + switch (cmd->submitter) { + case SUBMITTED_BY_BLOCK_LAYER: + break; + case SUBMITTED_BY_SCSI_ERROR_HANDLER: + return scsi_eh_done(cmd); + case SUBMITTED_BY_SCSI_RESET_IOCTL: + return; + } + if (unlikely(blk_should_fake_timeout(scsi_cmd_to_rq(cmd)->q))) return; if (unlikely(test_and_set_bit(SCMD_STATE_COMPLETE, &cmd->state))) @@ -1683,6 +1692,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, scsi_set_resid(cmd, 0); memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); + cmd->submitter = SUBMITTED_BY_BLOCK_LAYER; cmd->scsi_done = scsi_mq_done; blk_mq_start_request(req); diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 2d9de5a165ae..f8ca22d495d9 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -84,6 +84,7 @@ void scsi_eh_ready_devs(struct Scsi_Host *shost, int scsi_eh_get_sense(struct list_head *work_q, struct list_head *done_q); int scsi_noretry_cmd(struct scsi_cmnd *scmd); +void scsi_eh_done(struct scsi_cmnd *scmd); /* scsi_lib.c */ extern int scsi_maybe_unblock_host(struct scsi_device *sdev); diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index a2315aac93c7..893c24aab8e4 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -64,6 +64,12 @@ struct scsi_pointer { #define SCMD_STATE_COMPLETE 0 #define SCMD_STATE_INFLIGHT 1 +enum scsi_cmnd_submitter { + SUBMITTED_BY_BLOCK_LAYER = 0, + SUBMITTED_BY_SCSI_ERROR_HANDLER = 1, + SUBMITTED_BY_SCSI_RESET_IOCTL = 2, +} __packed; + struct scsi_cmnd { struct scsi_request req; struct scsi_device *device; @@ -89,6 +95,7 @@ struct scsi_cmnd { unsigned char prot_op; unsigned char prot_type; unsigned char prot_flags; + enum scsi_cmnd_submitter submitter; unsigned short cmd_len; enum dma_data_direction sc_data_direction; -- cgit v1.2.3 From a710eacb9d13cb5d9eb5341ebc6fc8f7b96f8c6f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 7 Oct 2021 13:27:57 -0700 Subject: scsi: core: Rename scsi_mq_done() into scsi_done() and export it Since the removal of the legacy block layer there is only one completion function left in the SCSI core, namely scsi_mq_done(). Rename it into scsi_done(). Export that function to allow SCSI LLDs to call it directly. Link: https://lore.kernel.org/r/20211007202923.2174984-3-bvanassche@acm.org Reviewed-by: Benjamin Block Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/scsi_lib.c | 5 +++-- include/scsi/scsi_cmnd.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include/scsi') diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3fd24144b805..f690a2da21ea 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1575,7 +1575,7 @@ static blk_status_t scsi_prepare_cmd(struct request *req) return scsi_cmd_to_driver(cmd)->init_command(cmd); } -static void scsi_mq_done(struct scsi_cmnd *cmd) +void scsi_done(struct scsi_cmnd *cmd) { switch (cmd->submitter) { case SUBMITTED_BY_BLOCK_LAYER: @@ -1593,6 +1593,7 @@ static void scsi_mq_done(struct scsi_cmnd *cmd) trace_scsi_dispatch_cmd_done(cmd); blk_mq_complete_request(scsi_cmd_to_rq(cmd)); } +EXPORT_SYMBOL(scsi_done); static void scsi_mq_put_budget(struct request_queue *q, int budget_token) { @@ -1693,7 +1694,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, scsi_set_resid(cmd, 0); memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); cmd->submitter = SUBMITTED_BY_BLOCK_LAYER; - cmd->scsi_done = scsi_mq_done; + cmd->scsi_done = scsi_done; blk_mq_start_request(req); reason = scsi_dispatch_cmd(cmd); diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 893c24aab8e4..4edaadc293a7 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -171,6 +171,8 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) return *(struct scsi_driver **)rq->rq_disk->private_data; } +void scsi_done(struct scsi_cmnd *cmd); + extern void scsi_finish_command(struct scsi_cmnd *cmd); extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count, -- cgit v1.2.3 From 11b68e36b16752ae3a48dc16229958ebc9bb324a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 7 Oct 2021 13:46:11 -0700 Subject: scsi: core: Call scsi_done directly Conditional statements are faster than indirect calls. Hence call scsi_done() directly. Since this patch removes the last user of the scsi_done member, also remove that data structure member. Link: https://lore.kernel.org/r/20211007204618.2196847-11-bvanassche@acm.org Reviewed-by: Benjamin Block Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/hosts.c | 2 +- drivers/scsi/scsi_lib.c | 3 +-- include/scsi/scsi_cmnd.h | 4 ---- include/scsi/scsi_host.h | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) (limited to 'include/scsi') diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index b8362700a9de..d78cec702596 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -667,7 +667,7 @@ static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd) scsi_dma_unmap(scmd); scmd->result = 0; set_host_byte(scmd, status); - scmd->scsi_done(scmd); + scsi_done(scmd); return true; } diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f690a2da21ea..d0b7c6dc74f8 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1520,7 +1520,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd) return rtn; done: - cmd->scsi_done(cmd); + scsi_done(cmd); return 0; } @@ -1694,7 +1694,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, scsi_set_resid(cmd, 0); memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); cmd->submitter = SUBMITTED_BY_BLOCK_LAYER; - cmd->scsi_done = scsi_done; blk_mq_start_request(req); reason = scsi_dispatch_cmd(cmd); diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 4edaadc293a7..7958a604f979 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -123,10 +123,6 @@ struct scsi_cmnd { * command (auto-sense). Length must be * SCSI_SENSE_BUFFERSIZE bytes. */ - /* Low-level done function - can be used by low-level driver to point - * to completion function. Not used by mid/upper level code. */ - void (*scsi_done) (struct scsi_cmnd *); - /* * The following fields can be written to by the host specific code. * Everything else should be left alone. diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index bc9c45ced145..04e9b821c0c7 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -516,7 +516,7 @@ struct scsi_host_template { unsigned long irq_flags; \ int rc; \ spin_lock_irqsave(shost->host_lock, irq_flags); \ - rc = func_name##_lck (cmd, cmd->scsi_done); \ + rc = func_name##_lck(cmd, scsi_done); \ spin_unlock_irqrestore(shost->host_lock, irq_flags); \ return rc; \ } -- cgit v1.2.3 From af049dfd0b105bab32170d1c68826a4cd8424efd Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 7 Oct 2021 13:46:14 -0700 Subject: scsi: core: Remove the 'done' argument from SCSI queuecommand_lck functions The DEF_SCSI_QCMD() macro passes the addresses of the SCSI host lock and also that of the scsi_done function to the queuecommand_lck() function implementations. Remove the 'scsi_done' argument since its address is now a constant and instead call 'scsi_done' directly from inside the queuecommand_lck() functions. Link: https://lore.kernel.org/r/20211007204618.2196847-14-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/3w-9xxx.c | 3 ++- drivers/scsi/3w-sas.c | 3 ++- drivers/scsi/3w-xxxx.c | 3 ++- drivers/scsi/53c700.c | 3 +-- drivers/scsi/BusLogic.c | 4 ++-- drivers/scsi/a100u2w.c | 2 +- drivers/scsi/advansys.c | 3 +-- drivers/scsi/aha152x.c | 4 +--- drivers/scsi/aha1740.c | 4 ++-- drivers/scsi/aic7xxx/aic79xx_osm.c | 3 +-- drivers/scsi/aic7xxx/aic7xxx_osm.c | 3 +-- drivers/scsi/arcmsr/arcmsr_hba.c | 3 +-- drivers/scsi/arm/acornscsi.c | 14 +++----------- drivers/scsi/arm/fas216.c | 10 ++++------ drivers/scsi/atp870u.c | 4 ++-- drivers/scsi/bfa/bfad_im.c | 4 ++-- drivers/scsi/dc395x.c | 3 ++- drivers/scsi/dpt_i2o.c | 2 +- drivers/scsi/esp_scsi.c | 2 +- drivers/scsi/fnic/fnic_scsi.c | 3 ++- drivers/scsi/hptiop.c | 3 +-- drivers/scsi/ibmvscsi/ibmvscsi.c | 4 ++-- drivers/scsi/imm.c | 3 +-- drivers/scsi/initio.c | 3 +-- drivers/scsi/ips.c | 3 ++- drivers/scsi/mac53c94.c | 3 +-- drivers/scsi/megaraid.c | 3 +-- drivers/scsi/megaraid/megaraid_mbox.c | 4 ++-- drivers/scsi/mesh.c | 2 +- drivers/scsi/ncr53c8xx.c | 3 ++- drivers/scsi/nsp32.c | 4 ++-- drivers/scsi/pcmcia/nsp_cs.c | 3 +-- drivers/scsi/pcmcia/sym53c500_cs.c | 3 +-- drivers/scsi/pmcraid.c | 5 +---- drivers/scsi/ppa.c | 3 +-- drivers/scsi/ps3rom.c | 3 +-- drivers/scsi/qla1280.c | 3 +-- drivers/scsi/qlogicfas408.c | 4 ++-- drivers/scsi/qlogicpti.c | 3 ++- drivers/scsi/stex.c | 4 ++-- drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +-- drivers/scsi/vmw_pvscsi.c | 2 +- drivers/scsi/wd33c93.c | 4 +--- drivers/staging/rts5208/rtsx.c | 4 ++-- drivers/staging/unisys/visorhba/visorhba_main.c | 5 ++--- drivers/usb/image/microtek.c | 5 ++--- drivers/usb/storage/scsiglue.c | 4 ++-- drivers/usb/storage/uas.c | 3 +-- include/scsi/scsi_host.h | 2 +- 49 files changed, 75 insertions(+), 103 deletions(-) (limited to 'include/scsi') diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 4ebc2c79f45f..778d4892ed7d 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -1744,8 +1744,9 @@ out: } /* End twa_scsi_eh_reset() */ /* This is the main scsi queue function to handle scsi opcodes */ -static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) +static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt) { + void (*done)(struct scsi_cmnd *) = scsi_done; int request_id, retval; TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index e6f51904f5b1..fc9a2f27aaf9 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c @@ -1450,8 +1450,9 @@ out: } /* End twl_scsi_eh_reset() */ /* This is the main scsi queue function to handle scsi opcodes */ -static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) +static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt) { + void (*done)(struct scsi_cmnd *) = scsi_done; int request_id, retval; TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index bdd3ab8875e2..498a5ab7a321 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -1918,8 +1918,9 @@ static int tw_scsiop_test_unit_ready_complete(TW_Device_Extension *tw_dev, int r } /* End tw_scsiop_test_unit_ready_complete() */ /* This is the main scsi queue function to handle scsi opcodes */ -static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) +static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt) { + void (*done)(struct scsi_cmnd *) = scsi_done; unsigned char *command = SCpnt->cmnd; int request_id = 0; int retval = 1; diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index e7ed2fd6cdec..f1cbac77959e 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -1751,8 +1751,7 @@ NCR_700_intr(int irq, void *dev_id) return IRQ_RETVAL(handled); } -static int -NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) +static int NCR_700_queuecommand_lck(struct scsi_cmnd *SCp) { struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index 7287a9081684..a897c8f914cf 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c @@ -2866,9 +2866,9 @@ static int blogic_hostreset(struct scsi_cmnd *SCpnt) Outgoing Mailbox for execution by the associated Host Adapter. */ -static int blogic_qcmd_lck(struct scsi_cmnd *command, - void (*comp_cb) (struct scsi_cmnd *)) +static int blogic_qcmd_lck(struct scsi_cmnd *command) { + void (*comp_cb)(struct scsi_cmnd *) = scsi_done; struct blogic_adapter *adapter = (struct blogic_adapter *) command->device->host->hostdata; struct blogic_tgt_flags *tgt_flags = diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index 68343bcb4616..564ade03b530 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c @@ -911,7 +911,7 @@ static int inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struc * queue the command down to the controller */ -static int inia100_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) +static int inia100_queue_lck(struct scsi_cmnd *cmd) { struct orc_scb *scb; struct orc_host *host; /* Point to Host adapter control block */ diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index f2f14fbd5069..ace5eff828e9 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -8453,8 +8453,7 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) * This function always returns 0. Command return status is saved * in the 'scp' result field. */ -static int -advansys_queuecommand_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) +static int advansys_queuecommand_lck(struct scsi_cmnd *scp) { struct Scsi_Host *shost = scp->device->host; int asc_res, result = 0; diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index f07de9912790..d17880b57d17 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -975,10 +975,8 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt, * queue a command * */ -static int aha152x_queue_lck(struct scsi_cmnd *SCpnt, - void (*done)(struct scsi_cmnd *)) +static int aha152x_queue_lck(struct scsi_cmnd *SCpnt) { - WARN_ON_ONCE(done != scsi_done); return aha152x_internal_queue(SCpnt, NULL, 0); } diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index 39d8759fe558..18eb4cfcef9a 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c @@ -315,9 +315,9 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id) return IRQ_RETVAL(handled); } -static int aha1740_queuecommand_lck(struct scsi_cmnd * SCpnt, - void (*done)(struct scsi_cmnd *)) +static int aha1740_queuecommand_lck(struct scsi_cmnd *SCpnt) { + void (*done)(struct scsi_cmnd *) = scsi_done; unchar direction; unchar *cmd = (unchar *) SCpnt->cmnd; unchar target = scmd_id(SCpnt); diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index af49c32cfaf7..5d566d2b2997 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -572,8 +572,7 @@ ahd_linux_info(struct Scsi_Host *host) /* * Queue an SCB to the controller. */ -static int -ahd_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) +static int ahd_linux_queue_lck(struct scsi_cmnd *cmd) { struct ahd_softc *ahd; struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index f2daca41f3f2..d3b1082654d5 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -518,8 +518,7 @@ ahc_linux_info(struct Scsi_Host *host) /* * Queue an SCB to the controller. */ -static int -ahc_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) +static int ahc_linux_queue_lck(struct scsi_cmnd *cmd) { struct ahc_softc *ahc; struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index e2692ca87a6e..daa8cf61f6d6 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -3231,8 +3231,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb, } } -static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd, - void (* done)(struct scsi_cmnd *)) +static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd) { struct Scsi_Host *host = cmd->device->host; struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index dadaf5ee0ea9..81eb3bbdfc51 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c @@ -2397,24 +2397,16 @@ acornscsi_intr(int irq, void *dev_id) */ /* - * Function : acornscsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) + * Function : acornscsi_queuecmd(struct scsi_cmnd *cmd) * Purpose : queues a SCSI command * Params : cmd - SCSI command - * done - function called on completion, with pointer to command descriptor * Returns : 0, or < 0 on error. */ -static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt, - void (*done)(struct scsi_cmnd *)) +static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt) { + void (*done)(struct scsi_cmnd *) = scsi_done; AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata; - if (!done) { - /* there should be some way of rejecting errors like this without panicing... */ - panic("scsi%d: queuecommand called with NULL done function [cmd=%p]", - host->host->host_no, SCpnt); - return -EINVAL; - } - #if (DEBUG & DEBUG_NO_WRITE) if (acornscsi_cmdtype(SCpnt->cmnd[0]) == CMD_WRITE && (NO_WRITE & (1 << SCpnt->device->id))) { printk(KERN_CRIT "scsi%d.%c: WRITE attempted with NO_WRITE flag set\n", diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index a8befd2eec52..7019b91f0ce6 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -2233,10 +2233,9 @@ static int fas216_queue_command_internal(struct scsi_cmnd *SCpnt, return result; } -static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt, - void (*done)(struct scsi_cmnd *)) +static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt) { - return fas216_queue_command_internal(SCpnt, done); + return fas216_queue_command_internal(SCpnt, scsi_done); } DEF_SCSI_QCMD(fas216_queue_command) @@ -2264,8 +2263,7 @@ static void fas216_internal_done(struct scsi_cmnd *SCpnt) * Returns: scsi result code. * Notes: io_request_lock is held, interrupts are disabled. */ -static int fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt, - void (*done)(struct scsi_cmnd *)) +static int fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt) { FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; @@ -2306,7 +2304,7 @@ static int fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt, spin_lock_irq(info->host->host_lock); - done(SCpnt); + scsi_done(SCpnt); return 0; } diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 6e1595b32bc0..dcd6fae65a88 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -618,9 +618,9 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) * * Queue a command to the ATP queue. Called with the host lock held. */ -static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p, - void (*done) (struct scsi_cmnd *)) +static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p) { + void (*done)(struct scsi_cmnd *) = scsi_done; unsigned char c; unsigned int m; struct atp_unit *dev; diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index e12ae60efd33..79d8f2af1294 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -1199,9 +1199,9 @@ bfad_im_itnim_work_handler(struct work_struct *work) /* * Scsi_Host template entry, queue a SCSI command to the BFAD. */ -static int -bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) +static int bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) cmnd->device->host->hostdata[0]; struct bfad_s *bfad = im_port->bfad; diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 5adbc7f61c19..9b8796c9e634 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -960,8 +960,9 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb, * and is expected to be held on return. * **/ -static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int dc395x_queue_command_lck(struct scsi_cmnd *cmd) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct DeviceCtlBlk *dcb; struct ScsiReqBlk *srb; struct AdapterCtlBlk *acb = diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 1f00afcfe440..93227c04ef59 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -416,7 +416,7 @@ static int adpt_slave_configure(struct scsi_device * device) return 0; } -static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) +static int adpt_queue_lck(struct scsi_cmnd *cmd) { adpt_hba* pHba = NULL; struct adpt_device* pDev = NULL; /* dpt per device information */ diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index f7c2d64f1cef..57787537285a 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -952,7 +952,7 @@ static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent) scsi_track_queue_full(dev, lp->num_tagged - 1); } -static int esp_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int esp_queuecommand_lck(struct scsi_cmnd *cmd) { struct scsi_device *dev = cmd->device; struct esp *esp = shost_priv(dev->host); diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 09b8bf5adaf5..88c549f257db 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -420,8 +420,9 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic, * Routine to send a scsi cdb * Called with host_lock held and interrupts disabled. */ -static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) +static int fnic_queuecommand_lck(struct scsi_cmnd *sc) { + void (*done)(struct scsi_cmnd *) = scsi_done; const int tag = scsi_cmd_to_rq(sc)->tag; struct fc_lport *lp = shost_priv(sc->device->host); struct fc_rport *rport; diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index f18f6a677c1b..f9a9def394cc 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -993,8 +993,7 @@ static int hptiop_reset_comm_mvfrey(struct hptiop_hba *hba) return 0; } -static int hptiop_queuecommand_lck(struct scsi_cmnd *scp, - void (*done)(struct scsi_cmnd *)) +static int hptiop_queuecommand_lck(struct scsi_cmnd *scp) { struct Scsi_Host *host = scp->device->host; struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 50df7dd9cb91..5cc37859b874 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -1039,9 +1039,9 @@ static inline u16 lun_from_dev(struct scsi_device *dev) * @cmnd: struct scsi_cmnd to be executed * @done: Callback function to be called when cmd is completed */ -static int ibmvscsi_queuecommand_lck(struct scsi_cmnd *cmnd, - void (*done) (struct scsi_cmnd *)) +static int ibmvscsi_queuecommand_lck(struct scsi_cmnd *cmnd) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct srp_cmd *srp_cmd; struct srp_event_struct *evt_struct; struct srp_indirect_buf *indirect; diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index be8edcff0177..8afdb4dba2be 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -910,8 +910,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) return 0; } -static int imm_queuecommand_lck(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *)) +static int imm_queuecommand_lck(struct scsi_cmnd *cmd) { imm_struct *dev = imm_dev(cmd->device->host); diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 183f95758636..fd6da96bc51a 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c @@ -2609,8 +2609,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c * will cause the mid layer to call us again later with the command) */ -static int i91u_queuecommand_lck(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *)) +static int i91u_queuecommand_lck(struct scsi_cmnd *cmd) { struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata; struct scsi_ctrl_blk *cmnd; diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 0c93ec359e9b..498bf04499ce 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -1035,8 +1035,9 @@ static int ips_eh_reset(struct scsi_cmnd *SC) /* Linux obtains io_request_lock before calling this function */ /* */ /****************************************************************************/ -static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)) +static int ips_queue_lck(struct scsi_cmnd *SC) { + void (*done)(struct scsi_cmnd *) = scsi_done; ips_ha_t *ha; ips_passthru_t *pt; diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 9731855805f5..3976a18f6333 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c @@ -66,8 +66,7 @@ static irqreturn_t do_mac53c94_interrupt(int, void *); static void cmd_done(struct fsc_state *, int result); static void set_dma_cmds(struct fsc_state *, struct scsi_cmnd *); - -static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int mac53c94_queue_lck(struct scsi_cmnd *cmd) { struct fsc_state *state; diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index c4ea833586e0..0d31d7a5e335 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -370,8 +370,7 @@ mega_runpendq(adapter_t *adapter) * * The command queuing entry point for the mid-layer. */ -static int -megaraid_queue_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) +static int megaraid_queue_lck(struct scsi_cmnd *scmd) { adapter_t *adapter; scb_t *scb; diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 705c5027ba91..0f47a9862ef9 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -1432,9 +1432,9 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb) * * Queue entry point for mailbox based controllers. */ -static int -megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) +static int megaraid_queue_command_lck(struct scsi_cmnd *scp) { + void (*done)(struct scsi_cmnd *) = scsi_done; adapter_t *adapter; scb_t *scb; int if_busy; diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 73a3e85802ad..ca133e0a140a 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c @@ -1621,7 +1621,7 @@ static void cmd_complete(struct mesh_state *ms) * Called by midlayer with host locked to queue a new * request */ -static int mesh_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int mesh_queue_lck(struct scsi_cmnd *cmd) { struct mesh_state *ms; diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index 6ad43a98409c..168b854ccf14 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c @@ -7852,8 +7852,9 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device) return 0; } -static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int ncr53c8xx_queue_command_lck(struct scsi_cmnd *cmd) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; unsigned long flags; int sts; diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 1057b6fd7569..bd3ee3bf08ee 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c @@ -904,9 +904,9 @@ static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt) return TRUE; } -static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, - void (*done)(struct scsi_cmnd *)) +static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt) { + void (*done)(struct scsi_cmnd *) = scsi_done; nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; nsp32_target *target; nsp32_lunt *cur_lunt; diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 0271d534133a..8b9e889bc306 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -181,8 +181,7 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt) scsi_done(SCpnt); } -static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, - void (*done)(struct scsi_cmnd *)) +static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt) { #ifdef NSP_DEBUG /*unsigned int host_id = SCpnt->device->host->this_id;*/ diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index d2adda815d7b..d5c30ac662ba 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -537,8 +537,7 @@ SYM53C500_info(struct Scsi_Host *SChost) return (info_msg); } -static int -SYM53C500_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) +static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt) { int i; int port_base = SCpnt->device->host->io_port; diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 11f36fd4e62f..18efb3e64c84 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -3313,10 +3313,7 @@ static int pmcraid_copy_sglist( * SCSI_MLQUEUE_DEVICE_BUSY if device is busy * SCSI_MLQUEUE_HOST_BUSY if host is busy */ -static int pmcraid_queuecommand_lck( - struct scsi_cmnd *scsi_cmd, - void (*done) (struct scsi_cmnd *) -) +static int pmcraid_queuecommand_lck(struct scsi_cmnd *scsi_cmd) { struct pmcraid_instance *pinstance; struct pmcraid_resource_entry *res; diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 799ad8562e24..003043de23a5 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c @@ -786,8 +786,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) return 0; } -static int ppa_queuecommand_lck(struct scsi_cmnd *cmd, - void (*done) (struct scsi_cmnd *)) +static int ppa_queuecommand_lck(struct scsi_cmnd *cmd) { ppa_struct *dev = ppa_dev(cmd->device->host); diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index 08e970300b3f..2b80cab70333 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c @@ -200,8 +200,7 @@ static int ps3rom_write_request(struct ps3_storage_device *dev, return 0; } -static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *)) +static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd) { struct ps3rom_private *priv = shost_priv(cmd->device->host); struct ps3_storage_device *dev = priv->dev; diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index c508a6e20519..1dc56f4c89d8 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -689,8 +689,7 @@ qla1280_info(struct Scsi_Host *host) * handling). Unfortunately, it sometimes calls the scheduler in interrupt * context which is a big NO! NO!. **************************************************************************/ -static int -qla1280_queuecommand_lck(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) +static int qla1280_queuecommand_lck(struct scsi_cmnd *cmd) { struct Scsi_Host *host = cmd->device->host; struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c index 5471c046a4b7..30a88849a626 100644 --- a/drivers/scsi/qlogicfas408.c +++ b/drivers/scsi/qlogicfas408.c @@ -460,9 +460,9 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id) * Queued command */ -static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd, - void (*done) (struct scsi_cmnd *)) +static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); set_host_byte(cmd, DID_OK); diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 30b5e98b5de0..57f2f4135a06 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -1013,8 +1013,9 @@ static int qlogicpti_slave_configure(struct scsi_device *sdev) * * "This code must fly." -davem */ -static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *)) +static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct Scsi_Host *host = Cmnd->device->host; struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; struct Command_Entry *cmd; diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 2f96a2fdaa40..e6420f2127ce 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -590,9 +590,9 @@ stex_slave_config(struct scsi_device *sdev) return 0; } -static int -stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int stex_queuecommand_lck(struct scsi_cmnd *cmd) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct st_hba *hba; struct Scsi_Host *host; unsigned int id, lun; diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 76747e180b17..b04bfde65e3f 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -486,8 +486,7 @@ void sym_log_bus_error(struct Scsi_Host *shost) * queuecommand method. Entered with the host adapter lock held and * interrupts disabled. */ -static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *)) +static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd) { struct sym_hcb *np = SYM_SOFTC_PTR(cmd); struct sym_ucmd *ucp = SYM_UCMD_PTR(cmd); diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 7bfa023d0feb..c2ba65224633 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -768,7 +768,7 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter, return 0; } -static int pvscsi_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int pvscsi_queue_lck(struct scsi_cmnd *cmd) { struct Scsi_Host *host = cmd->device->host; struct pvscsi_adapter *adapter = shost_priv(host); diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index fe28d21c7e93..7d2f00f3571a 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c @@ -362,9 +362,7 @@ calc_sync_msg(unsigned int period, unsigned int offset, unsigned int fast, msg[1] = offset; } -static int -wd33c93_queuecommand_lck(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *)) +static int wd33c93_queuecommand_lck(struct scsi_cmnd *cmd) { struct WD33C93_hostdata *hostdata; struct scsi_cmnd *tmp; diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index f1136f6bcee2..8d6139fce13e 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -118,9 +118,9 @@ static int slave_configure(struct scsi_device *sdev) /* queue a command */ /* This is always called with scsi_lock(host) held */ -static int queuecommand_lck(struct scsi_cmnd *srb, - void (*done)(struct scsi_cmnd *)) +static int queuecommand_lck(struct scsi_cmnd *srb) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct rtsx_dev *dev = host_to_rtsx(srb->device->host); struct rtsx_chip *chip = dev->chip; diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 6a8fa0587280..b40c8cacb813 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -446,10 +446,9 @@ static u32 dma_data_dir_linux_to_spar(enum dma_data_direction d) * Return: 0 if successfully queued to the Service Partition, otherwise * error code */ -static int visorhba_queue_command_lck(struct scsi_cmnd *scsicmd, - void (*visorhba_cmnd_done) - (struct scsi_cmnd *)) +static int visorhba_queue_command_lck(struct scsi_cmnd *scsicmd) { + void (*visorhba_cmnd_done)(struct scsi_cmnd *) = scsi_done; struct uiscmdrsp *cmdrsp; struct scsi_device *scsidev = scsicmd->device; int insert_location; diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 59b02a539963..b8dc6fa6a5a3 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -561,10 +561,9 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc) desc->context.data_pipe = pipe; } - -static int -mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback) +static int mts_scsi_queuecommand_lck(struct scsi_cmnd *srb) { + mts_scsi_cmnd_callback callback = scsi_done; struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); int res; diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 9dfea19e5a91..220aa1cf4b3d 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -363,9 +363,9 @@ static int target_alloc(struct scsi_target *starget) /* queue a command */ /* This is always called with scsi_lock(host) held */ -static int queuecommand_lck(struct scsi_cmnd *srb, - void (*done)(struct scsi_cmnd *)) +static int queuecommand_lck(struct scsi_cmnd *srb) { + void (*done)(struct scsi_cmnd *) = scsi_done; struct us_data *us = host_to_us(srb->device->host); /* check for state-transition errors */ diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 774d18907f47..7f2944729ecd 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -633,8 +633,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, return 0; } -static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, - void (*done)(struct scsi_cmnd *)) +static int uas_queuecommand_lck(struct scsi_cmnd *cmnd) { struct scsi_device *sdev = cmnd->device; struct uas_dev_info *devinfo = sdev->hostdata; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 04e9b821c0c7..3bb46b188e1c 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -516,7 +516,7 @@ struct scsi_host_template { unsigned long irq_flags; \ int rc; \ spin_lock_irqsave(shost->host_lock, irq_flags); \ - rc = func_name##_lck(cmd, scsi_done); \ + rc = func_name##_lck(cmd); \ spin_unlock_irqrestore(shost->host_lock, irq_flags); \ return rc; \ } -- cgit v1.2.3 From 92c4b58b15c56298b1b225c1d2e533165b3e32af Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 12 Oct 2021 16:35:13 -0700 Subject: scsi: core: Register sysfs attributes earlier A quote from Documentation/driver-api/driver-model/device.rst: "Word of warning: While the kernel allows device_create_file() and device_remove_file() to be called on a device at any time, userspace has strict expectations on when attributes get created. When a new device is registered in the kernel, a uevent is generated to notify userspace (like udev) that a new device is available. If attributes are added after the device is registered, then userspace won't get notified and userspace will not know about the new attributes." Hence register SCSI host sysfs attributes before the SCSI host shost_dev uevent is emitted instead of after that event has been emitted. Link: https://lore.kernel.org/r/20211012233558.4066756-2-bvanassche@acm.org Cc: Greg Kroah-Hartman Reviewed-by: Benjamin Block Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/hosts.c | 23 +++++++++++-- drivers/scsi/scsi_priv.h | 4 ++- drivers/scsi/scsi_sysfs.c | 81 +++++++++++++++++++++++----------------------- include/scsi/scsi_device.h | 7 ++++ include/scsi/scsi_host.h | 12 +++++++ 5 files changed, 84 insertions(+), 43 deletions(-) (limited to 'include/scsi') diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index d78cec702596..09157792d36b 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -376,7 +376,7 @@ static struct device_type scsi_host_type = { struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) { struct Scsi_Host *shost; - int index; + int index, i, j = 0; shost = kzalloc(sizeof(struct Scsi_Host) + privsize, GFP_KERNEL); if (!shost) @@ -481,7 +481,26 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->shost_dev.parent = &shost->shost_gendev; shost->shost_dev.class = &shost_class; dev_set_name(&shost->shost_dev, "host%d", shost->host_no); - shost->shost_dev.groups = scsi_sysfs_shost_attr_groups; + shost->shost_dev.groups = shost->shost_dev_attr_groups; + shost->shost_dev_attr_groups[j++] = &scsi_shost_attr_group; + if (sht->shost_attrs) { + shost->lld_attr_group = (struct attribute_group){ + .attrs = scsi_convert_dev_attrs(&shost->shost_gendev, + sht->shost_attrs) + }; + if (shost->lld_attr_group.attrs) + shost->shost_dev_attr_groups[j++] = + &shost->lld_attr_group; + } + if (sht->shost_groups) { + for (i = 0; sht->shost_groups[i] && + j < ARRAY_SIZE(shost->shost_dev_attr_groups); + i++, j++) { + shost->shost_dev_attr_groups[j] = + sht->shost_groups[i]; + } + } + WARN_ON_ONCE(j >= ARRAY_SIZE(shost->shost_dev_attr_groups)); shost->ehandler = kthread_run(scsi_error_handler, shost, "scsi_eh_%d", shost->host_no); diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index f8ca22d495d9..483d0ad5fe60 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -138,13 +138,15 @@ extern int scsi_sysfs_add_sdev(struct scsi_device *); extern int scsi_sysfs_add_host(struct Scsi_Host *); extern int scsi_sysfs_register(void); extern void scsi_sysfs_unregister(void); +struct attribute **scsi_convert_dev_attrs(struct device *dev, + struct device_attribute **dev_attr); extern void scsi_sysfs_device_initialize(struct scsi_device *); extern int scsi_sysfs_target_initialize(struct scsi_device *); extern struct scsi_transport_template blank_transport_template; extern void __scsi_remove_device(struct scsi_device *); extern struct bus_type scsi_bus_type; -extern const struct attribute_group *scsi_sysfs_shost_attr_groups[]; +extern const struct attribute_group scsi_shost_attr_group; /* scsi_netlink.c */ #ifdef CONFIG_SCSI_NETLINK diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index b598dfcbb67d..3d98db6a97e6 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -424,15 +424,10 @@ static struct attribute *scsi_sysfs_shost_attrs[] = { NULL }; -static struct attribute_group scsi_shost_attr_group = { +const struct attribute_group scsi_shost_attr_group = { .attrs = scsi_sysfs_shost_attrs, }; -const struct attribute_group *scsi_sysfs_shost_attr_groups[] = { - &scsi_shost_attr_group, - NULL -}; - static void scsi_device_cls_release(struct device *class_dev) { struct scsi_device *sdev; @@ -1333,7 +1328,7 @@ static int scsi_target_add(struct scsi_target *starget) **/ int scsi_sysfs_add_sdev(struct scsi_device *sdev) { - int error, i; + int error; struct scsi_target *starget = sdev->sdev_target; error = scsi_target_add(starget); @@ -1386,23 +1381,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) } } - /* add additional host specific attributes */ - if (sdev->host->hostt->sdev_attrs) { - for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) { - error = device_create_file(&sdev->sdev_gendev, - sdev->host->hostt->sdev_attrs[i]); - if (error) - return error; - } - } - - if (sdev->host->hostt->sdev_groups) { - error = sysfs_create_groups(&sdev->sdev_gendev.kobj, - sdev->host->hostt->sdev_groups); - if (error) - return error; - } - scsi_autopm_put_device(sdev); return error; } @@ -1442,10 +1420,6 @@ void __scsi_remove_device(struct scsi_device *sdev) if (res != 0) return; - if (sdev->host->hostt->sdev_groups) - sysfs_remove_groups(&sdev->sdev_gendev.kobj, - sdev->host->hostt->sdev_groups); - if (IS_ENABLED(CONFIG_BLK_DEV_BSG) && sdev->bsg_dev) bsg_unregister_queue(sdev->bsg_dev); device_unregister(&sdev->sdev_dev); @@ -1584,23 +1558,31 @@ EXPORT_SYMBOL(scsi_register_interface); **/ int scsi_sysfs_add_host(struct Scsi_Host *shost) { - int error, i; - - /* add host specific attributes */ - if (shost->hostt->shost_attrs) { - for (i = 0; shost->hostt->shost_attrs[i]; i++) { - error = device_create_file(&shost->shost_dev, - shost->hostt->shost_attrs[i]); - if (error) - return error; - } - } - transport_register_device(&shost->shost_gendev); transport_configure_device(&shost->shost_gendev); return 0; } +/* + * Convert an array of struct device_attribute pointers into an array of + * struct attribute pointers. + */ +struct attribute **scsi_convert_dev_attrs(struct device *dev, + struct device_attribute **dev_attr) +{ + struct attribute **attrs; + int i; + + for (i = 0; dev_attr[i]; i++) + ; + attrs = devm_kzalloc(dev, (i + 1) * sizeof(*attrs), GFP_KERNEL); + if (!attrs) + return NULL; + for (i = 0; dev_attr[i]; i++) + attrs[i] = &dev_attr[i]->attr; + return attrs; +} + static struct device_type scsi_dev_type = { .name = "scsi_device", .release = scsi_device_dev_release, @@ -1609,8 +1591,10 @@ static struct device_type scsi_dev_type = { void scsi_sysfs_device_initialize(struct scsi_device *sdev) { + int i, j = 0; unsigned long flags; struct Scsi_Host *shost = sdev->host; + struct scsi_host_template *hostt = shost->hostt; struct scsi_target *starget = sdev->sdev_target; device_initialize(&sdev->sdev_gendev); @@ -1619,6 +1603,23 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev) scsi_enable_async_suspend(&sdev->sdev_gendev); dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu", sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); + sdev->gendev_attr_groups[j++] = &scsi_sdev_attr_group; + if (hostt->sdev_attrs) { + sdev->lld_attr_group = (struct attribute_group){ + .attrs = scsi_convert_dev_attrs(&sdev->sdev_gendev, + hostt->sdev_attrs) + }; + if (sdev->lld_attr_group.attrs) + sdev->gendev_attr_groups[j++] = &sdev->lld_attr_group; + } + if (hostt->sdev_groups) { + for (i = 0; hostt->sdev_groups[i] && + j < ARRAY_SIZE(sdev->gendev_attr_groups); + i++, j++) { + sdev->gendev_attr_groups[j] = hostt->sdev_groups[i]; + } + } + WARN_ON_ONCE(j >= ARRAY_SIZE(sdev->gendev_attr_groups)); device_initialize(&sdev->sdev_dev); sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index b97e142a7ca9..01732aabd7c3 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -225,6 +225,13 @@ struct scsi_device { struct device sdev_gendev, sdev_dev; + struct attribute_group lld_attr_group; + /* + * The array size 6 provides space for one attribute group for the + * SCSI core, four attribute groups defined by SCSI LLDs and one + * terminating NULL pointer. + */ + const struct attribute_group *gendev_attr_groups[6]; struct execute_work ew; /* used to get process context on put */ struct work_struct requeue_work; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 3bb46b188e1c..bc2fcb72ff59 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -483,6 +483,11 @@ struct scsi_host_template { */ struct device_attribute **sdev_attrs; + /* + * Pointer to the SCSI host sysfs attribute groups, NULL terminated. + */ + const struct attribute_group **shost_groups; + /* * Pointer to the SCSI device attribute groups for this host, * NULL terminated. @@ -695,6 +700,13 @@ struct Scsi_Host { /* ldm bits */ struct device shost_gendev, shost_dev; + struct attribute_group lld_attr_group; + /* + * The array size 3 provides space for one attribute group defined by + * the SCSI core, one attribute group defined by the SCSI LLD and one + * terminating NULL pointer. + */ + const struct attribute_group *shost_dev_attr_groups[3]; /* * Points to the transport data (if any) which is allocated -- cgit v1.2.3 From a47c6b713e89eef9e26ef9b17944fc807510bf3c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 12 Oct 2021 16:35:58 -0700 Subject: scsi: core: Remove two host template members that are no longer used All SCSI drivers have been converted to use shost_groups and sdev_groups instead of shost_attrs or sdev_attrs. Hence remove shost_attrs and sdev_attrs. Additionally, remove the 'lld_attr_group' members and also the scsi_convert_dev_attrs() function. Link: https://lore.kernel.org/r/20211012233558.4066756-47-bvanassche@acm.org Cc: Greg Kroah-Hartman Reviewed-by: Benjamin Block Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/hosts.c | 9 --------- drivers/scsi/scsi_priv.h | 2 -- drivers/scsi/scsi_sysfs.c | 28 ---------------------------- include/scsi/scsi_device.h | 1 - include/scsi/scsi_host.h | 11 ----------- 5 files changed, 51 deletions(-) (limited to 'include/scsi') diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 09157792d36b..17aef936bc90 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -483,15 +483,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) dev_set_name(&shost->shost_dev, "host%d", shost->host_no); shost->shost_dev.groups = shost->shost_dev_attr_groups; shost->shost_dev_attr_groups[j++] = &scsi_shost_attr_group; - if (sht->shost_attrs) { - shost->lld_attr_group = (struct attribute_group){ - .attrs = scsi_convert_dev_attrs(&shost->shost_gendev, - sht->shost_attrs) - }; - if (shost->lld_attr_group.attrs) - shost->shost_dev_attr_groups[j++] = - &shost->lld_attr_group; - } if (sht->shost_groups) { for (i = 0; sht->shost_groups[i] && j < ARRAY_SIZE(shost->shost_dev_attr_groups); diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 483d0ad5fe60..a278fc8948f4 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -138,8 +138,6 @@ extern int scsi_sysfs_add_sdev(struct scsi_device *); extern int scsi_sysfs_add_host(struct Scsi_Host *); extern int scsi_sysfs_register(void); extern void scsi_sysfs_unregister(void); -struct attribute **scsi_convert_dev_attrs(struct device *dev, - struct device_attribute **dev_attr); extern void scsi_sysfs_device_initialize(struct scsi_device *); extern int scsi_sysfs_target_initialize(struct scsi_device *); extern struct scsi_transport_template blank_transport_template; diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 3d98db6a97e6..c26f0e29e8cd 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1563,26 +1563,6 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost) return 0; } -/* - * Convert an array of struct device_attribute pointers into an array of - * struct attribute pointers. - */ -struct attribute **scsi_convert_dev_attrs(struct device *dev, - struct device_attribute **dev_attr) -{ - struct attribute **attrs; - int i; - - for (i = 0; dev_attr[i]; i++) - ; - attrs = devm_kzalloc(dev, (i + 1) * sizeof(*attrs), GFP_KERNEL); - if (!attrs) - return NULL; - for (i = 0; dev_attr[i]; i++) - attrs[i] = &dev_attr[i]->attr; - return attrs; -} - static struct device_type scsi_dev_type = { .name = "scsi_device", .release = scsi_device_dev_release, @@ -1604,14 +1584,6 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev) dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu", sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); sdev->gendev_attr_groups[j++] = &scsi_sdev_attr_group; - if (hostt->sdev_attrs) { - sdev->lld_attr_group = (struct attribute_group){ - .attrs = scsi_convert_dev_attrs(&sdev->sdev_gendev, - hostt->sdev_attrs) - }; - if (sdev->lld_attr_group.attrs) - sdev->gendev_attr_groups[j++] = &sdev->lld_attr_group; - } if (hostt->sdev_groups) { for (i = 0; hostt->sdev_groups[i] && j < ARRAY_SIZE(sdev->gendev_attr_groups); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 01732aabd7c3..b1e9b3bd3a60 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -225,7 +225,6 @@ struct scsi_device { struct device sdev_gendev, sdev_dev; - struct attribute_group lld_attr_group; /* * The array size 6 provides space for one attribute group for the * SCSI core, four attribute groups defined by SCSI LLDs and one diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index bc2fcb72ff59..ae715959f886 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -473,16 +473,6 @@ struct scsi_host_template { */ #define SCSI_DEFAULT_HOST_BLOCKED 7 - /* - * Pointer to the sysfs class properties for this host, NULL terminated. - */ - struct device_attribute **shost_attrs; - - /* - * Pointer to the SCSI device properties for this host, NULL terminated. - */ - struct device_attribute **sdev_attrs; - /* * Pointer to the SCSI host sysfs attribute groups, NULL terminated. */ @@ -700,7 +690,6 @@ struct Scsi_Host { /* ldm bits */ struct device shost_gendev, shost_dev; - struct attribute_group lld_attr_group; /* * The array size 3 provides space for one attribute group defined by * the SCSI core, one attribute group defined by the SCSI LLD and one -- cgit v1.2.3 From 3d8fa78ebd61aada5d55de6e04beee7fd916c62b Mon Sep 17 00:00:00 2001 From: Sreekanth Reddy Date: Mon, 18 Oct 2021 12:36:11 +0530 Subject: scsi: scsi_transport_sas: Add 22.5 Gbps link rate definitions Add 22.5 Gbps link rate definitions. Link: https://lore.kernel.org/r/20211018070611.26428-1-sreekanth.reddy@broadcom.com Reviewed-by: John Garry Signed-off-by: Sreekanth Reddy Signed-off-by: Martin K. Petersen --- drivers/scsi/scsi_transport_sas.c | 1 + include/scsi/scsi_transport_sas.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include/scsi') diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 4a96fb05731d..4ee578b181da 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -154,6 +154,7 @@ static struct { { SAS_LINK_RATE_3_0_GBPS, "3.0 Gbit" }, { SAS_LINK_RATE_6_0_GBPS, "6.0 Gbit" }, { SAS_LINK_RATE_12_0_GBPS, "12.0 Gbit" }, + { SAS_LINK_RATE_22_5_GBPS, "22.5 Gbit" }, }; sas_bitfield_name_search(linkspeed, sas_linkspeed_names) sas_bitfield_name_set(linkspeed, sas_linkspeed_names) diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index 05ec927a3c72..0e75b9277c8c 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h @@ -41,6 +41,7 @@ enum sas_linkrate { SAS_LINK_RATE_G2 = SAS_LINK_RATE_3_0_GBPS, SAS_LINK_RATE_6_0_GBPS = 10, SAS_LINK_RATE_12_0_GBPS = 11, + SAS_LINK_RATE_22_5_GBPS = 12, /* These are virtual to the transport class and may never * be signalled normally since the standard defined field * is only 4 bits */ -- cgit v1.2.3