[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>

authored by Brian King and committed by Jeff Garzik e6d902a3 a93620b8

+15 -6
+15 -6
drivers/scsi/libata-core.c
··· 1325 1325 snprintf(desc, desc_sz, "NCQ (depth %d/%d)", hdepth, ddepth); 1326 1326 } 1327 1327 1328 + static 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 1342 * ata_dev_configure - Configure the specified ATA/ATAPI device 1330 1343 * @dev: Target device to configure ··· 1357 1344 struct ata_port *ap = dev->ap; 1358 1345 const u16 *id = dev->id; 1359 1346 unsigned int xfer_mask; 1360 - int i, rc; 1347 + int rc; 1361 1348 1362 1349 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { 1363 1350 ata_dev_printk(dev, KERN_INFO, ··· 1487 1474 cdb_intr_string); 1488 1475 } 1489 1476 1490 - ap->host->max_cmd_len = 0; 1491 - for (i = 0; i < ATA_MAX_DEVICES; i++) 1492 - ap->host->max_cmd_len = max_t(unsigned int, 1493 - ap->host->max_cmd_len, 1494 - ap->device[i].cdb_len); 1477 + ata_set_port_max_cmd_len(ap); 1495 1478 1496 1479 /* limit bridge transfers to udma5, 200 sectors */ 1497 1480 if (ata_dev_knobble(dev)) {