diff options
author | Tejun Heo <htejun@gmail.com> | 2006-03-05 03:55:58 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-05 11:09:42 -0500 |
commit | 4c2d721ab6413ee4ff33617ed1413458261f36ea (patch) | |
tree | b641f68a902c64a08dc308f259c05abed1d81655 /drivers | |
parent | 208a9933bc7d71e7ad194a9ffbfbcd7878c48dfe (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')
-rw-r--r-- | drivers/scsi/libata-core.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 59828490a750..d65aa86ddbb2 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, | |||
1063 | * ata_dev_configure - Configure the specified ATA/ATAPI device | 1063 | * ata_dev_configure - Configure the specified ATA/ATAPI device |
1064 | * @ap: Port on which target device resides | 1064 | * @ap: Port on which target device resides |
1065 | * @dev: Target device to configure | 1065 | * @dev: Target device to configure |
1066 | * @print_info: Enable device info printout | ||
1066 | * | 1067 | * |
1067 | * Configure @dev according to @dev->id. Generic and low-level | 1068 | * Configure @dev according to @dev->id. Generic and low-level |
1068 | * driver specific fixups are also applied. | 1069 | * driver specific fixups are also applied. |
@@ -1073,7 +1074,8 @@ static inline u8 ata_dev_knobble(const struct ata_port *ap, | |||
1073 | * RETURNS: | 1074 | * RETURNS: |
1074 | * 0 on success, -errno otherwise | 1075 | * 0 on success, -errno otherwise |
1075 | */ | 1076 | */ |
1076 | static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev) | 1077 | static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev, |
1078 | int print_info) | ||
1077 | { | 1079 | { |
1078 | unsigned long xfer_modes; | 1080 | unsigned long xfer_modes; |
1079 | int i, rc; | 1081 | int i, rc; |
@@ -1120,18 +1122,24 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev) | |||
1120 | dev->n_sectors = ata_id_n_sectors(dev->id); | 1122 | dev->n_sectors = ata_id_n_sectors(dev->id); |
1121 | 1123 | ||
1122 | if (ata_id_has_lba(dev->id)) { | 1124 | if (ata_id_has_lba(dev->id)) { |
1123 | dev->flags |= ATA_DFLAG_LBA; | 1125 | const char *lba_desc; |
1124 | 1126 | ||
1125 | if (ata_id_has_lba48(dev->id)) | 1127 | lba_desc = "LBA"; |
1128 | dev->flags |= ATA_DFLAG_LBA; | ||
1129 | if (ata_id_has_lba48(dev->id)) { | ||
1126 | dev->flags |= ATA_DFLAG_LBA48; | 1130 | dev->flags |= ATA_DFLAG_LBA48; |
1131 | lba_desc = "LBA48"; | ||
1132 | } | ||
1127 | 1133 | ||
1128 | /* print device info to dmesg */ | 1134 | /* print device info to dmesg */ |
1129 | printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n", | 1135 | if (print_info) |
1130 | ap->id, dev->devno, | 1136 | printk(KERN_INFO "ata%u: dev %u ATA-%d, " |
1131 | ata_id_major_version(dev->id), | 1137 | "max %s, %Lu sectors: %s\n", |
1132 | ata_mode_string(xfer_modes), | 1138 | ap->id, dev->devno, |
1133 | (unsigned long long)dev->n_sectors, | 1139 | ata_id_major_version(dev->id), |
1134 | dev->flags & ATA_DFLAG_LBA48 ? " LBA48" : " LBA"); | 1140 | ata_mode_string(xfer_modes), |
1141 | (unsigned long long)dev->n_sectors, | ||
1142 | lba_desc); | ||
1135 | } else { | 1143 | } else { |
1136 | /* CHS */ | 1144 | /* CHS */ |
1137 | 1145 | ||
@@ -1148,13 +1156,14 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev) | |||
1148 | } | 1156 | } |
1149 | 1157 | ||
1150 | /* print device info to dmesg */ | 1158 | /* print device info to dmesg */ |
1151 | printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors: CHS %d/%d/%d\n", | 1159 | if (print_info) |
1152 | ap->id, dev->devno, | 1160 | printk(KERN_INFO "ata%u: dev %u ATA-%d, " |
1153 | ata_id_major_version(dev->id), | 1161 | "max %s, %Lu sectors: CHS %u/%u/%u\n", |
1154 | ata_mode_string(xfer_modes), | 1162 | ap->id, dev->devno, |
1155 | (unsigned long long)dev->n_sectors, | 1163 | ata_id_major_version(dev->id), |
1156 | (int)dev->cylinders, (int)dev->heads, (int)dev->sectors); | 1164 | ata_mode_string(xfer_modes), |
1157 | 1165 | (unsigned long long)dev->n_sectors, | |
1166 | dev->cylinders, dev->heads, dev->sectors); | ||
1158 | } | 1167 | } |
1159 | 1168 | ||
1160 | dev->cdb_len = 16; | 1169 | dev->cdb_len = 16; |
@@ -1171,9 +1180,9 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev) | |||
1171 | dev->cdb_len = (unsigned int) rc; | 1180 | dev->cdb_len = (unsigned int) rc; |
1172 | 1181 | ||
1173 | /* print device info to dmesg */ | 1182 | /* print device info to dmesg */ |
1174 | printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n", | 1183 | if (print_info) |
1175 | ap->id, dev->devno, | 1184 | printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n", |
1176 | ata_mode_string(xfer_modes)); | 1185 | ap->id, dev->devno, ata_mode_string(xfer_modes)); |
1177 | } | 1186 | } |
1178 | 1187 | ||
1179 | ap->host->max_cmd_len = 0; | 1188 | ap->host->max_cmd_len = 0; |
@@ -1184,8 +1193,9 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev) | |||
1184 | 1193 | ||
1185 | /* limit bridge transfers to udma5, 200 sectors */ | 1194 | /* limit bridge transfers to udma5, 200 sectors */ |
1186 | if (ata_dev_knobble(ap, dev)) { | 1195 | if (ata_dev_knobble(ap, dev)) { |
1187 | printk(KERN_INFO "ata%u(%u): applying bridge limits\n", | 1196 | if (print_info) |
1188 | ap->id, dev->devno); | 1197 | printk(KERN_INFO "ata%u(%u): applying bridge limits\n", |
1198 | ap->id, dev->devno); | ||
1189 | ap->udma_mask &= ATA_UDMA5; | 1199 | ap->udma_mask &= ATA_UDMA5; |
1190 | dev->max_sectors = ATA_MAX_SECTORS; | 1200 | dev->max_sectors = ATA_MAX_SECTORS; |
1191 | } | 1201 | } |
@@ -1263,7 +1273,7 @@ static int ata_bus_probe(struct ata_port *ap) | |||
1263 | continue; | 1273 | continue; |
1264 | } | 1274 | } |
1265 | 1275 | ||
1266 | if (ata_dev_configure(ap, dev)) { | 1276 | if (ata_dev_configure(ap, dev, 1)) { |
1267 | dev->class++; /* disable device */ | 1277 | dev->class++; /* disable device */ |
1268 | continue; | 1278 | continue; |
1269 | } | 1279 | } |