Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cb583fd authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 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()
parents 723e9db7 a2d10568
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -29,9 +29,7 @@


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


#define DRV_NAME "at91_ide"
#define DRV_NAME "at91_ide"


+22 −10
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/timer.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/errno.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",
	ide_debug_log(IDE_DBG_PROBE, "curspeed: %u, maxspeed: %u",
				     curspeed, maxspeed);
				     curspeed, maxspeed);


	cd->current_speed = (curspeed + (176/2)) / 176;
	cd->current_speed = DIV_ROUND_CLOSEST(curspeed, 176);
	cd->max_speed = (maxspeed + (176/2)) / 176;
	cd->max_speed = DIV_ROUND_CLOSEST(maxspeed, 176);
}
}


#define IDE_CD_CAPABILITIES \
#define IDE_CD_CAPABILITIES \
@@ -1389,19 +1390,30 @@ static sector_t ide_cdrom_capacity(ide_drive_t *drive)
	return capacity * sectors_per_frame;
	return capacity * sectors_per_frame;
}
}


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


	len = sprintf(page, "%llu\n", (long long)ide_cdrom_capacity(drive));
	seq_printf(m, "%llu\n", (long long)ide_cdrom_capacity(drive));
	PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
	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[] = {
static ide_proc_entry_t idecd_proc[] = {
	{ "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL },
	{ "capacity", S_IFREG|S_IRUGO, &idecd_capacity_proc_fops },
	{ NULL, 0, NULL, NULL }
	{}
};
};


static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)
static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)
+85 −44
Original line number Original line Diff line number Diff line
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/ide.h>
#include <linux/seq_file.h>


#include "ide-disk.h"
#include "ide-disk.h"


@@ -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);
	return ide_raw_taskfile(drive, &cmd, buf, 1);
}
}


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


	if (drive->dev_flags & IDE_DFLAG_ID_READ)
	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
	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
static const struct file_operations idedisk_cache_proc_fops = {
	(char *page, char **start, off_t off, int count, int *eof, void *data)
	.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;
	ide_drive_t*drive = (ide_drive_t *)m->private;
	int len;


	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,
static const struct file_operations idedisk_capacity_proc_fops = {
				   int count, int *eof, void *data, u8 sub_cmd)
	.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;
	u8 *buf;
	int		len = 0, i = 0;

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


	(void)smart_enable(drive);
	(void)smart_enable(drive);


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


		page = out;
		for (i = 0; i < SECTOR_SIZE / 2; i++) {
		do {
			seq_printf(m, "%04x%c", le16_to_cpu(val[i]),
			out += sprintf(out, "%04x%c", le16_to_cpu(*val),
					(i % 8) == 7 ? '\n' : ' ');
				       (++i & 7) ? ' ' : '\n');
		}
			val += 1;
	}
		} while (i < SECTOR_SIZE / 2);
	kfree(buf);
		len = out - page;
	return 0;
}

static int idedisk_sv_proc_show(struct seq_file *m, void *v)
{
	return __idedisk_proc_show(m, m->private, ATA_SMART_READ_VALUES);
}
}


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


static int proc_idedisk_read_sv
static const struct file_operations idedisk_sv_proc_fops = {
	(char *page, char **start, off_t off, int count, int *eof, void *data)
	.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,
	return __idedisk_proc_show(m, m->private, ATA_SMART_READ_THRESHOLDS);
				       ATA_SMART_READ_VALUES);
}
}


static int proc_idedisk_read_st
static int idedisk_st_proc_open(struct inode *inode, struct file *file)
	(char *page, char **start, off_t off, int count, int *eof, void *data)
{
{
	return proc_idedisk_read_smart(page, start, off, count, eof, data,
	return single_open(file, idedisk_st_proc_show, PDE(inode)->data);
				       ATA_SMART_READ_THRESHOLDS);
}
}


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


ide_devset_rw_field(bios_cyl, bios_cyl);
ide_devset_rw_field(bios_cyl, bios_cyl);
+21 −9
Original line number Original line Diff line number Diff line
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/ide.h>
#include <linux/seq_file.h>


#include "ide-floppy.h"
#include "ide-floppy.h"


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


	len = sprintf(page, "%llu\n", (long long)ide_gd_capacity(drive));
	seq_printf(m, "%llu\n", (long long)ide_gd_capacity(drive));
	PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
	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[] = {
ide_proc_entry_t ide_floppy_proc[] = {
	{ "capacity",	S_IFREG|S_IRUGO, proc_idefloppy_read_capacity,	NULL },
	{ "capacity",	S_IFREG|S_IRUGO, &idefloppy_capacity_proc_fops	},
	{ "geometry",	S_IFREG|S_IRUGO, proc_ide_read_geometry,	NULL },
	{ "geometry",	S_IFREG|S_IRUGO, &ide_geometry_proc_fops	},
	{ NULL, 0, NULL, NULL }
	{}
};
};


ide_devset_rw_field(bios_cyl, bios_cyl);
ide_devset_rw_field(bios_cyl, bios_cyl);
+2 −6
Original line number Original line Diff line number Diff line
@@ -167,6 +167,8 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
			err = -EINVAL;
			err = -EINVAL;
			goto abort;
			goto abort;
		}
		}

		cmd.tf_flags |= IDE_TFLAG_SET_XFER;
	}
	}


	err = ide_raw_taskfile(drive, &cmd, buf, args[3]);
	err = ide_raw_taskfile(drive, &cmd, buf, args[3]);
@@ -174,12 +176,6 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
	args[0] = tf->status;
	args[0] = tf->status;
	args[1] = tf->error;
	args[1] = tf->error;
	args[2] = tf->nsect;
	args[2] = tf->nsect;

	if (!err && xfer_rate) {
		/* active-retuning-calls future */
		ide_set_xfer_rate(drive, xfer_rate);
		ide_driveid_update(drive);
	}
abort:
abort:
	if (copy_to_user((void __user *)arg, &args, 4))
	if (copy_to_user((void __user *)arg, &args, 4))
		err = -EFAULT;
		err = -EFAULT;
Loading