diff options
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r-- | drivers/ide/ide-disk.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 39501d130256..4fb5715eb5d5 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -540,13 +540,13 @@ static int proc_idedisk_read_capacity | |||
540 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 540 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
541 | } | 541 | } |
542 | 542 | ||
543 | static int proc_idedisk_read_smart_thresholds | 543 | static int proc_idedisk_read_smart(char *page, char **start, off_t off, |
544 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 544 | int count, int *eof, void *data, u8 sub_cmd) |
545 | { | 545 | { |
546 | ide_drive_t *drive = (ide_drive_t *)data; | 546 | ide_drive_t *drive = (ide_drive_t *)data; |
547 | int len = 0, i = 0; | 547 | int len = 0, i = 0; |
548 | 548 | ||
549 | if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) { | 549 | if (get_smart_data(drive, page, sub_cmd) == 0) { |
550 | unsigned short *val = (unsigned short *) page; | 550 | unsigned short *val = (unsigned short *) page; |
551 | char *out = ((char *)val) + (SECTOR_WORDS * 4); | 551 | char *out = ((char *)val) + (SECTOR_WORDS * 4); |
552 | page = out; | 552 | page = out; |
@@ -559,31 +559,26 @@ static int proc_idedisk_read_smart_thresholds | |||
559 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 559 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
560 | } | 560 | } |
561 | 561 | ||
562 | static int proc_idedisk_read_smart_values | 562 | static int proc_idedisk_read_sv |
563 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 563 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
564 | { | 564 | { |
565 | ide_drive_t *drive = (ide_drive_t *)data; | 565 | return proc_idedisk_read_smart(page, start, off, count, eof, data, |
566 | int len = 0, i = 0; | 566 | SMART_READ_VALUES); |
567 | } | ||
567 | 568 | ||
568 | if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) { | 569 | static int proc_idedisk_read_st |
569 | unsigned short *val = (unsigned short *) page; | 570 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
570 | char *out = ((char *)val) + (SECTOR_WORDS * 4); | 571 | { |
571 | page = out; | 572 | return proc_idedisk_read_smart(page, start, off, count, eof, data, |
572 | do { | 573 | SMART_READ_THRESHOLDS); |
573 | out += sprintf(out, "%04x%c", le16_to_cpu(*val), (++i & 7) ? ' ' : '\n'); | ||
574 | val += 1; | ||
575 | } while (i < (SECTOR_WORDS * 2)); | ||
576 | len = out - page; | ||
577 | } | ||
578 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | ||
579 | } | 574 | } |
580 | 575 | ||
581 | static ide_proc_entry_t idedisk_proc[] = { | 576 | static ide_proc_entry_t idedisk_proc[] = { |
582 | { "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL }, | 577 | { "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL }, |
583 | { "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL }, | 578 | { "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL }, |
584 | { "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL }, | 579 | { "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL }, |
585 | { "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_smart_values, NULL }, | 580 | { "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_sv, NULL }, |
586 | { "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_smart_thresholds, NULL }, | 581 | { "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_st, NULL }, |
587 | { NULL, 0, NULL, NULL } | 582 | { NULL, 0, NULL, NULL } |
588 | }; | 583 | }; |
589 | #endif /* CONFIG_IDE_PROC_FS */ | 584 | #endif /* CONFIG_IDE_PROC_FS */ |