diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-15 10:01:16 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-15 10:01:16 -0700 |
commit | 0cb583fd2862f19ea88b02eb307d11c09e51e2f8 (patch) | |
tree | 740769ab145ed72af4d00ea8e4d55ebcef337fce /drivers/ide/ide-cd.c | |
parent | 723e9db7a46e328527cc3da2b478b831184fe828 (diff) | |
parent | a2d10568fd3965fffeb29a3a6f29966dd3801727 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-next-2.6:
ide: fixup for fujitsu disk
ide: convert to ->proc_fops
at91_ide: remove headers specific for at91sam9263
IDE: palm_bk3710: convert clock usage after clkdev conversion
ide: fix races in handling of user-space SET XFER commands
ide: allow ide_dev_read_id() to be called from the IRQ context
ide: ide-taskfile.c fix style problems
drivers/ide/ide-cd.c: Use DIV_ROUND_CLOSEST
ide-tape: fix handling of postponed rqs
ide-tape: convert to ide_debug_log macro
ide-tape: fix debug call
ide: Fix annoying warning in ide_pio_bytes().
IDE: Save a call to PageHighMem()
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 6a9a769bffc..b79ca419d8d 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -30,6 +30,7 @@ #include <linux/kernel.h> #include <linux/delay.h> #include <linux/timer.h> +#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/errno.h> @@ -1146,8 +1147,8 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf) ide_debug_log(IDE_DBG_PROBE, "curspeed: %u, maxspeed: %u", curspeed, maxspeed); - cd->current_speed = (curspeed + (176/2)) / 176; - cd->max_speed = (maxspeed + (176/2)) / 176; + cd->current_speed = DIV_ROUND_CLOSEST(curspeed, 176); + cd->max_speed = DIV_ROUND_CLOSEST(maxspeed, 176); } #define IDE_CD_CAPABILITIES \ @@ -1389,19 +1390,30 @@ static sector_t ide_cdrom_capacity(ide_drive_t *drive) return capacity * sectors_per_frame; } -static int proc_idecd_read_capacity(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int idecd_capacity_proc_show(struct seq_file *m, void *v) { - ide_drive_t *drive = data; - int len; + ide_drive_t *drive = m->private; - len = sprintf(page, "%llu\n", (long long)ide_cdrom_capacity(drive)); - PROC_IDE_READ_RETURN(page, start, off, count, eof, len); + seq_printf(m, "%llu\n", (long long)ide_cdrom_capacity(drive)); + return 0; +} + +static int idecd_capacity_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, idecd_capacity_proc_show, PDE(inode)->data); } +static const struct file_operations idecd_capacity_proc_fops = { + .owner = THIS_MODULE, + .open = idecd_capacity_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static ide_proc_entry_t idecd_proc[] = { - { "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL }, - { NULL, 0, NULL, NULL } + { "capacity", S_IFREG|S_IRUGO, &idecd_capacity_proc_fops }, + {} }; static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive) |