| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | *  Copyright (C) 1997-1998	Mark Lord | 
| Alan Cox | ccd32e2 | 2008-11-02 21:40:08 +0100 | [diff] [blame] | 3 | *  Copyright (C) 2003		Red Hat | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 4 | * | 
|  | 5 | *  Some code was moved here from ide.c, see it for original copyrights. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ | 
|  | 7 |  | 
|  | 8 | /* | 
|  | 9 | * This is the /proc/ide/ filesystem implementation. | 
|  | 10 | * | 
|  | 11 | * Drive/Driver settings can be retrieved by reading the drive's | 
|  | 12 | * "settings" files.  e.g.    "cat /proc/ide0/hda/settings" | 
|  | 13 | * To write a new value "val" into a specific setting "name", use: | 
|  | 14 | *   echo "name:val" >/proc/ide/ide0/hda/settings | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | */ | 
|  | 16 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/module.h> | 
|  | 18 |  | 
|  | 19 | #include <asm/uaccess.h> | 
|  | 20 | #include <linux/errno.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <linux/proc_fs.h> | 
|  | 22 | #include <linux/stat.h> | 
|  | 23 | #include <linux/mm.h> | 
|  | 24 | #include <linux/pci.h> | 
|  | 25 | #include <linux/ctype.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/ide.h> | 
|  | 27 | #include <linux/seq_file.h> | 
| Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 28 | #include <linux/slab.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 |  | 
|  | 30 | #include <asm/io.h> | 
|  | 31 |  | 
| Bartlomiej Zolnierkiewicz | 5cbf79c | 2007-05-10 00:01:11 +0200 | [diff] [blame] | 32 | static struct proc_dir_entry *proc_ide_root; | 
|  | 33 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 34 | static int ide_imodel_proc_show(struct seq_file *m, void *v) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 36 | ide_hwif_t	*hwif = (ide_hwif_t *) m->private; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | const char	*name; | 
|  | 38 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | switch (hwif->chipset) { | 
| Paolo Ciarrocchi | 441e92d | 2008-04-26 17:36:40 +0200 | [diff] [blame] | 40 | case ide_generic:	name = "generic";	break; | 
|  | 41 | case ide_pci:		name = "pci";		break; | 
|  | 42 | case ide_cmd640:	name = "cmd640";	break; | 
|  | 43 | case ide_dtc2278:	name = "dtc2278";	break; | 
|  | 44 | case ide_ali14xx:	name = "ali14xx";	break; | 
|  | 45 | case ide_qd65xx:	name = "qd65xx";	break; | 
|  | 46 | case ide_umc8672:	name = "umc8672";	break; | 
|  | 47 | case ide_ht6560b:	name = "ht6560b";	break; | 
| Paolo Ciarrocchi | 441e92d | 2008-04-26 17:36:40 +0200 | [diff] [blame] | 48 | case ide_4drives:	name = "4drives";	break; | 
|  | 49 | case ide_pmac:		name = "mac-io";	break; | 
|  | 50 | case ide_au1xxx:	name = "au1xxx";	break; | 
|  | 51 | case ide_palm3710:      name = "palm3710";      break; | 
| Paolo Ciarrocchi | 441e92d | 2008-04-26 17:36:40 +0200 | [diff] [blame] | 52 | case ide_acorn:		name = "acorn";		break; | 
|  | 53 | default:		name = "(unknown)";	break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | } | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 55 | seq_printf(m, "%s\n", name); | 
|  | 56 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | } | 
|  | 58 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 59 | static int ide_imodel_proc_open(struct inode *inode, struct file *file) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 61 | return single_open(file, ide_imodel_proc_show, PDE(inode)->data); | 
|  | 62 | } | 
|  | 63 |  | 
|  | 64 | static const struct file_operations ide_imodel_proc_fops = { | 
|  | 65 | .owner		= THIS_MODULE, | 
|  | 66 | .open		= ide_imodel_proc_open, | 
|  | 67 | .read		= seq_read, | 
|  | 68 | .llseek		= seq_lseek, | 
|  | 69 | .release	= single_release, | 
|  | 70 | }; | 
|  | 71 |  | 
|  | 72 | static int ide_mate_proc_show(struct seq_file *m, void *v) | 
|  | 73 | { | 
|  | 74 | ide_hwif_t	*hwif = (ide_hwif_t *) m->private; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 |  | 
| Bartlomiej Zolnierkiewicz | 4283e1b | 2008-06-30 20:14:45 +0200 | [diff] [blame] | 76 | if (hwif && hwif->mate) | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 77 | seq_printf(m, "%s\n", hwif->mate->name); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | else | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 79 | seq_printf(m, "(none)\n"); | 
|  | 80 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | } | 
|  | 82 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 83 | static int ide_mate_proc_open(struct inode *inode, struct file *file) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 85 | return single_open(file, ide_mate_proc_show, PDE(inode)->data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | } | 
|  | 87 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 88 | static const struct file_operations ide_mate_proc_fops = { | 
|  | 89 | .owner		= THIS_MODULE, | 
|  | 90 | .open		= ide_mate_proc_open, | 
|  | 91 | .read		= seq_read, | 
|  | 92 | .llseek		= seq_lseek, | 
|  | 93 | .release	= single_release, | 
|  | 94 | }; | 
|  | 95 |  | 
|  | 96 | static int ide_channel_proc_show(struct seq_file *m, void *v) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 98 | ide_hwif_t	*hwif = (ide_hwif_t *) m->private; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 100 | seq_printf(m, "%c\n", hwif->channel ? '1' : '0'); | 
|  | 101 | return 0; | 
|  | 102 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 104 | static int ide_channel_proc_open(struct inode *inode, struct file *file) | 
|  | 105 | { | 
|  | 106 | return single_open(file, ide_channel_proc_show, PDE(inode)->data); | 
|  | 107 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 109 | static const struct file_operations ide_channel_proc_fops = { | 
|  | 110 | .owner		= THIS_MODULE, | 
|  | 111 | .open		= ide_channel_proc_open, | 
|  | 112 | .read		= seq_read, | 
|  | 113 | .llseek		= seq_lseek, | 
|  | 114 | .release	= single_release, | 
|  | 115 | }; | 
| Bartlomiej Zolnierkiewicz | 151a670 | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 116 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 117 | static int ide_identify_proc_show(struct seq_file *m, void *v) | 
|  | 118 | { | 
|  | 119 | ide_drive_t *drive = (ide_drive_t *)m->private; | 
|  | 120 | u8 *buf; | 
|  | 121 |  | 
|  | 122 | if (!drive) { | 
|  | 123 | seq_putc(m, '\n'); | 
|  | 124 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | } | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 126 |  | 
|  | 127 | buf = kmalloc(SECTOR_SIZE, GFP_KERNEL); | 
|  | 128 | if (!buf) | 
|  | 129 | return -ENOMEM; | 
|  | 130 | if (taskfile_lib_get_identify(drive, buf) == 0) { | 
|  | 131 | __le16 *val = (__le16 *)buf; | 
|  | 132 | int i; | 
|  | 133 |  | 
|  | 134 | for (i = 0; i < SECTOR_SIZE / 2; i++) { | 
|  | 135 | seq_printf(m, "%04x%c", le16_to_cpu(val[i]), | 
|  | 136 | (i % 8) == 7 ? '\n' : ' '); | 
|  | 137 | } | 
|  | 138 | } else | 
|  | 139 | seq_putc(m, buf[0]); | 
|  | 140 | kfree(buf); | 
|  | 141 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | } | 
|  | 143 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 144 | static int ide_identify_proc_open(struct inode *inode, struct file *file) | 
|  | 145 | { | 
|  | 146 | return single_open(file, ide_identify_proc_show, PDE(inode)->data); | 
|  | 147 | } | 
|  | 148 |  | 
|  | 149 | static const struct file_operations ide_identify_proc_fops = { | 
|  | 150 | .owner		= THIS_MODULE, | 
|  | 151 | .open		= ide_identify_proc_open, | 
|  | 152 | .read		= seq_read, | 
|  | 153 | .llseek		= seq_lseek, | 
|  | 154 | .release	= single_release, | 
|  | 155 | }; | 
|  | 156 |  | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 157 | /** | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 158 | *	ide_find_setting	-	find a specific setting | 
|  | 159 | *	@st: setting table pointer | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 160 | *	@name: setting name | 
|  | 161 | * | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 162 | *	Scan's the setting table for a matching entry and returns | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 163 | *	this or NULL if no entry is found. The caller must hold the | 
|  | 164 | *	setting semaphore | 
|  | 165 | */ | 
|  | 166 |  | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 167 | static | 
|  | 168 | const struct ide_proc_devset *ide_find_setting(const struct ide_proc_devset *st, | 
|  | 169 | char *name) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 170 | { | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 171 | while (st->name) { | 
|  | 172 | if (strcmp(st->name, name) == 0) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 173 | break; | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 174 | st++; | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 175 | } | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 176 | return st->name ? st : NULL; | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 177 | } | 
|  | 178 |  | 
|  | 179 | /** | 
|  | 180 | *	ide_read_setting	-	read an IDE setting | 
|  | 181 | *	@drive: drive to read from | 
|  | 182 | *	@setting: drive setting | 
|  | 183 | * | 
|  | 184 | *	Read a drive setting and return the value. The caller | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 185 | *	must hold the ide_setting_mtx when making this call. | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 186 | * | 
|  | 187 | *	BUGS: the data return and error are the same return value | 
|  | 188 | *	so an error -EINVAL and true return of the same value cannot | 
|  | 189 | *	be told apart | 
|  | 190 | */ | 
|  | 191 |  | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 192 | static int ide_read_setting(ide_drive_t *drive, | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 193 | const struct ide_proc_devset *setting) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 194 | { | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 195 | const struct ide_devset *ds = setting->setting; | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 196 | int val = -EINVAL; | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 197 |  | 
| Bartlomiej Zolnierkiewicz | 1f473e9 | 2008-12-29 20:27:29 +0100 | [diff] [blame] | 198 | if (ds->get) | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 199 | val = ds->get(drive); | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 200 |  | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 201 | return val; | 
|  | 202 | } | 
|  | 203 |  | 
|  | 204 | /** | 
|  | 205 | *	ide_write_setting	-	read an IDE setting | 
|  | 206 | *	@drive: drive to read from | 
|  | 207 | *	@setting: drive setting | 
|  | 208 | *	@val: value | 
|  | 209 | * | 
|  | 210 | *	Write a drive setting if it is possible. The caller | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 211 | *	must hold the ide_setting_mtx when making this call. | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 212 | * | 
|  | 213 | *	BUGS: the data return and error are the same return value | 
|  | 214 | *	so an error -EINVAL and true return of the same value cannot | 
|  | 215 | *	be told apart | 
|  | 216 | * | 
|  | 217 | *	FIXME:  This should be changed to enqueue a special request | 
|  | 218 | *	to the driver to change settings, and then wait on a sema for completion. | 
|  | 219 | *	The current scheme of polling is kludgy, though safe enough. | 
|  | 220 | */ | 
|  | 221 |  | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 222 | static int ide_write_setting(ide_drive_t *drive, | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 223 | const struct ide_proc_devset *setting, int val) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 224 | { | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 225 | const struct ide_devset *ds = setting->setting; | 
|  | 226 |  | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 227 | if (!capable(CAP_SYS_ADMIN)) | 
|  | 228 | return -EACCES; | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 229 | if (!ds->set) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 230 | return -EPERM; | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 231 | if ((ds->flags & DS_SYNC) | 
|  | 232 | && (val < setting->min || val > setting->max)) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 233 | return -EINVAL; | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 234 | return ide_devset_execute(drive, ds, val); | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 235 | } | 
|  | 236 |  | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 237 | ide_devset_get(xfer_rate, current_speed); | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 238 |  | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 239 | static int set_xfer_rate (ide_drive_t *drive, int arg) | 
|  | 240 | { | 
| Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 241 | struct ide_cmd cmd; | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 242 |  | 
| Bartlomiej Zolnierkiewicz | 3b2a5c7 | 2008-07-23 19:55:56 +0200 | [diff] [blame] | 243 | if (arg < XFER_PIO_0 || arg > XFER_UDMA_6) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 244 | return -EINVAL; | 
|  | 245 |  | 
| Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 246 | memset(&cmd, 0, sizeof(cmd)); | 
|  | 247 | cmd.tf.command = ATA_CMD_SET_FEATURES; | 
|  | 248 | cmd.tf.feature = SETFEATURES_XFER; | 
|  | 249 | cmd.tf.nsect   = (u8)arg; | 
| Sergei Shtylyov | 60f8501 | 2009-04-08 14:13:01 +0200 | [diff] [blame] | 250 | cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT; | 
|  | 251 | cmd.valid.in.tf  = IDE_VALID_NSECT; | 
| Bartlomiej Zolnierkiewicz | 665d66e8f | 2009-06-23 11:35:51 +0000 | [diff] [blame] | 252 | cmd.tf_flags   = IDE_TFLAG_SET_XFER; | 
| Bartlomiej Zolnierkiewicz | 34f5d5a | 2008-01-26 20:13:12 +0100 | [diff] [blame] | 253 |  | 
| Bartlomiej Zolnierkiewicz | 665d66e8f | 2009-06-23 11:35:51 +0000 | [diff] [blame] | 254 | return ide_no_data_taskfile(drive, &cmd); | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 255 | } | 
|  | 256 |  | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 257 | ide_devset_rw(current_speed, xfer_rate); | 
|  | 258 | ide_devset_rw_field(init_speed, init_speed); | 
| Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 259 | ide_devset_rw_flag(nice1, IDE_DFLAG_NICE1); | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 260 | ide_devset_rw_field(number, dn); | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 261 |  | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 262 | static const struct ide_proc_devset ide_generic_settings[] = { | 
|  | 263 | IDE_PROC_DEVSET(current_speed, 0, 70), | 
|  | 264 | IDE_PROC_DEVSET(init_speed, 0, 70), | 
|  | 265 | IDE_PROC_DEVSET(io_32bit,  0, 1 + (SUPPORT_VLB_SYNC << 1)), | 
|  | 266 | IDE_PROC_DEVSET(keepsettings, 0, 1), | 
|  | 267 | IDE_PROC_DEVSET(nice1, 0, 1), | 
|  | 268 | IDE_PROC_DEVSET(number, 0, 3), | 
|  | 269 | IDE_PROC_DEVSET(pio_mode, 0, 255), | 
|  | 270 | IDE_PROC_DEVSET(unmaskirq, 0, 1), | 
|  | 271 | IDE_PROC_DEVSET(using_dma, 0, 1), | 
| Hannes Eder | 71bfc7a | 2009-03-05 16:10:56 +0100 | [diff] [blame] | 272 | { NULL }, | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 273 | }; | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 274 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | static void proc_ide_settings_warn(void) | 
|  | 276 | { | 
| Marcin Slusarz | 01f1afa | 2009-09-22 16:29:00 -0700 | [diff] [blame] | 277 | printk_once(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is " | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | "obsolete, and will be removed soon!\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | } | 
|  | 280 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 281 | static int ide_settings_proc_show(struct seq_file *m, void *v) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | { | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 283 | const struct ide_proc_devset *setting, *g, *d; | 
|  | 284 | const struct ide_devset *ds; | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 285 | ide_drive_t	*drive = (ide_drive_t *) m->private; | 
|  | 286 | int		rc, mul_factor, div_factor; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 |  | 
|  | 288 | proc_ide_settings_warn(); | 
|  | 289 |  | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 290 | mutex_lock(&ide_setting_mtx); | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 291 | g = ide_generic_settings; | 
|  | 292 | d = drive->settings; | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 293 | seq_printf(m, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n"); | 
|  | 294 | seq_printf(m, "----\t\t\t-----\t\t---\t\t---\t\t----\n"); | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 295 | while (g->name || (d && d->name)) { | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 296 | /* read settings in the alphabetical order */ | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 297 | if (g->name && d && d->name) { | 
|  | 298 | if (strcmp(d->name, g->name) < 0) | 
|  | 299 | setting = d++; | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 300 | else | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 301 | setting = g++; | 
|  | 302 | } else if (d && d->name) { | 
|  | 303 | setting = d++; | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 304 | } else | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 305 | setting = g++; | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 306 | mul_factor = setting->mulf ? setting->mulf(drive) : 1; | 
|  | 307 | div_factor = setting->divf ? setting->divf(drive) : 1; | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 308 | seq_printf(m, "%-24s", setting->name); | 
| Paolo Ciarrocchi | 441e92d | 2008-04-26 17:36:40 +0200 | [diff] [blame] | 309 | rc = ide_read_setting(drive, setting); | 
|  | 310 | if (rc >= 0) | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 311 | seq_printf(m, "%-16d", rc * mul_factor / div_factor); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | else | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 313 | seq_printf(m, "%-16s", "write-only"); | 
|  | 314 | seq_printf(m, "%-16d%-16d", (setting->min * mul_factor + div_factor - 1) / div_factor, setting->max * mul_factor / div_factor); | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 315 | ds = setting->setting; | 
|  | 316 | if (ds->get) | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 317 | seq_printf(m, "r"); | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 318 | if (ds->set) | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 319 | seq_printf(m, "w"); | 
|  | 320 | seq_printf(m, "\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | } | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 322 | mutex_unlock(&ide_setting_mtx); | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 323 | return 0; | 
|  | 324 | } | 
|  | 325 |  | 
|  | 326 | static int ide_settings_proc_open(struct inode *inode, struct file *file) | 
|  | 327 | { | 
|  | 328 | return single_open(file, ide_settings_proc_show, PDE(inode)->data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | } | 
|  | 330 |  | 
|  | 331 | #define MAX_LEN	30 | 
|  | 332 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 333 | static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer, | 
|  | 334 | size_t count, loff_t *pos) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 336 | ide_drive_t	*drive = (ide_drive_t *) PDE(file->f_path.dentry->d_inode)->data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | char		name[MAX_LEN + 1]; | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 338 | int		for_real = 0, mul_factor, div_factor; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | unsigned long	n; | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 340 |  | 
| Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 341 | const struct ide_proc_devset *setting; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | char *buf, *s; | 
|  | 343 |  | 
|  | 344 | if (!capable(CAP_SYS_ADMIN)) | 
|  | 345 | return -EACCES; | 
|  | 346 |  | 
|  | 347 | proc_ide_settings_warn(); | 
|  | 348 |  | 
|  | 349 | if (count >= PAGE_SIZE) | 
|  | 350 | return -EINVAL; | 
|  | 351 |  | 
|  | 352 | s = buf = (char *)__get_free_page(GFP_USER); | 
|  | 353 | if (!buf) | 
|  | 354 | return -ENOMEM; | 
|  | 355 |  | 
|  | 356 | if (copy_from_user(buf, buffer, count)) { | 
|  | 357 | free_page((unsigned long)buf); | 
|  | 358 | return -EFAULT; | 
|  | 359 | } | 
|  | 360 |  | 
|  | 361 | buf[count] = '\0'; | 
|  | 362 |  | 
|  | 363 | /* | 
|  | 364 | * Skip over leading whitespace | 
|  | 365 | */ | 
|  | 366 | while (count && isspace(*s)) { | 
|  | 367 | --count; | 
|  | 368 | ++s; | 
|  | 369 | } | 
|  | 370 | /* | 
|  | 371 | * Do one full pass to verify all parameters, | 
|  | 372 | * then do another to actually write the new settings. | 
|  | 373 | */ | 
|  | 374 | do { | 
|  | 375 | char *p = s; | 
|  | 376 | n = count; | 
|  | 377 | while (n > 0) { | 
|  | 378 | unsigned val; | 
|  | 379 | char *q = p; | 
|  | 380 |  | 
|  | 381 | while (n > 0 && *p != ':') { | 
|  | 382 | --n; | 
|  | 383 | p++; | 
|  | 384 | } | 
|  | 385 | if (*p != ':') | 
|  | 386 | goto parse_error; | 
|  | 387 | if (p - q > MAX_LEN) | 
|  | 388 | goto parse_error; | 
|  | 389 | memcpy(name, q, p - q); | 
|  | 390 | name[p - q] = 0; | 
|  | 391 |  | 
|  | 392 | if (n > 0) { | 
|  | 393 | --n; | 
|  | 394 | p++; | 
|  | 395 | } else | 
|  | 396 | goto parse_error; | 
|  | 397 |  | 
|  | 398 | val = simple_strtoul(p, &q, 10); | 
|  | 399 | n -= q - p; | 
|  | 400 | p = q; | 
|  | 401 | if (n > 0 && !isspace(*p)) | 
|  | 402 | goto parse_error; | 
|  | 403 | while (n > 0 && isspace(*p)) { | 
|  | 404 | --n; | 
|  | 405 | ++p; | 
|  | 406 | } | 
|  | 407 |  | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 408 | mutex_lock(&ide_setting_mtx); | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 409 | /* generic settings first, then driver specific ones */ | 
|  | 410 | setting = ide_find_setting(ide_generic_settings, name); | 
| Paolo Ciarrocchi | 441e92d | 2008-04-26 17:36:40 +0200 | [diff] [blame] | 411 | if (!setting) { | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 412 | if (drive->settings) | 
|  | 413 | setting = ide_find_setting(drive->settings, name); | 
|  | 414 | if (!setting) { | 
|  | 415 | mutex_unlock(&ide_setting_mtx); | 
|  | 416 | goto parse_error; | 
|  | 417 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | } | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 419 | if (for_real) { | 
|  | 420 | mul_factor = setting->mulf ? setting->mulf(drive) : 1; | 
|  | 421 | div_factor = setting->divf ? setting->divf(drive) : 1; | 
|  | 422 | ide_write_setting(drive, setting, val * div_factor / mul_factor); | 
|  | 423 | } | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 424 | mutex_unlock(&ide_setting_mtx); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | } | 
|  | 426 | } while (!for_real++); | 
|  | 427 | free_page((unsigned long)buf); | 
|  | 428 | return count; | 
|  | 429 | parse_error: | 
|  | 430 | free_page((unsigned long)buf); | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 431 | printk("%s(): parse error\n", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | return -EINVAL; | 
|  | 433 | } | 
|  | 434 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 435 | static const struct file_operations ide_settings_proc_fops = { | 
|  | 436 | .owner		= THIS_MODULE, | 
|  | 437 | .open		= ide_settings_proc_open, | 
|  | 438 | .read		= seq_read, | 
|  | 439 | .llseek		= seq_lseek, | 
|  | 440 | .release	= single_release, | 
|  | 441 | .write		= ide_settings_proc_write, | 
|  | 442 | }; | 
|  | 443 |  | 
|  | 444 | static int ide_capacity_proc_show(struct seq_file *m, void *v) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 446 | seq_printf(m, "%llu\n", (long long)0x7fffffff); | 
|  | 447 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | } | 
|  | 449 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 450 | static int ide_capacity_proc_open(struct inode *inode, struct file *file) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 452 | return single_open(file, ide_capacity_proc_show, NULL); | 
|  | 453 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 455 | const struct file_operations ide_capacity_proc_fops = { | 
|  | 456 | .owner		= THIS_MODULE, | 
|  | 457 | .open		= ide_capacity_proc_open, | 
|  | 458 | .read		= seq_read, | 
|  | 459 | .llseek		= seq_lseek, | 
|  | 460 | .release	= single_release, | 
|  | 461 | }; | 
|  | 462 | EXPORT_SYMBOL_GPL(ide_capacity_proc_fops); | 
|  | 463 |  | 
|  | 464 | static int ide_geometry_proc_show(struct seq_file *m, void *v) | 
|  | 465 | { | 
|  | 466 | ide_drive_t	*drive = (ide_drive_t *) m->private; | 
|  | 467 |  | 
|  | 468 | seq_printf(m, "physical     %d/%d/%d\n", | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | drive->cyl, drive->head, drive->sect); | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 470 | seq_printf(m, "logical      %d/%d/%d\n", | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | drive->bios_cyl, drive->bios_head, drive->bios_sect); | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 472 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | } | 
|  | 474 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 475 | static int ide_geometry_proc_open(struct inode *inode, struct file *file) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 477 | return single_open(file, ide_geometry_proc_show, PDE(inode)->data); | 
|  | 478 | } | 
|  | 479 |  | 
|  | 480 | const struct file_operations ide_geometry_proc_fops = { | 
|  | 481 | .owner		= THIS_MODULE, | 
|  | 482 | .open		= ide_geometry_proc_open, | 
|  | 483 | .read		= seq_read, | 
|  | 484 | .llseek		= seq_lseek, | 
|  | 485 | .release	= single_release, | 
|  | 486 | }; | 
|  | 487 | EXPORT_SYMBOL(ide_geometry_proc_fops); | 
|  | 488 |  | 
|  | 489 | static int ide_dmodel_proc_show(struct seq_file *seq, void *v) | 
|  | 490 | { | 
|  | 491 | ide_drive_t	*drive = (ide_drive_t *) seq->private; | 
| Bartlomiej Zolnierkiewicz | 4dde449 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 492 | char		*m = (char *)&drive->id[ATA_ID_PROD]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 494 | seq_printf(seq, "%.40s\n", m[0] ? m : "(none)"); | 
|  | 495 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | } | 
|  | 497 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 498 | static int ide_dmodel_proc_open(struct inode *inode, struct file *file) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 500 | return single_open(file, ide_dmodel_proc_show, PDE(inode)->data); | 
|  | 501 | } | 
|  | 502 |  | 
|  | 503 | static const struct file_operations ide_dmodel_proc_fops = { | 
|  | 504 | .owner		= THIS_MODULE, | 
|  | 505 | .open		= ide_dmodel_proc_open, | 
|  | 506 | .read		= seq_read, | 
|  | 507 | .llseek		= seq_lseek, | 
|  | 508 | .release	= single_release, | 
|  | 509 | }; | 
|  | 510 |  | 
|  | 511 | static int ide_driver_proc_show(struct seq_file *m, void *v) | 
|  | 512 | { | 
|  | 513 | ide_drive_t		*drive = (ide_drive_t *)m->private; | 
| Bartlomiej Zolnierkiewicz | 7f3c868 | 2009-01-06 17:20:53 +0100 | [diff] [blame] | 514 | struct device		*dev = &drive->gendev; | 
|  | 515 | struct ide_driver	*ide_drv; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 |  | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 517 | if (dev->driver) { | 
| Bartlomiej Zolnierkiewicz | 7f3c868 | 2009-01-06 17:20:53 +0100 | [diff] [blame] | 518 | ide_drv = to_ide_driver(dev->driver); | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 519 | seq_printf(m, "%s version %s\n", | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 520 | dev->driver->name, ide_drv->version); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | } else | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 522 | seq_printf(m, "ide-default version 0.9.newide\n"); | 
|  | 523 | return 0; | 
|  | 524 | } | 
|  | 525 |  | 
|  | 526 | static int ide_driver_proc_open(struct inode *inode, struct file *file) | 
|  | 527 | { | 
|  | 528 | return single_open(file, ide_driver_proc_show, PDE(inode)->data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | } | 
|  | 530 |  | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 531 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) | 
|  | 532 | { | 
|  | 533 | struct device *dev = &drive->gendev; | 
|  | 534 | int ret = 1; | 
| Randy Dunlap | 349ae23 | 2006-10-03 01:14:23 -0700 | [diff] [blame] | 535 | int err; | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 536 |  | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 537 | device_release_driver(dev); | 
|  | 538 | /* FIXME: device can still be in use by previous driver */ | 
|  | 539 | strlcpy(drive->driver_req, driver, sizeof(drive->driver_req)); | 
| Randy Dunlap | 349ae23 | 2006-10-03 01:14:23 -0700 | [diff] [blame] | 540 | err = device_attach(dev); | 
|  | 541 | if (err < 0) | 
|  | 542 | printk(KERN_WARNING "IDE: %s: device_attach error: %d\n", | 
| Harvey Harrison | eb63963 | 2008-04-26 22:25:20 +0200 | [diff] [blame] | 543 | __func__, err); | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 544 | drive->driver_req[0] = 0; | 
| Randy Dunlap | 349ae23 | 2006-10-03 01:14:23 -0700 | [diff] [blame] | 545 | if (dev->driver == NULL) { | 
|  | 546 | err = device_attach(dev); | 
|  | 547 | if (err < 0) | 
|  | 548 | printk(KERN_WARNING | 
|  | 549 | "IDE: %s: device_attach(2) error: %d\n", | 
| Harvey Harrison | eb63963 | 2008-04-26 22:25:20 +0200 | [diff] [blame] | 550 | __func__, err); | 
| Randy Dunlap | 349ae23 | 2006-10-03 01:14:23 -0700 | [diff] [blame] | 551 | } | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 552 | if (dev->driver && !strcmp(dev->driver->name, driver)) | 
|  | 553 | ret = 0; | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 554 |  | 
|  | 555 | return ret; | 
|  | 556 | } | 
|  | 557 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 558 | static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer, | 
|  | 559 | size_t count, loff_t *pos) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 561 | ide_drive_t	*drive = (ide_drive_t *) PDE(file->f_path.dentry->d_inode)->data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | char name[32]; | 
|  | 563 |  | 
|  | 564 | if (!capable(CAP_SYS_ADMIN)) | 
|  | 565 | return -EACCES; | 
|  | 566 | if (count > 31) | 
|  | 567 | count = 31; | 
|  | 568 | if (copy_from_user(name, buffer, count)) | 
|  | 569 | return -EFAULT; | 
|  | 570 | name[count] = '\0'; | 
|  | 571 | if (ide_replace_subdriver(drive, name)) | 
|  | 572 | return -EINVAL; | 
|  | 573 | return count; | 
|  | 574 | } | 
|  | 575 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 576 | static const struct file_operations ide_driver_proc_fops = { | 
|  | 577 | .owner		= THIS_MODULE, | 
|  | 578 | .open		= ide_driver_proc_open, | 
|  | 579 | .read		= seq_read, | 
|  | 580 | .llseek		= seq_lseek, | 
|  | 581 | .release	= single_release, | 
|  | 582 | .write		= ide_driver_proc_write, | 
|  | 583 | }; | 
|  | 584 |  | 
|  | 585 | static int ide_media_proc_show(struct seq_file *m, void *v) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 587 | ide_drive_t	*drive = (ide_drive_t *) m->private; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | const char	*media; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 |  | 
|  | 590 | switch (drive->media) { | 
| Paolo Ciarrocchi | 441e92d | 2008-04-26 17:36:40 +0200 | [diff] [blame] | 591 | case ide_disk:		media = "disk\n";	break; | 
|  | 592 | case ide_cdrom:		media = "cdrom\n";	break; | 
|  | 593 | case ide_tape:		media = "tape\n";	break; | 
|  | 594 | case ide_floppy:	media = "floppy\n";	break; | 
|  | 595 | case ide_optical:	media = "optical\n";	break; | 
|  | 596 | default:		media = "UNKNOWN\n";	break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | } | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 598 | seq_puts(m, media); | 
|  | 599 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | } | 
|  | 601 |  | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 602 | static int ide_media_proc_open(struct inode *inode, struct file *file) | 
|  | 603 | { | 
|  | 604 | return single_open(file, ide_media_proc_show, PDE(inode)->data); | 
|  | 605 | } | 
|  | 606 |  | 
|  | 607 | static const struct file_operations ide_media_proc_fops = { | 
|  | 608 | .owner		= THIS_MODULE, | 
|  | 609 | .open		= ide_media_proc_open, | 
|  | 610 | .read		= seq_read, | 
|  | 611 | .llseek		= seq_lseek, | 
|  | 612 | .release	= single_release, | 
|  | 613 | }; | 
|  | 614 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | static ide_proc_entry_t generic_drive_entries[] = { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 616 | { "driver",	S_IFREG|S_IRUGO,	 &ide_driver_proc_fops	}, | 
|  | 617 | { "identify",	S_IFREG|S_IRUSR,	 &ide_identify_proc_fops}, | 
|  | 618 | { "media",	S_IFREG|S_IRUGO,	 &ide_media_proc_fops	}, | 
|  | 619 | { "model",	S_IFREG|S_IRUGO,	 &ide_dmodel_proc_fops	}, | 
|  | 620 | { "settings",	S_IFREG|S_IRUSR|S_IWUSR, &ide_settings_proc_fops}, | 
|  | 621 | {} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 622 | }; | 
|  | 623 |  | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 624 | static void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 625 | { | 
|  | 626 | struct proc_dir_entry *ent; | 
|  | 627 |  | 
|  | 628 | if (!dir || !p) | 
|  | 629 | return; | 
|  | 630 | while (p->name != NULL) { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 631 | ent = proc_create_data(p->name, p->mode, dir, p->proc_fops, data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | if (!ent) return; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 633 | p++; | 
|  | 634 | } | 
|  | 635 | } | 
|  | 636 |  | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 637 | static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 638 | { | 
|  | 639 | if (!dir || !p) | 
|  | 640 | return; | 
|  | 641 | while (p->name != NULL) { | 
|  | 642 | remove_proc_entry(p->name, dir); | 
|  | 643 | p++; | 
|  | 644 | } | 
|  | 645 | } | 
|  | 646 |  | 
| Bartlomiej Zolnierkiewicz | 7f3c868 | 2009-01-06 17:20:53 +0100 | [diff] [blame] | 647 | void ide_proc_register_driver(ide_drive_t *drive, struct ide_driver *driver) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 648 | { | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 649 | mutex_lock(&ide_setting_mtx); | 
| Bartlomiej Zolnierkiewicz | 79cb380 | 2008-10-17 18:09:13 +0200 | [diff] [blame] | 650 | drive->settings = driver->proc_devsets(drive); | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 651 | mutex_unlock(&ide_setting_mtx); | 
|  | 652 |  | 
| Bartlomiej Zolnierkiewicz | 79cb380 | 2008-10-17 18:09:13 +0200 | [diff] [blame] | 653 | ide_add_proc_entries(drive->proc, driver->proc_entries(drive), drive); | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 654 | } | 
|  | 655 |  | 
|  | 656 | EXPORT_SYMBOL(ide_proc_register_driver); | 
|  | 657 |  | 
|  | 658 | /** | 
|  | 659 | *	ide_proc_unregister_driver	-	remove driver specific data | 
|  | 660 | *	@drive: drive | 
|  | 661 | *	@driver: driver | 
|  | 662 | * | 
|  | 663 | *	Clean up the driver specific /proc files and IDE settings | 
|  | 664 | *	for a given drive. | 
|  | 665 | * | 
| Bartlomiej Zolnierkiewicz | 1f473e9 | 2008-12-29 20:27:29 +0100 | [diff] [blame] | 666 | *	Takes ide_setting_mtx. | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 667 | */ | 
|  | 668 |  | 
| Bartlomiej Zolnierkiewicz | 7f3c868 | 2009-01-06 17:20:53 +0100 | [diff] [blame] | 669 | void ide_proc_unregister_driver(ide_drive_t *drive, struct ide_driver *driver) | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 670 | { | 
| Bartlomiej Zolnierkiewicz | 79cb380 | 2008-10-17 18:09:13 +0200 | [diff] [blame] | 671 | ide_remove_proc_entries(drive->proc, driver->proc_entries(drive)); | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 672 |  | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 673 | mutex_lock(&ide_setting_mtx); | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 674 | /* | 
| Bartlomiej Zolnierkiewicz | 1f473e9 | 2008-12-29 20:27:29 +0100 | [diff] [blame] | 675 | * ide_setting_mtx protects both the settings list and the use | 
|  | 676 | * of settings (we cannot take a setting out that is being used). | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 677 | */ | 
| Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 678 | drive->settings = NULL; | 
| Matthias Kaehlcke | f9383c4 | 2007-07-09 23:17:56 +0200 | [diff] [blame] | 679 | mutex_unlock(&ide_setting_mtx); | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 680 | } | 
| Bartlomiej Zolnierkiewicz | 7662d04 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 681 | EXPORT_SYMBOL(ide_proc_unregister_driver); | 
|  | 682 |  | 
| Bartlomiej Zolnierkiewicz | d9270a3 | 2008-02-02 19:56:43 +0100 | [diff] [blame] | 683 | void ide_proc_port_register_devices(ide_hwif_t *hwif) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 685 | struct proc_dir_entry *ent; | 
|  | 686 | struct proc_dir_entry *parent = hwif->proc; | 
| Bartlomiej Zolnierkiewicz | 2bd24a1 | 2009-01-06 17:20:56 +0100 | [diff] [blame] | 687 | ide_drive_t *drive; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | char name[64]; | 
| Bartlomiej Zolnierkiewicz | 2bd24a1 | 2009-01-06 17:20:56 +0100 | [diff] [blame] | 689 | int i; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 690 |  | 
| Bartlomiej Zolnierkiewicz | 2bd24a1 | 2009-01-06 17:20:56 +0100 | [diff] [blame] | 691 | ide_port_for_each_dev(i, drive, hwif) { | 
| Bartlomiej Zolnierkiewicz | 1902a25 | 2009-03-24 23:22:40 +0100 | [diff] [blame] | 692 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | continue; | 
|  | 694 |  | 
|  | 695 | drive->proc = proc_mkdir(drive->name, parent); | 
|  | 696 | if (drive->proc) | 
|  | 697 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); | 
| Paolo Ciarrocchi | 441e92d | 2008-04-26 17:36:40 +0200 | [diff] [blame] | 698 | sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | ent = proc_symlink(drive->name, proc_ide_root, name); | 
|  | 700 | if (!ent) return; | 
|  | 701 | } | 
|  | 702 | } | 
|  | 703 |  | 
| Bartlomiej Zolnierkiewicz | 5b0c4b3 | 2008-04-18 00:46:22 +0200 | [diff] [blame] | 704 | void ide_proc_unregister_device(ide_drive_t *drive) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 705 | { | 
|  | 706 | if (drive->proc) { | 
|  | 707 | ide_remove_proc_entries(drive->proc, generic_drive_entries); | 
|  | 708 | remove_proc_entry(drive->name, proc_ide_root); | 
| Bartlomiej Zolnierkiewicz | 5b0c4b3 | 2008-04-18 00:46:22 +0200 | [diff] [blame] | 709 | remove_proc_entry(drive->name, drive->hwif->proc); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | drive->proc = NULL; | 
|  | 711 | } | 
|  | 712 | } | 
|  | 713 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | static ide_proc_entry_t hwif_entries[] = { | 
| Alexey Dobriyan | 6d703a8 | 2009-09-01 17:52:57 -0700 | [diff] [blame] | 715 | { "channel",	S_IFREG|S_IRUGO,	&ide_channel_proc_fops	}, | 
|  | 716 | { "mate",	S_IFREG|S_IRUGO,	&ide_mate_proc_fops	}, | 
|  | 717 | { "model",	S_IFREG|S_IRUGO,	&ide_imodel_proc_fops	}, | 
|  | 718 | {} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | }; | 
|  | 720 |  | 
| Bartlomiej Zolnierkiewicz | 5cbf79c | 2007-05-10 00:01:11 +0200 | [diff] [blame] | 721 | void ide_proc_register_port(ide_hwif_t *hwif) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 722 | { | 
| Bartlomiej Zolnierkiewicz | 5cbf79c | 2007-05-10 00:01:11 +0200 | [diff] [blame] | 723 | if (!hwif->proc) { | 
|  | 724 | hwif->proc = proc_mkdir(hwif->name, proc_ide_root); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 725 |  | 
| Bartlomiej Zolnierkiewicz | 5cbf79c | 2007-05-10 00:01:11 +0200 | [diff] [blame] | 726 | if (!hwif->proc) | 
|  | 727 | return; | 
|  | 728 |  | 
|  | 729 | ide_add_proc_entries(hwif->proc, hwif_entries, hwif); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 730 | } | 
|  | 731 | } | 
|  | 732 |  | 
| Bartlomiej Zolnierkiewicz | 5cbf79c | 2007-05-10 00:01:11 +0200 | [diff] [blame] | 733 | void ide_proc_unregister_port(ide_hwif_t *hwif) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 734 | { | 
|  | 735 | if (hwif->proc) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 | ide_remove_proc_entries(hwif->proc, hwif_entries); | 
|  | 737 | remove_proc_entry(hwif->name, proc_ide_root); | 
|  | 738 | hwif->proc = NULL; | 
|  | 739 | } | 
|  | 740 | } | 
|  | 741 |  | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 742 | static int proc_print_driver(struct device_driver *drv, void *data) | 
|  | 743 | { | 
| Bartlomiej Zolnierkiewicz | 7f3c868 | 2009-01-06 17:20:53 +0100 | [diff] [blame] | 744 | struct ide_driver *ide_drv = to_ide_driver(drv); | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 745 | struct seq_file *s = data; | 
|  | 746 |  | 
|  | 747 | seq_printf(s, "%s version %s\n", drv->name, ide_drv->version); | 
|  | 748 |  | 
|  | 749 | return 0; | 
|  | 750 | } | 
|  | 751 |  | 
|  | 752 | static int ide_drivers_show(struct seq_file *s, void *p) | 
|  | 753 | { | 
| Randy Dunlap | 349ae23 | 2006-10-03 01:14:23 -0700 | [diff] [blame] | 754 | int err; | 
|  | 755 |  | 
|  | 756 | err = bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver); | 
|  | 757 | if (err < 0) | 
|  | 758 | printk(KERN_WARNING "IDE: %s: bus_for_each_drv error: %d\n", | 
| Harvey Harrison | eb63963 | 2008-04-26 22:25:20 +0200 | [diff] [blame] | 759 | __func__, err); | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 760 | return 0; | 
|  | 761 | } | 
|  | 762 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 763 | static int ide_drivers_open(struct inode *inode, struct file *file) | 
|  | 764 | { | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 765 | return single_open(file, &ide_drivers_show, NULL); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 766 | } | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 767 |  | 
| Arjan van de Ven | 2b8693c | 2007-02-12 00:55:32 -0800 | [diff] [blame] | 768 | static const struct file_operations ide_drivers_operations = { | 
| Denis V. Lunev | c7705f3 | 2008-04-29 01:02:35 -0700 | [diff] [blame] | 769 | .owner		= THIS_MODULE, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 770 | .open		= ide_drivers_open, | 
|  | 771 | .read		= seq_read, | 
|  | 772 | .llseek		= seq_lseek, | 
| Bartlomiej Zolnierkiewicz | 8604aff | 2005-05-26 14:55:34 +0200 | [diff] [blame] | 773 | .release	= single_release, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 774 | }; | 
|  | 775 |  | 
|  | 776 | void proc_ide_create(void) | 
|  | 777 | { | 
| Bartlomiej Zolnierkiewicz | 5cbf79c | 2007-05-10 00:01:11 +0200 | [diff] [blame] | 778 | proc_ide_root = proc_mkdir("ide", NULL); | 
|  | 779 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | if (!proc_ide_root) | 
|  | 781 | return; | 
|  | 782 |  | 
| Denis V. Lunev | c7705f3 | 2008-04-29 01:02:35 -0700 | [diff] [blame] | 783 | proc_create("drivers", 0, proc_ide_root, &ide_drivers_operations); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 784 | } | 
|  | 785 |  | 
|  | 786 | void proc_ide_destroy(void) | 
|  | 787 | { | 
| Zhang, Yanmin | 643bdc6 | 2005-05-16 21:53:11 -0700 | [diff] [blame] | 788 | remove_proc_entry("drivers", proc_ide_root); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 789 | remove_proc_entry("ide", NULL); | 
|  | 790 | } |