aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libata-core.c29
-rw-r--r--include/linux/libata.h2
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 9ddb568267e1..7e410299d67a 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -519,6 +519,34 @@ void ata_dev_id_string(const u16 *id, unsigned char *s,
519 } 519 }
520} 520}
521 521
522/**
523 * ata_dev_id_c_string - Convert IDENTIFY DEVICE page into C string
524 * @id: IDENTIFY DEVICE results we will examine
525 * @s: string into which data is output
526 * @ofs: offset into identify device page
527 * @len: length of string to return. must be an odd number.
528 *
529 * This function is identical to ata_dev_id_string except that it
530 * trims trailing spaces and terminates the resulting string with
531 * null. @len must be actual maximum length (even number) + 1.
532 *
533 * LOCKING:
534 * caller.
535 */
536void ata_dev_id_c_string(const u16 *id, unsigned char *s,
537 unsigned int ofs, unsigned int len)
538{
539 unsigned char *p;
540
541 WARN_ON(!(len & 1));
542
543 ata_dev_id_string(id, s, ofs, len - 1);
544
545 p = s + strnlen(s, len - 1);
546 while (p > s && p[-1] == ' ')
547 p--;
548 *p = '\0';
549}
522 550
523/** 551/**
524 * ata_noop_dev_select - Select device 0/1 on ATA bus 552 * ata_noop_dev_select - Select device 0/1 on ATA bus
@@ -4905,6 +4933,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_release);
4905EXPORT_SYMBOL_GPL(ata_host_intr); 4933EXPORT_SYMBOL_GPL(ata_host_intr);
4906EXPORT_SYMBOL_GPL(ata_dev_classify); 4934EXPORT_SYMBOL_GPL(ata_dev_classify);
4907EXPORT_SYMBOL_GPL(ata_dev_id_string); 4935EXPORT_SYMBOL_GPL(ata_dev_id_string);
4936EXPORT_SYMBOL_GPL(ata_dev_id_c_string);
4908EXPORT_SYMBOL_GPL(ata_dev_config); 4937EXPORT_SYMBOL_GPL(ata_dev_config);
4909EXPORT_SYMBOL_GPL(ata_scsi_simulate); 4938EXPORT_SYMBOL_GPL(ata_scsi_simulate);
4910EXPORT_SYMBOL_GPL(ata_eh_qc_complete); 4939EXPORT_SYMBOL_GPL(ata_eh_qc_complete);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 83a1f2ead861..0853032673b7 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -540,6 +540,8 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
540extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 540extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
541extern void ata_dev_id_string(const u16 *id, unsigned char *s, 541extern void ata_dev_id_string(const u16 *id, unsigned char *s,
542 unsigned int ofs, unsigned int len); 542 unsigned int ofs, unsigned int len);
543extern void ata_dev_id_c_string(const u16 *id, unsigned char *s,
544 unsigned int ofs, unsigned int len);
543extern void ata_dev_config(struct ata_port *ap, unsigned int i); 545extern void ata_dev_config(struct ata_port *ap, unsigned int i);
544extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 546extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
545extern void ata_bmdma_start (struct ata_queued_cmd *qc); 547extern void ata_bmdma_start (struct ata_queued_cmd *qc);