aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-07-30 18:52:40 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-31 01:47:05 -0400
commit2486fa561a3192bbbec39c7feef87a1e07bd6342 (patch)
tree4241264273c63714e4c2021e7de69aee8bb2b20c /drivers
parentbfce5e0179ad059035df28558724ff60af708e09 (diff)
libata: update atapi disable handling
Global and per-LLD ATAPI disable checks were done in the command issue path probably because it was left out during EH conversion. On affected machines, this can cause lots of warning messages. Move them to where they belong - the probing path. Reported by Chunbo Luo. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Chunbo Luo <chunbo.luo@windriver.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c12
-rw-r--r--drivers/ata/libata-scsi.c34
-rw-r--r--drivers/ata/libata.h1
3 files changed, 13 insertions, 34 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9bef1a84fe3f..9cd04f684102 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -120,7 +120,7 @@ static char ata_force_param_buf[PAGE_SIZE] __initdata;
120module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0); 120module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0);
121MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)"); 121MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)");
122 122
123int atapi_enabled = 1; 123static int atapi_enabled = 1;
124module_param(atapi_enabled, int, 0444); 124module_param(atapi_enabled, int, 0444);
125MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); 125MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)");
126 126
@@ -2142,6 +2142,16 @@ int ata_dev_configure(struct ata_device *dev)
2142 return 0; 2142 return 0;
2143 } 2143 }
2144 2144
2145 if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) &&
2146 dev->class == ATA_DEV_ATAPI) {
2147 ata_dev_printk(dev, KERN_WARNING,
2148 "WARNING: ATAPI is %s, device ignored.\n",
2149 atapi_enabled ? "not supported with this driver"
2150 : "disabled");
2151 ata_dev_disable(dev);
2152 return 0;
2153 }
2154
2145 /* let ACPI work its magic */ 2155 /* let ACPI work its magic */
2146 rc = ata_acpi_on_devcfg(dev); 2156 rc = ata_acpi_on_devcfg(dev);
2147 if (rc) 2157 if (rc)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f3b4b15a8dc4..b9d3ba423cb2 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2551,36 +2551,6 @@ static struct ata_device *__ata_scsi_find_dev(struct ata_port *ap,
2551} 2551}
2552 2552
2553/** 2553/**
2554 * ata_scsi_dev_enabled - determine if device is enabled
2555 * @dev: ATA device
2556 *
2557 * Determine if commands should be sent to the specified device.
2558 *
2559 * LOCKING:
2560 * spin_lock_irqsave(host lock)
2561 *
2562 * RETURNS:
2563 * 0 if commands are not allowed / 1 if commands are allowed
2564 */
2565
2566static int ata_scsi_dev_enabled(struct ata_device *dev)
2567{
2568 if (unlikely(!ata_dev_enabled(dev)))
2569 return 0;
2570
2571 if (!atapi_enabled || (dev->link->ap->flags & ATA_FLAG_NO_ATAPI)) {
2572 if (unlikely(dev->class == ATA_DEV_ATAPI)) {
2573 ata_dev_printk(dev, KERN_WARNING,
2574 "WARNING: ATAPI is %s, device ignored.\n",
2575 atapi_enabled ? "not supported with this driver" : "disabled");
2576 return 0;
2577 }
2578 }
2579
2580 return 1;
2581}
2582
2583/**
2584 * ata_scsi_find_dev - lookup ata_device from scsi_cmnd 2554 * ata_scsi_find_dev - lookup ata_device from scsi_cmnd
2585 * @ap: ATA port to which the device is attached 2555 * @ap: ATA port to which the device is attached
2586 * @scsidev: SCSI device from which we derive the ATA device 2556 * @scsidev: SCSI device from which we derive the ATA device
@@ -2601,7 +2571,7 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2601{ 2571{
2602 struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev); 2572 struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev);
2603 2573
2604 if (unlikely(!dev || !ata_scsi_dev_enabled(dev))) 2574 if (unlikely(!dev || !ata_dev_enabled(dev)))
2605 return NULL; 2575 return NULL;
2606 2576
2607 return dev; 2577 return dev;
@@ -3622,7 +3592,7 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
3622 3592
3623 ata_scsi_dump_cdb(ap, cmd); 3593 ata_scsi_dump_cdb(ap, cmd);
3624 3594
3625 if (likely(ata_scsi_dev_enabled(ap->link.device))) 3595 if (likely(ata_dev_enabled(ap->link.device)))
3626 rc = __ata_scsi_queuecmd(cmd, done, ap->link.device); 3596 rc = __ata_scsi_queuecmd(cmd, done, ap->link.device);
3627 else { 3597 else {
3628 cmd->result = (DID_BAD_TARGET << 16); 3598 cmd->result = (DID_BAD_TARGET << 16);
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index f6f9c28ec7f8..ade5c75b6144 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -66,7 +66,6 @@ enum {
66 66
67extern unsigned int ata_print_id; 67extern unsigned int ata_print_id;
68extern struct workqueue_struct *ata_aux_wq; 68extern struct workqueue_struct *ata_aux_wq;
69extern int atapi_enabled;
70extern int atapi_passthru16; 69extern int atapi_passthru16;
71extern int libata_fua; 70extern int libata_fua;
72extern int libata_noacpi; 71extern int libata_noacpi;