aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-03-05 17:55:58 +0900
committerJeff Garzik <jeff@garzik.org>2006-03-05 11:09:42 -0500
commit4c2d721ab6413ee4ff33617ed1413458261f36ea (patch)
treeb641f68a902c64a08dc308f259c05abed1d81655 /drivers/scsi
parent208a9933bc7d71e7ad194a9ffbfbcd7878c48dfe (diff)
[PATCH] libata: add @print_info argument to ata_dev_configure()
Add @print_info argument to ata_dev_configure(). Details of configured device is printed only when @pinfo_info is non-zero. This patch also reorganizes device info printing for LBA case to simplify code (necessary as @print_info adds extra nesting around it). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libata-core.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 59828490a75..d65aa86ddbb 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1063,6 +1063,7 @@ static inline u8 ata_dev_knobble(const struct ata_port *ap,
* ata_dev_configure - Configure the specified ATA/ATAPI device
* @ap: Port on which target device resides
* @dev: Target device to configure
+ * @print_info: Enable device info printout
*
* Configure @dev according to @dev->id. Generic and low-level
* driver specific fixups are also applied.
@@ -1073,7 +1074,8 @@ static inline u8 ata_dev_knobble(const struct ata_port *ap,
* RETURNS:
* 0 on success, -errno otherwise
*/
-static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev)
+static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev,
+ int print_info)
{
unsigned long xfer_modes;
int i, rc;
@@ -1120,18 +1122,24 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev)
dev->n_sectors = ata_id_n_sectors(dev->id);
if (ata_id_has_lba(dev->id)) {
- dev->flags |= ATA_DFLAG_LBA;
+ const char *lba_desc;
- if (ata_id_has_lba48(dev->id))
+ lba_desc = "LBA";
+ dev->flags |= ATA_DFLAG_LBA;
+ if (ata_id_has_lba48(dev->id)) {
dev->flags |= ATA_DFLAG_LBA48;
+ lba_desc = "LBA48";
+ }
/* print device info to dmesg */
- printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n",
- ap->id, dev->devno,
- ata_id_major_version(dev->id),
- ata_mode_string(xfer_modes),
- (unsigned long long)dev->n_sectors,
- dev->flags & ATA_DFLAG_LBA48 ? " LBA48" : " LBA");
+ if (print_info)
+ printk(KERN_INFO "ata%u: dev %u ATA-%d, "
+ "max %s, %Lu sectors: %s\n",
+ ap->id, dev->devno,
+ ata_id_major_version(dev->id),
+ ata_mode_string(xfer_modes),
+ (unsigned long long)dev->n_sectors,
+ lba_desc);
} else {
/* CHS */
@@ -1148,13 +1156,14 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev)
}
/* print device info to dmesg */
- printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors: CHS %d/%d/%d\n",
- ap->id, dev->devno,
- ata_id_major_version(dev->id),
- ata_mode_string(xfer_modes),
- (unsigned long long)dev->n_sectors,
- (int)dev->cylinders, (int)dev->heads, (int)dev->sectors);
-
+ if (print_info)
+ printk(KERN_INFO "ata%u: dev %u ATA-%d, "
+ "max %s, %Lu sectors: CHS %u/%u/%u\n",
+ ap->id, dev->devno,
+ ata_id_major_version(dev->id),
+ ata_mode_string(xfer_modes),
+ (unsigned long long)dev->n_sectors,
+ dev->cylinders, dev->heads, dev->sectors);
}
dev->cdb_len = 16;
@@ -1171,9 +1180,9 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev)
dev->cdb_len = (unsigned int) rc;
/* print device info to dmesg */
- printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n",
- ap->id, dev->devno,
- ata_mode_string(xfer_modes));
+ if (print_info)
+ printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n",
+ ap->id, dev->devno, ata_mode_string(xfer_modes));
}
ap->host->max_cmd_len = 0;
@@ -1184,8 +1193,9 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev)
/* limit bridge transfers to udma5, 200 sectors */
if (ata_dev_knobble(ap, dev)) {
- printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
- ap->id, dev->devno);
+ if (print_info)
+ printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
+ ap->id, dev->devno);
ap->udma_mask &= ATA_UDMA5;
dev->max_sectors = ATA_MAX_SECTORS;
}
@@ -1263,7 +1273,7 @@ static int ata_bus_probe(struct ata_port *ap)
continue;
}
- if (ata_dev_configure(ap, dev)) {
+ if (ata_dev_configure(ap, dev, 1)) {
dev->class++; /* disable device */
continue;
}