Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-next-2.6
Browse files Browse the repository at this point in the history
* 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()
  • Loading branch information
Linus Torvalds committed Sep 15, 2009
2 parents 723e9db + a2d1056 commit 0cb583f
Show file tree
Hide file tree
Showing 12 changed files with 522 additions and 385 deletions.
2 changes: 0 additions & 2 deletions drivers/ide/at91_ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@

#include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9263.h>
#include <mach/at91sam9_smc.h>
#include <mach/at91sam9263_matrix.h>

#define DRV_NAME "at91_ide"

Expand Down
32 changes: 22 additions & 10 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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)
Expand Down
129 changes: 85 additions & 44 deletions drivers/ide/ide-disk_proc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/seq_file.h>

#include "ide-disk.h"

Expand Down Expand Up @@ -37,77 +38,117 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
return ide_raw_taskfile(drive, &cmd, buf, 1);
}

static int proc_idedisk_read_cache
(char *page, char **start, off_t off, int count, int *eof, void *data)
static int idedisk_cache_proc_show(struct seq_file *m, void *v)
{
ide_drive_t *drive = (ide_drive_t *) data;
char *out = page;
int len;
ide_drive_t *drive = (ide_drive_t *) m->private;

if (drive->dev_flags & IDE_DFLAG_ID_READ)
len = sprintf(out, "%i\n", drive->id[ATA_ID_BUF_SIZE] / 2);
seq_printf(m, "%i\n", drive->id[ATA_ID_BUF_SIZE] / 2);
else
len = sprintf(out, "(none)\n");
seq_printf(m, "(none)\n");
return 0;
}

PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
static int idedisk_cache_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, idedisk_cache_proc_show, PDE(inode)->data);
}

static int proc_idedisk_read_capacity
(char *page, char **start, off_t off, int count, int *eof, void *data)
static const struct file_operations idedisk_cache_proc_fops = {
.owner = THIS_MODULE,
.open = idedisk_cache_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

static int idedisk_capacity_proc_show(struct seq_file *m, void *v)
{
ide_drive_t*drive = (ide_drive_t *)data;
int len;
ide_drive_t*drive = (ide_drive_t *)m->private;

len = sprintf(page, "%llu\n", (long long)ide_gd_capacity(drive));
seq_printf(m, "%llu\n", (long long)ide_gd_capacity(drive));
return 0;
}

PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
static int idedisk_capacity_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, idedisk_capacity_proc_show, PDE(inode)->data);
}

