diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/Kconfig | 20 | ||||
-rw-r--r-- | drivers/scsi/arm/Kconfig | 10 | ||||
-rw-r--r-- | drivers/scsi/device_handler/Kconfig | 4 | ||||
-rw-r--r-- | drivers/scsi/hosts.c | 4 | ||||
-rw-r--r-- | drivers/scsi/osd/osd_uld.c | 26 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 14 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sr.c | 46 | ||||
-rw-r--r-- | drivers/scsi/storvsc_drv.c | 12 |
9 files changed, 93 insertions, 47 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 142f632e2a2..db95c547c09 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -42,7 +42,7 @@ config SCSI_DMA config SCSI_TGT tristate "SCSI target support" - depends on SCSI && EXPERIMENTAL + depends on SCSI ---help--- If you want to use SCSI target mode drivers enable this option. If you choose M, the module will be called scsi_tgt. @@ -883,7 +883,7 @@ config SCSI_IBMVSCSI This is the IBM POWER Virtual SCSI Client To compile this driver as a module, choose M here: the - module will be called ibmvscsic. + module will be called ibmvscsi. config SCSI_IBMVSCSIS tristate "IBM Virtual SCSI Server support" @@ -1392,8 +1392,8 @@ config SCSI_SYM53C416 module will be called sym53c416. config SCSI_DC395x - tristate "Tekram DC395(U/UW/F) and DC315(U) SCSI support (EXPERIMENTAL)" - depends on PCI && SCSI && EXPERIMENTAL + tristate "Tekram DC395(U/UW/F) and DC315(U) SCSI support" + depends on PCI && SCSI ---help--- This driver supports PCI SCSI host adapters based on the ASIC TRM-S1040 chip, e.g Tekram DC395(U/UW/F) and DC315(U) variants. @@ -1618,8 +1618,8 @@ config GVP11_SCSI module will be called gvp11. config SCSI_A4000T - tristate "A4000T NCR53c710 SCSI support (EXPERIMENTAL)" - depends on AMIGA && SCSI && EXPERIMENTAL + tristate "A4000T NCR53c710 SCSI support" + depends on AMIGA && SCSI select SCSI_SPI_ATTRS help If you have an Amiga 4000T and have SCSI devices connected to the @@ -1629,8 +1629,8 @@ config SCSI_A4000T module will be called a4000t. config SCSI_ZORRO7XX - tristate "Zorro NCR53c710 SCSI support (EXPERIMENTAL)" - depends on ZORRO && SCSI && EXPERIMENTAL + tristate "Zorro NCR53c710 SCSI support" + depends on ZORRO && SCSI select SCSI_SPI_ATTRS help Support for various NCR53c710-based SCSI controllers on Zorro @@ -1807,8 +1807,8 @@ config SCSI_BFA_FC be called bfa. config SCSI_VIRTIO - tristate "virtio-scsi support (EXPERIMENTAL)" - depends on EXPERIMENTAL && VIRTIO + tristate "virtio-scsi support" + depends on VIRTIO help This is the virtual HBA driver for virtio. If the kernel will be used in a virtual machine, say Y or M. diff --git a/drivers/scsi/arm/Kconfig b/drivers/scsi/arm/Kconfig index a8587f1f5e7..cfd172a439c 100644 --- a/drivers/scsi/arm/Kconfig +++ b/drivers/scsi/arm/Kconfig @@ -64,19 +64,19 @@ config SCSI_POWERTECSCSI you have one of these, say Y. If unsure, say N. comment "The following drivers are not fully supported" - depends on ARCH_ACORN && EXPERIMENTAL + depends on ARCH_ACORN config SCSI_CUMANA_1 - tristate "CumanaSCSI I support (EXPERIMENTAL)" - depends on ARCH_ACORN && EXPERIMENTAL && SCSI + tristate "CumanaSCSI I support" + depends on ARCH_ACORN && SCSI select SCSI_SPI_ATTRS help This enables support for the Cumana SCSI I card. If you have an Acorn system with one of these, say Y. If unsure, say N. config SCSI_OAK1 - tristate "Oak SCSI support (EXPERIMENTAL)" - depends on ARCH_ACORN && EXPERIMENTAL && SCSI + tristate "Oak SCSI support" + depends on ARCH_ACORN && SCSI select SCSI_SPI_ATTRS help This enables support for the Oak SCSI card. If you have an Acorn diff --git a/drivers/scsi/device_handler/Kconfig b/drivers/scsi/device_handler/Kconfig index 67070257919..69abd0ad48e 100644 --- a/drivers/scsi/device_handler/Kconfig +++ b/drivers/scsi/device_handler/Kconfig @@ -32,8 +32,8 @@ config SCSI_DH_EMC If you have a EMC CLARiiON select y. Otherwise, say N. config SCSI_DH_ALUA - tristate "SPC-3 ALUA Device Handler (EXPERIMENTAL)" - depends on SCSI_DH && EXPERIMENTAL + tristate "SPC-3 ALUA Device Handler" + depends on SCSI_DH help SCSI Device handler for generic SPC-3 Asymmetric Logical Unit Access (ALUA). diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 593085a5227..df0c3c71ea4 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -468,10 +468,10 @@ void scsi_unregister(struct Scsi_Host *shost) } EXPORT_SYMBOL(scsi_unregister); -static int __scsi_host_match(struct device *dev, void *data) +static int __scsi_host_match(struct device *dev, const void *data) { struct Scsi_Host *p; - unsigned short *hostnum = (unsigned short *)data; + const unsigned short *hostnum = data; p = class_to_shost(dev); return p->host_no == *hostnum; diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c index 43754176a7b..0fab6b5c7b8 100644 --- a/drivers/scsi/osd/osd_uld.c +++ b/drivers/scsi/osd/osd_uld.c @@ -268,18 +268,11 @@ static inline bool _the_same_or_null(const u8 *a1, unsigned a1_len, return 0 == memcmp(a1, a2, a1_len); } -struct find_oud_t { - const struct osd_dev_info *odi; - struct device *dev; - struct osd_uld_device *oud; -} ; - -int _mach_odi(struct device *dev, void *find_data) +static int _match_odi(struct device *dev, const void *find_data) { struct osd_uld_device *oud = container_of(dev, struct osd_uld_device, class_dev); - struct find_oud_t *fot = find_data; - const struct osd_dev_info *odi = fot->odi; + const struct osd_dev_info *odi = find_data; if (_the_same_or_null(oud->odi.systemid, oud->odi.systemid_len, odi->systemid, odi->systemid_len) && @@ -287,7 +280,6 @@ int _mach_odi(struct device *dev, void *find_data) odi->osdname, odi->osdname_len)) { OSD_DEBUG("found device sysid_len=%d osdname=%d\n", odi->systemid_len, odi->osdname_len); - fot->oud = oud; return 1; } else { return 0; @@ -301,19 +293,19 @@ int _mach_odi(struct device *dev, void *find_data) */ struct osd_dev *osduld_info_lookup(const struct osd_dev_info *odi) { - struct find_oud_t find = {.odi = odi}; - - find.dev = class_find_device(&osd_uld_class, NULL, &find, _mach_odi); - if (likely(find.dev)) { + struct device *dev = class_find_device(&osd_uld_class, NULL, odi, _match_odi); + if (likely(dev)) { struct osd_dev_handle *odh = kzalloc(sizeof(*odh), GFP_KERNEL); + struct osd_uld_device *oud = container_of(dev, + struct osd_uld_device, class_dev); if (unlikely(!odh)) { - put_device(find.dev); + put_device(dev); return ERR_PTR(-ENOMEM); } - odh->od = find.oud->od; - odh->oud = find.oud; + odh->od = oud->od; + odh->oud = oud; return &odh->od; } diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f1bf5aff68e..765398c063c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2617,3 +2617,17 @@ void scsi_kunmap_atomic_sg(void *virt) kunmap_atomic(virt); } EXPORT_SYMBOL(scsi_kunmap_atomic_sg); + +void sdev_disable_disk_events(struct scsi_device *sdev) +{ + atomic_inc(&sdev->disk_events_disable_depth); +} +EXPORT_SYMBOL(sdev_disable_disk_events); + +void sdev_enable_disk_events(struct scsi_device *sdev) +{ + if (WARN_ON_ONCE(atomic_read(&sdev->disk_events_disable_depth) <= 0)) + return; + atomic_dec(&sdev->disk_events_disable_depth); +} +EXPORT_SYMBOL(sdev_enable_disk_events); diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 31969f2e13c..59d427bf08e 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -183,10 +183,10 @@ static struct attribute_group iscsi_endpoint_group = { #define ISCSI_MAX_EPID -1 -static int iscsi_match_epid(struct device *dev, void *data) +static int iscsi_match_epid(struct device *dev, const void *data) { struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); - uint64_t *epid = (uint64_t *) data; + const uint64_t *epid = data; return *epid == ep->id; } diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 5fc97d2ba2f..f2884ee9071 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -45,6 +45,7 @@ #include <linux/blkdev.h> #include <linux/mutex.h> #include <linux/slab.h> +#include <linux/pm_runtime.h> #include <asm/uaccess.h> #include <scsi/scsi.h> @@ -79,6 +80,11 @@ static DEFINE_MUTEX(sr_mutex); static int sr_probe(struct device *); static int sr_remove(struct device *); static int sr_done(struct scsi_cmnd *); +static int sr_runtime_suspend(struct device *dev); + +static struct dev_pm_ops sr_pm_ops = { + .runtime_suspend = sr_runtime_suspend, +}; static struct scsi_driver sr_template = { .owner = THIS_MODULE, @@ -86,6 +92,7 @@ static struct scsi_driver sr_template = { .name = "sr", .probe = sr_probe, .remove = sr_remove, + .pm = &sr_pm_ops, }, .done = sr_done, }; @@ -131,6 +138,16 @@ static inline struct scsi_cd *scsi_cd(struct gendisk *disk) return container_of(disk->private_data, struct scsi_cd, driver); } +static int sr_runtime_suspend(struct device *dev) +{ + struct scsi_cd *cd = dev_get_drvdata(dev); + + if (cd->media_present) + return -EBUSY; + else + return 0; +} + /* * The get and put routines for the struct scsi_cd. Note this entity * has a scsi_device pointer and owns a reference to this. @@ -146,7 +163,8 @@ static inline struct scsi_cd *scsi_cd_get(struct gendisk *disk) kref_get(&cd->kref); if (scsi_device_get(cd->device)) goto out_put; - goto out; + if (!scsi_autopm_get_device(cd->device)) + goto out; out_put: kref_put(&cd->kref, sr_kref_release); @@ -162,6 +180,7 @@ static void scsi_cd_put(struct scsi_cd *cd) mutex_lock(&sr_ref_mutex); kref_put(&cd->kref, sr_kref_release); + scsi_autopm_put_device(sdev); scsi_device_put(sdev); mutex_unlock(&sr_ref_mutex); } @@ -540,6 +559,8 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, void __user *argp = (void __user *)arg; int ret; + scsi_autopm_get_device(cd->device); + mutex_lock(&sr_mutex); /* @@ -571,6 +592,7 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, out: mutex_unlock(&sr_mutex); + scsi_autopm_put_device(cd->device); return ret; } @@ -578,7 +600,17 @@ static unsigned int sr_block_check_events(struct gendisk *disk, unsigned int clearing) { struct scsi_cd *cd = scsi_cd(disk); - return cdrom_check_events(&cd->cdi, clearing); + unsigned int ret; + + if (atomic_read(&cd->device->disk_events_disable_depth) == 0) { + scsi_autopm_get_device(cd->device); + ret = cdrom_check_events(&cd->cdi, clearing); + scsi_autopm_put_device(cd->device); + } else { + ret = 0; + } + + return ret; } static int sr_block_revalidate_disk(struct gendisk *disk) @@ -586,12 +618,16 @@ static int sr_block_revalidate_disk(struct gendisk *disk) struct scsi_cd *cd = scsi_cd(disk); struct scsi_sense_hdr sshdr; + scsi_autopm_get_device(cd->device); + /* if the unit is not ready, nothing more to do */ if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr)) - return 0; + goto out; sr_cd_check(&cd->cdi); get_sectorsize(cd); +out: + scsi_autopm_put_device(cd->device); return 0; } @@ -718,6 +754,8 @@ static int sr_probe(struct device *dev) sdev_printk(KERN_DEBUG, sdev, "Attached scsi CD-ROM %s\n", cd->cdi.name); + scsi_autopm_put_device(cd->device); + return 0; fail_put: @@ -965,6 +1003,8 @@ static int sr_remove(struct device *dev) { struct scsi_cd *cd = dev_get_drvdata(dev); + scsi_autopm_get_device(cd->device); + blk_queue_prep_rq(cd->device->request_queue, scsi_prep_fn); del_gendisk(cd->disk); diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 01440782feb..270b3cf6f37 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1410,13 +1410,13 @@ enum { static const struct hv_vmbus_device_id id_table[] = { /* SCSI guid */ - { VMBUS_DEVICE(0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, - 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f) - .driver_data = SCSI_GUID }, + { HV_SCSI_GUID, + .driver_data = SCSI_GUID + }, /* IDE guid */ - { VMBUS_DEVICE(0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, - 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5) - .driver_data = IDE_GUID }, + { HV_IDE_GUID, + .driver_data = IDE_GUID + }, { }, }; |