2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00

[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>
This commit is contained in:
Tejun Heo 2006-03-05 17:55:58 +09:00 committed by Jeff Garzik
parent 208a9933bc
commit 4c2d721ab6

View File

@ -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",
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,
dev->flags & ATA_DFLAG_LBA48 ? " LBA48" : " LBA");
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",
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,
(int)dev->cylinders, (int)dev->heads, (int)dev->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 */
if (print_info)
printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n",
ap->id, dev->devno,
ata_mode_string(xfer_modes));
ap->id, dev->devno, ata_mode_string(xfer_modes));
}
ap->host->max_cmd_len = 0;
@ -1184,6 +1193,7 @@ 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)) {
if (print_info)
printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
ap->id, dev->devno);
ap->udma_mask &= ATA_UDMA5;
@ -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;
}