aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBrian King <brking@us.ibm.com>2006-06-28 09:30:31 -0400
committerJeff Garzik <jeff@garzik.org>2006-07-05 21:47:47 -0400
commite6d902a3bfd53da375588e498251f4f4f6cd9650 (patch)
tree568f79cb9c92c23d47dcee9bd9d537835ad7b384 /drivers
parenta93620b860434a19820072e656f4933e101ea6d4 (diff)
[PATCH] libata: Conditionally set host->max_cmd_len
In preparation for SAS attached SATA devices, which will not have a libata scsi_host, only setup host->max_cmd_len if ap->host exists. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/libata-core.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 1c960ac1617f..fd0e6cc0619f 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1325,6 +1325,19 @@ static void ata_dev_config_ncq(struct ata_device *dev,
1325 snprintf(desc, desc_sz, "NCQ (depth %d/%d)", hdepth, ddepth); 1325 snprintf(desc, desc_sz, "NCQ (depth %d/%d)", hdepth, ddepth);
1326} 1326}
1327 1327
1328static void ata_set_port_max_cmd_len(struct ata_port *ap)
1329{
1330 int i;
1331
1332 if (ap->host) {
1333 ap->host->max_cmd_len = 0;
1334 for (i = 0; i < ATA_MAX_DEVICES; i++)
1335 ap->host->max_cmd_len = max_t(unsigned int,
1336 ap->host->max_cmd_len,
1337 ap->device[i].cdb_len);
1338 }
1339}
1340
1328/** 1341/**
1329 * ata_dev_configure - Configure the specified ATA/ATAPI device 1342 * ata_dev_configure - Configure the specified ATA/ATAPI device
1330 * @dev: Target device to configure 1343 * @dev: Target device to configure
@@ -1344,7 +1357,7 @@ int ata_dev_configure(struct ata_device *dev, int print_info)
1344 struct ata_port *ap = dev->ap; 1357 struct ata_port *ap = dev->ap;
1345 const u16 *id = dev->id; 1358 const u16 *id = dev->id;
1346 unsigned int xfer_mask; 1359 unsigned int xfer_mask;
1347 int i, rc; 1360 int rc;
1348 1361
1349 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { 1362 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) {
1350 ata_dev_printk(dev, KERN_INFO, 1363 ata_dev_printk(dev, KERN_INFO,
@@ -1474,11 +1487,7 @@ int ata_dev_configure(struct ata_device *dev, int print_info)
1474 cdb_intr_string); 1487 cdb_intr_string);
1475 } 1488 }
1476 1489
1477 ap->host->max_cmd_len = 0; 1490 ata_set_port_max_cmd_len(ap);
1478 for (i = 0; i < ATA_MAX_DEVICES; i++)
1479 ap->host->max_cmd_len = max_t(unsigned int,
1480 ap->host->max_cmd_len,
1481 ap->device[i].cdb_len);
1482 1491
1483 /* limit bridge transfers to udma5, 200 sectors */ 1492 /* limit bridge transfers to udma5, 200 sectors */
1484 if (ata_dev_knobble(dev)) { 1493 if (ata_dev_knobble(dev)) {