Skip to content

Commit 0cb583f

Browse files
committed
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()
2 parents 723e9db + a2d1056 commit 0cb583f

File tree

12 files changed

+522
-385
lines changed

12 files changed

+522
-385
lines changed

drivers/ide/at91_ide.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929

3030
#include <mach/board.h>
3131
#include <mach/gpio.h>
32-
#include <mach/at91sam9263.h>
3332
#include <mach/at91sam9_smc.h>
34-
#include <mach/at91sam9263_matrix.h>
3533

3634
#define DRV_NAME "at91_ide"
3735

drivers/ide/ide-cd.c

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/kernel.h>
3131
#include <linux/delay.h>
3232
#include <linux/timer.h>
33+
#include <linux/seq_file.h>
3334
#include <linux/slab.h>
3435
#include <linux/interrupt.h>
3536
#include <linux/errno.h>
@@ -1146,8 +1147,8 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
11461147
ide_debug_log(IDE_DBG_PROBE, "curspeed: %u, maxspeed: %u",
11471148
curspeed, maxspeed);
11481149

1149-
cd->current_speed = (curspeed + (176/2)) / 176;
1150-
cd->max_speed = (maxspeed + (176/2)) / 176;
1150+
cd->current_speed = DIV_ROUND_CLOSEST(curspeed, 176);
1151+
cd->max_speed = DIV_ROUND_CLOSEST(maxspeed, 176);
11511152
}
11521153

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

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

1398-
len = sprintf(page, "%llu\n", (long long)ide_cdrom_capacity(drive));
1399-
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
1397+
seq_printf(m, "%llu\n", (long long)ide_cdrom_capacity(drive));
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);
14001404
}
14011405

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+
14021414
static ide_proc_entry_t idecd_proc[] = {
1403-
{ "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL },
1404-
{ NULL, 0, NULL, NULL }
1415+
{ "capacity", S_IFREG|S_IRUGO, &idecd_capacity_proc_fops },
1416+
{}
14051417
};
14061418

14071419
static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)

drivers/ide/ide-disk_proc.c

Lines changed: 85 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <linux/kernel.h>
22
#include <linux/ide.h>
3+
#include <linux/seq_file.h>
34

45
#include "ide-disk.h"
56

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

