diff options
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 6a9a769bffc1..b79ca419d8d9 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
33 | #include <linux/seq_file.h> | ||
33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
34 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
35 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
@@ -1146,8 +1147,8 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf) | |||
1146 | ide_debug_log(IDE_DBG_PROBE, "curspeed: %u, maxspeed: %u", | 1147 | ide_debug_log(IDE_DBG_PROBE, "curspeed: %u, maxspeed: %u", |
1147 | curspeed, maxspeed); | 1148 | curspeed, maxspeed); |
1148 | 1149 | ||
1149 | cd->current_speed = (curspeed + (176/2)) / 176; | 1150 | cd->current_speed = DIV_ROUND_CLOSEST(curspeed, 176); |
1150 | cd->max_speed = (maxspeed + (176/2)) / 176; | 1151 | cd->max_speed = DIV_ROUND_CLOSEST(maxspeed, 176); |
1151 | } | 1152 | } |
1152 | 1153 | ||
1153 | #define IDE_CD_CAPABILITIES \ | 1154 | #define IDE_CD_CAPABILITIES \ |
@@ -1389,19 +1390,30 @@ static sector_t ide_cdrom_capacity(ide_drive_t *drive) | |||
1389 | return capacity * sectors_per_frame; | 1390 | return capacity * sectors_per_frame; |
1390 | } | 1391 | } |
1391 | 1392 | ||
1392 | static int proc_idecd_read_capacity(char *page, char **start, off_t off, | 1393 | static int idecd_capacity_proc_show(struct seq_file *m, void *v) |
1393 | int count, int *eof, void *data) | ||
1394 | { | 1394 | { |
1395 | ide_drive_t *drive = data; | 1395 | ide_drive_t *drive = m->private; |
1396 | int len; | ||
1397 | 1396 | ||
1398 | len = sprintf(page, "%llu\n", (long long)ide_cdrom_capacity(drive)); | 1397 | seq_printf(m, "%llu\n", (long long)ide_cdrom_capacity(drive)); |
1399 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); | 1398 | return 0; |
1399 | } | ||
1400 | |||
1401 | static int idecd_capacity_proc_open(struct inode *inode, struct file *file) | ||
1402 | { | ||
1403 | return single_open(file, idecd_capacity_proc_show, PDE(inode)->data); | ||
1400 | } | 1404 | } |
1401 | 1405 | ||
1406 | static const struct file_operations idecd_capacity_proc_fops = { | ||
1407 | .owner = THIS_MODULE, | ||
1408 | .open = idecd_capacity_proc_open, | ||
1409 | .read = seq_read, | ||
1410 | .llseek = seq_lseek, | ||
1411 | .release = single_release, | ||
1412 | }; | ||
1413 | |||
1402 | static ide_proc_entry_t idecd_proc[] = { | 1414 | static ide_proc_entry_t idecd_proc[] = { |
1403 | { "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL }, | 1415 | { "capacity", S_IFREG|S_IRUGO, &idecd_capacity_proc_fops }, |
1404 | { NULL, 0, NULL, NULL } | 1416 | {} |
1405 | }; | 1417 | }; |
1406 | 1418 | ||
1407 | static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive) | 1419 | static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive) |