diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-06 00:05:53 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-06 00:05:53 +0200 |
commit | 052c220da392c4dcbc628852d04970447a315683 (patch) | |
tree | b251b5c977152c1c63c51ed625ee1b31a8741851 /drivers/scsi/mvme147.c | |
parent | Merge tag 'for-4.17/block-20180402' of git://git.kernel.dk/linux-block (diff) | |
parent | Merge branch 'fixes' into misc (diff) | |
download | linux-052c220da392c4dcbc628852d04970447a315683.tar.xz linux-052c220da392c4dcbc628852d04970447a315683.zip |
Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This is mostly updates of the usual drivers: arcmsr, qla2xx, lpfc,
ufs, mpt3sas, hisi_sas.
In addition we have removed several really old drivers: sym53c416,
NCR53c406a, fdomain, fdomain_cs and removed the old scsi_module.c
initialization from all remaining drivers.
Plus an assortment of bug fixes, initialization errors and other minor
fixes"
* tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (168 commits)
scsi: ufs: Add support for Auto-Hibernate Idle Timer
scsi: ufs: sysfs: reworking of the rpm_lvl and spm_lvl entries
scsi: qla2xxx: fx00 copypaste typo
scsi: qla2xxx: fix error message on <qla2400
scsi: smartpqi: update driver version
scsi: smartpqi: workaround fw bug for oq deletion
scsi: arcmsr: Change driver version to v1.40.00.05-20180309
scsi: arcmsr: Sleep to avoid CPU stuck too long for waiting adapter ready
scsi: arcmsr: Handle adapter removed due to thunderbolt cable disconnection.
scsi: arcmsr: Rename ACB_F_BUS_HANG_ON to ACB_F_ADAPTER_REMOVED for adapter hot-plug
scsi: qla2xxx: Update driver version to 10.00.00.06-k
scsi: qla2xxx: Fix Async GPN_FT for FCP and FC-NVMe scan
scsi: qla2xxx: Cleanup code to improve FC-NVMe error handling
scsi: qla2xxx: Fix FC-NVMe IO abort during driver reset
scsi: qla2xxx: Fix retry for PRLI RJT with reason of BUSY
scsi: qla2xxx: Remove nvme_done_list
scsi: qla2xxx: Return busy if rport going away
scsi: qla2xxx: Fix n2n_ae flag to prevent dev_loss on PDB change
scsi: qla2xxx: Add FC-NVMe abort processing
scsi: qla2xxx: Add changes for devloss timeout in driver
...
Diffstat (limited to 'drivers/scsi/mvme147.c')
-rw-r--r-- | drivers/scsi/mvme147.c | 107 |
1 files changed, 57 insertions, 50 deletions
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index e6b2b681fda3..7d1ab414b78f 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -3,6 +3,9 @@ #include <linux/mm.h> #include <linux/blkdev.h> #include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/module.h> #include <asm/page.h> #include <asm/pgtable.h> @@ -14,9 +17,6 @@ #include "wd33c93.h" #include "mvme147.h" -#include <linux/stat.h> - - static irqreturn_t mvme147_intr(int irq, void *data) { struct Scsi_Host *instance = data; @@ -65,40 +65,57 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, m147_pcc->dma_cntrl = 0; } -int mvme147_detect(struct scsi_host_template *tpnt) +static struct scsi_host_template mvme147_host_template = { + .module = THIS_MODULE, + .proc_name = "MVME147", + .name = "MVME147 built-in SCSI", + .queuecommand = wd33c93_queuecommand, + .eh_abort_handler = wd33c93_abort, + .eh_host_reset_handler = wd33c93_host_reset, + .show_info = wd33c93_show_info, + .write_info = wd33c93_write_info, + .can_queue = CAN_QUEUE, + .this_id = 7, + .sg_tablesize = SG_ALL, + .cmd_per_lun = CMD_PER_LUN, + .use_clustering = ENABLE_CLUSTERING +}; + +static struct Scsi_Host *mvme147_shost; + +static int __init mvme147_init(void) { - static unsigned char called = 0; - struct Scsi_Host *instance; wd33c93_regs regs; struct WD33C93_hostdata *hdata; + int error = -ENOMEM; - if (!MACH_IS_MVME147 || called) + if (!MACH_IS_MVME147) return 0; - called++; - tpnt->proc_name = "MVME147"; - tpnt->show_info = wd33c93_show_info, - tpnt->write_info = wd33c93_write_info, - - instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); - if (!instance) + mvme147_shost = scsi_host_alloc(&mvme147_host_template, + sizeof(struct WD33C93_hostdata)); + if (!mvme147_shost) goto err_out; + mvme147_shost->base = 0xfffe4000; + mvme147_shost->irq = MVME147_IRQ_SCSI_PORT; - instance->base = 0xfffe4000; - instance->irq = MVME147_IRQ_SCSI_PORT; regs.SASR = (volatile unsigned char *)0xfffe4000; regs.SCMD = (volatile unsigned char *)0xfffe4001; - hdata = shost_priv(instance); + + hdata = shost_priv(mvme147_shost); hdata->no_sync = 0xff; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; - wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); - if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, - "MVME147 SCSI PORT", instance)) + wd33c93_init(mvme147_shost, regs, dma_setup, dma_stop, WD33C93_FS_8_10); + + error = request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, + "MVME147 SCSI PORT", mvme147_shost); + if (error) goto err_unregister; - if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0, - "MVME147 SCSI DMA", instance)) + error = request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0, + "MVME147 SCSI DMA", mvme147_shost); + if (error) goto err_free_irq; #if 0 /* Disabled; causes problems booting */ m147_pcc->scsi_interrupt = 0x10; /* Assert SCSI bus reset */ @@ -112,40 +129,30 @@ int mvme147_detect(struct scsi_host_template *tpnt) m147_pcc->dma_cntrl = 0x00; /* ensure DMA is stopped */ m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ - return 1; + error = scsi_add_host(mvme147_shost, NULL); + if (error) + goto err_free_irq; + scsi_scan_host(mvme147_shost); + return 0; err_free_irq: - free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); + free_irq(MVME147_IRQ_SCSI_PORT, mvme147_shost); err_unregister: - scsi_unregister(instance); + scsi_host_put(mvme147_shost); err_out: - return 0; + return error; } -static struct scsi_host_template driver_template = { - .proc_name = "MVME147", - .name = "MVME147 built-in SCSI", - .detect = mvme147_detect, - .release = mvme147_release, - .queuecommand = wd33c93_queuecommand, - .eh_abort_handler = wd33c93_abort, - .eh_host_reset_handler = wd33c93_host_reset, - .can_queue = CAN_QUEUE, - .this_id = 7, - .sg_tablesize = SG_ALL, - .cmd_per_lun = CMD_PER_LUN, - .use_clustering = ENABLE_CLUSTERING -}; - - -#include "scsi_module.c" - -int mvme147_release(struct Scsi_Host *instance) +static void __exit mvme147_exit(void) { -#ifdef MODULE + scsi_remove_host(mvme147_shost); + /* XXX Make sure DMA is stopped! */ - free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); - free_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr); -#endif - return 1; + free_irq(MVME147_IRQ_SCSI_PORT, mvme147_shost); + free_irq(MVME147_IRQ_SCSI_DMA, mvme147_shost); + + scsi_host_put(mvme147_shost); } + +module_init(mvme147_init); +module_exit(mvme147_exit); |