40-
static int proc_idedisk_read_cache
41-
(char *page, char **start, off_t off, int count, int *eof, void *data)
41+
static int idedisk_cache_proc_show(struct seq_file *m, void *v)
4242
{
43-
ide_drive_t *drive = (ide_drive_t *) data;
44-
char *out = page;
45-
int len;
43+
ide_drive_t *drive = (ide_drive_t *) m->private;
4644

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

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

55-
static int proc_idedisk_read_capacity
56-
(char *page, char **start, off_t off, int count, int *eof, void *data)
57+
static const struct file_operations idedisk_cache_proc_fops = {
58+
.owner = THIS_MODULE,
59+
.open = idedisk_cache_proc_open,
60+
.read = seq_read,
61+
.llseek = seq_lseek,
62+
.release = single_release,
63+
};
64+
65+
static int idedisk_capacity_proc_show(struct seq_file *m, void *v)
5766
{
58-
ide_drive_t*drive = (ide_drive_t *)data;
59-
int len;
67+
ide_drive_t*drive = (ide_drive_t *)m->private;
6068

61-
len = sprintf(page, "%llu\n", (long long)ide_gd_capacity(drive));
69+
seq_printf(m, "%llu\n", (long long)ide_gd_capacity(drive));
70+
return 0;
71+
}
6272

63-
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
73+
static int idedisk_capacity_proc_open(struct inode *inode, struct file *file)
74+
{
75+
return single_open(file, idedisk_capacity_proc_show, PDE(inode)->data);
6476
}
6577

66-
static int proc_idedisk_read_smart(char *page, char **start, off_t off,
67-
int count, int *eof, void *data, u8 sub_cmd)
78+
static const struct file_operations idedisk_capacity_proc_fops = {
79+
.owner = THIS_MODULE,
80+
.open = idedisk_capacity_proc_open,
81+
.read = seq_read,
82+
.llseek = seq_lseek,
83+
.release = single_release,
84+
};
85+
86+
static int __idedisk_proc_show(struct seq_file *m, ide_drive_t *drive, u8 sub_cmd)
6887
{
69-
ide_drive_t *drive = (ide_drive_t *)data;
70-
int len = 0, i = 0;
88+
u8 *buf;
89+
90+
buf = kmalloc(SECTOR_SIZE, GFP_KERNEL);
91+
if (!buf)
92+
return -ENOMEM;
7193

7294
(void)smart_enable(drive);
7395

74-
if (get_smart_data(drive, page, sub_cmd) == 0) {
75-
unsigned short *val = (unsigned short *) page;
76-
char *out = (char *)val + SECTOR_SIZE;
77-
78-
page = out;
79-
do {
80-
out += sprintf(out, "%04x%c", le16_to_cpu(*val),
81-
(++i & 7) ? ' ' : '\n');
82-
val += 1;
83-
} while (i < SECTOR_SIZE / 2);
84-
len = out - page;
96+
if (get_smart_data(drive, buf, sub_cmd) == 0) {
97+
__le16 *val = (__le16 *)buf;
98+
int i;
99+
100+
for (i = 0; i < SECTOR_SIZE / 2; i++) {
101+
seq_printf(m, "%04x%c", le16_to_cpu(val[i]),
102+
(i % 8) == 7 ? '\n' : ' ');
103+
}
85104
}
105+
kfree(buf);
106+
return 0;
107+
}
86108

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

90-
static int proc_idedisk_read_sv
91-
(char *page, char **start, off_t off, int count, int *eof, void *data)
114+
static int idedisk_sv_proc_open(struct inode *inode, struct file *file)
92115
{
93-
return proc_idedisk_read_smart(page, start, off, count, eof, data,
94-
ATA_SMART_READ_VALUES);
116+
return single_open(file, idedisk_sv_proc_show, PDE(inode)->data);
95117
}
96118

97-
static int proc_idedisk_read_st
98-
(char *page, char **start, off_t off, int count, int *eof, void *data)
119+
static const struct file_operations idedisk_sv_proc_fops = {
120+
.owner = THIS_MODULE,
121+
.open = idedisk_sv_proc_open,
122+
.read = seq_read,
123+
.llseek = seq_lseek,
124+
.release = single_release,
125+
};
126+
127+
static int idedisk_st_proc_show(struct seq_file *m, void *v)
99128
{
100-
return proc_idedisk_read_smart(page, start, off, count, eof, data,
101-
ATA_SMART_READ_THRESHOLDS);
129+
return __idedisk_proc_show(m, m->private, ATA_SMART_READ_THRESHOLDS);
102130
}
103131

132+
static int idedisk_st_proc_open(struct inode *inode, struct file *file)
133+
{
134+
return single_open(file, idedisk_st_proc_show, PDE(inode)->data);
135+
}
136+
137+
static const struct file_operations idedisk_st_proc_fops = {
138+
.owner = THIS_MODULE,
139+
.open = idedisk_st_proc_open,
140+
.read = seq_read,
141+
.llseek = seq_lseek,
142+
.release = single_release,
143+
};
144+
104145
ide_proc_entry_t ide_disk_proc[] = {
105-
{ "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL },
106-
{ "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL },
107-
{ "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL },
108-
{ "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_sv, NULL },
109-
{ "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_st, NULL },
110-
{ NULL, 0, NULL, NULL }
146+
{ "cache", S_IFREG|S_IRUGO, &idedisk_cache_proc_fops },
147+
{ "capacity", S_IFREG|S_IRUGO, &idedisk_capacity_proc_fops },
148+
{ "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops },
149+
{ "smart_values", S_IFREG|S_IRUSR, &idedisk_sv_proc_fops },
150+
{ "smart_thresholds", S_IFREG|S_IRUSR, &idedisk_st_proc_fops },
151+
{}
111152
};
112153

113154
ide_devset_rw_field(bios_cyl, bios_cyl);

drivers/ide/ide-floppy_proc.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
#include <linux/kernel.h>
22
#include <linux/ide.h>
3+
#include <linux/seq_file.h>
34

45
#include "ide-floppy.h"
56

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

12-
len = sprintf(page, "%llu\n", (long long)ide_gd_capacity(drive));
13-
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
11+
seq_printf(m, "%llu\n", (long long)ide_gd_capacity(drive));
12+
return 0;
1413
}
1514

15+
static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file)
16+
{
17+
return single_open(file, idefloppy_capacity_proc_show, PDE(inode)->data);
18+
}
19+
20+
static const struct file_operations idefloppy_capacity_proc_fops = {
21+
.owner = THIS_MODULE,
22+
.open = idefloppy_capacity_proc_open,
23+
.read = seq_read,
24+
.llseek = seq_lseek,
25+
.release = single_release,
26+
};
27+
1628
ide_proc_entry_t ide_floppy_proc[] = {
17-
{ "capacity", S_IFREG|S_IRUGO, proc_idefloppy_read_capacity, NULL },
18-
{ "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL },
19-
{ NULL, 0, NULL, NULL }
29+
{ "capacity", S_IFREG|S_IRUGO, &idefloppy_capacity_proc_fops },
30+
{ "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops },
31+
{}
2032
};
2133

2234
ide_devset_rw_field(bios_cyl, bios_cyl);

drivers/ide/ide-ioctls.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,15 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
167167
err = -EINVAL;
168168
goto abort;
169169
}
170+
171+
cmd.tf_flags |= IDE_TFLAG_SET_XFER;
170172
}
171173

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

174176
args[0] = tf->status;
175177
args[1] = tf->error;
176178
args[2] = tf->nsect;
177-
178-
if (!err && xfer_rate) {
179-
/* active-retuning-calls future */
180-
ide_set_xfer_rate(drive, xfer_rate);
181-
ide_driveid_update(drive);
182-
}
183179
abort:
184180
if (copy_to_user((void __user *)arg, &args, 4))
185181
err = -EFAULT;

drivers/ide/ide-iops.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ EXPORT_SYMBOL(ide_fixstring);
102102
* setting a timer to wake up at half second intervals thereafter,
103103
* until timeout is achieved, before timing out.
104104
*/
105-
static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad,
106-
unsigned long timeout, u8 *rstat)
105+
int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad,
106+
unsigned long timeout, u8 *rstat)
107107
{
108108
ide_hwif_t *hwif = drive->hwif;
109109
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
@@ -292,6 +292,7 @@ static const char *nien_quirk_list[] = {
292292
"QUANTUM FIREBALLP KX27.3",
293293
"QUANTUM FIREBALLP LM20.4",
294294
"QUANTUM FIREBALLP LM20.5",
295+
"FUJITSU MHZ2160BH G2",
295296
NULL
296297
};
297298

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

318319
SELECT_MASK(drive, 1);
319-
rc = ide_dev_read_id(drive, ATA_CMD_ID_ATA, id);
320+
rc = ide_dev_read_id(drive, ATA_CMD_ID_ATA, id, 1);
320321
SELECT_MASK(drive, 0);
321322

322323
if (rc)
@@ -363,14 +364,6 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
363364
* this point (lost interrupt).
364365
*/
365366

366-
/*
367-
* FIXME: we race against the running IRQ here if
368-
* this is called from non IRQ context. If we use
369-
* disable_irq() we hang on the error path. Work
370-
* is needed.
371-
*/
372-
disable_irq_nosync(hwif->irq);
373-
374367
udelay(1);
375368
tp_ops->dev_select(drive);
376369
SELECT_MASK(drive, 1);
@@ -394,8 +387,6 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
394387

395388
SELECT_MASK(drive, 0);
396389

397-
enable_irq(hwif->irq);
398-
399390
if (error) {
400391
(void) ide_dump_status(drive, "set_drive_speed_status", stat);
401392
return error;

0 commit comments

Comments
 (0)