static int proc_idedisk_read_smart(char *page, char **start, off_t off,
int count, int *eof, void *data, u8 sub_cmd)
static const struct file_operations idedisk_capacity_proc_fops = {
.owner = THIS_MODULE,
.open = idedisk_capacity_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

static int __idedisk_proc_show(struct seq_file *m, ide_drive_t *drive, u8 sub_cmd)
{
ide_drive_t *drive = (ide_drive_t *)data;
int len = 0, i = 0;
u8 *buf;

buf = kmalloc(SECTOR_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;

(void)smart_enable(drive);

if (get_smart_data(drive, page, sub_cmd) == 0) {
unsigned short *val = (unsigned short *) page;
char *out = (char *)val + SECTOR_SIZE;

page = out;
do {
out += sprintf(out, "%04x%c", le16_to_cpu(*val),
(++i & 7) ? ' ' : '\n');
val += 1;
} while (i < SECTOR_SIZE / 2);
len = out - page;
if (get_smart_data(drive, buf, sub_cmd) == 0) {
__le16 *val = (__le16 *)buf;
int i;

for (i = 0; i < SECTOR_SIZE / 2; i++) {
seq_printf(m, "%04x%c", le16_to_cpu(val[i]),
(i % 8) == 7 ? '\n' : ' ');
}
}
kfree(buf);
return 0;
}

PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
static int idedisk_sv_proc_show(struct seq_file *m, void *v)
{
return __idedisk_proc_show(m, m->private, ATA_SMART_READ_VALUES);
}

static int proc_idedisk_read_sv
(char *page, char **start, off_t off, int count, int *eof, void *data)
static int idedisk_sv_proc_open(struct inode *inode, struct file *file)
{
return proc_idedisk_read_smart(page, start, off, count, eof, data,
ATA_SMART_READ_VALUES);
return single_open(file, idedisk_sv_proc_show, PDE(inode)->data);
}

static int proc_idedisk_read_st
(char *page, char **start, off_t off, int count, int *eof, void *data)
static const struct file_operations idedisk_sv_proc_fops = {
.owner = THIS_MODULE,
.open = idedisk_sv_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

static int idedisk_st_proc_show(struct seq_file *m, void *v)
{
return proc_idedisk_read_smart(page, start, off, count, eof, data,
ATA_SMART_READ_THRESHOLDS);
return __idedisk_proc_show(m, m->private, ATA_SMART_READ_THRESHOLDS);
}

static int idedisk_st_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, idedisk_st_proc_show, PDE(inode)->data);
}

static const struct file_operations idedisk_st_proc_fops = {
.owner = THIS_MODULE,
.open = idedisk_st_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

ide_proc_entry_t ide_disk_proc[] = {
{ "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL },
{ "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL },
{ "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL },
{ "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_sv, NULL },
{ "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_st, NULL },
{ NULL, 0, NULL, NULL }
{ "cache", S_IFREG|S_IRUGO, &idedisk_cache_proc_fops },
{ "capacity", S_IFREG|S_IRUGO, &idedisk_capacity_proc_fops },
{ "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops },
{ "smart_values", S_IFREG|S_IRUSR, &idedisk_sv_proc_fops },
{ "smart_thresholds", S_IFREG|S_IRUSR, &idedisk_st_proc_fops },
{}
};

ide_devset_rw_field(bios_cyl, bios_cyl);
Expand Down
30 changes: 21 additions & 9 deletions drivers/ide/ide-floppy_proc.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/seq_file.h>

#include "ide-floppy.h"

static int proc_idefloppy_read_capacity(char *page, char **start, off_t off,
int count, int *eof, void *data)
static int idefloppy_capacity_proc_show(struct seq_file *m, void *v)
{
ide_drive_t*drive = (ide_drive_t *)data;
int len;
ide_drive_t*drive = (ide_drive_t *)m->private;

len = sprintf(page, "%llu\n", (long long)ide_gd_capacity(drive));
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
seq_printf(m, "%llu\n", (long long)ide_gd_capacity(drive));
return 0;
}

static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, idefloppy_capacity_proc_show, PDE(inode)->data);
}

static const struct file_operations idefloppy_capacity_proc_fops = {
.owner = THIS_MODULE,
.open = idefloppy_capacity_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

ide_proc_entry_t ide_floppy_proc[] = {
{ "capacity", S_IFREG|S_IRUGO, proc_idefloppy_read_capacity, NULL },
{ "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL },
{ NULL, 0, NULL, NULL }
{ "capacity", S_IFREG|S_IRUGO, &idefloppy_capacity_proc_fops },
{ "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops },
{}
};

ide_devset_rw_field(bios_cyl, bios_cyl);
Expand Down
8 changes: 2 additions & 6 deletions drivers/ide/ide-ioctls.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,15 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
err = -EINVAL;
goto abort;
}

cmd.tf_flags |= IDE_TFLAG_SET_XFER;
}

err = ide_raw_taskfile(drive, &cmd, buf, args[3]);

args[0] = tf->status;
args[1] = tf->error;
args[2] = tf->nsect;

if (!err && xfer_rate) {
/* active-retuning-calls future */
ide_set_xfer_rate(drive, xfer_rate);
ide_driveid_update(drive);
}
abort:
if (copy_to_user((void __user *)arg, &args, 4))
err = -EFAULT;
Expand Down
17 changes: 4 additions & 13 deletions drivers/ide/ide-iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ EXPORT_SYMBOL(ide_fixstring);
* setting a timer to wake up at half second intervals thereafter,
* until timeout is achieved, before timing out.
*/
static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad,
unsigned long timeout, u8 *rstat)
int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad,
unsigned long timeout, u8 *rstat)
{
ide_hwif_t *hwif = drive->hwif;
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
Expand Down Expand Up @@ -292,6 +292,7 @@ static const char *nien_quirk_list[] = {
"QUANTUM FIREBALLP KX27.3",
"QUANTUM FIREBALLP LM20.4",
"QUANTUM FIREBALLP LM20.5",
"FUJITSU MHZ2160BH G2",
NULL
};

Expand All @@ -316,7 +317,7 @@ int ide_driveid_update(ide_drive_t *drive)
return 0;

SELECT_MASK(drive, 1);
rc = ide_dev_read_id(drive, ATA_CMD_ID_ATA, id);
rc = ide_dev_read_id(drive, ATA_CMD_ID_ATA, id, 1);
SELECT_MASK(drive, 0);

if (rc)
Expand Down Expand Up @@ -363,14 +364,6 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
* this point (lost interrupt).
*/

/*
* FIXME: we race against the running IRQ here if
* this is called from non IRQ context. If we use
* disable_irq() we hang on the error path. Work
* is needed.
*/
disable_irq_nosync(hwif->irq);

udelay(1);
tp_ops->dev_select(drive);
SELECT_MASK(drive, 1);
Expand All @@ -394,8 +387,6 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)

SELECT_MASK(drive, 0);

enable_irq(hwif->irq);

if (error) {
(void) ide_dump_status(drive, "set_drive_speed_status", stat);
return error;
Expand Down
Loading

0 comments on commit 0cb583f

Please sign in to comment.