aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/parport')
-rw-r--r--drivers/parport/parport_cs.c38
-rw-r--r--drivers/parport/procfs.c39
2 files changed, 30 insertions, 47 deletions
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 8fdfa4f537a6..7dd370fa3439 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -67,14 +67,6 @@ MODULE_LICENSE("Dual MPL/GPL");
67 67
68INT_MODULE_PARM(epp_mode, 1); 68INT_MODULE_PARM(epp_mode, 1);
69 69
70#ifdef PCMCIA_DEBUG
71INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
72#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
73static char *version =
74"parport_cs.c 1.29 2002/10/11 06:57:41 (David Hinds)";
75#else
76#define DEBUG(n, args...)
77#endif
78 70
79/*====================================================================*/ 71/*====================================================================*/
80 72
@@ -103,7 +95,7 @@ static int parport_probe(struct pcmcia_device *link)
103{ 95{
104 parport_info_t *info; 96 parport_info_t *info;
105 97
106 DEBUG(0, "parport_attach()\n"); 98 dev_dbg(&link->dev, "parport_attach()\n");
107 99
108 /* Create new parport device */ 100 /* Create new parport device */
109 info = kzalloc(sizeof(*info), GFP_KERNEL); 101 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -114,7 +106,6 @@ static int parport_probe(struct pcmcia_device *link)
114 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 106 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
115 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 107 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
116 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; 108 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
117 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
118 link->conf.Attributes = CONF_ENABLE_IRQ; 109 link->conf.Attributes = CONF_ENABLE_IRQ;
119 link->conf.IntType = INT_MEMORY_AND_IO; 110 link->conf.IntType = INT_MEMORY_AND_IO;
120 111
@@ -132,7 +123,7 @@ static int parport_probe(struct pcmcia_device *link)
132 123
133static void parport_detach(struct pcmcia_device *link) 124static void parport_detach(struct pcmcia_device *link)
134{ 125{
135 DEBUG(0, "parport_detach(0x%p)\n", link); 126 dev_dbg(&link->dev, "parport_detach\n");
136 127
137 parport_cs_release(link); 128 parport_cs_release(link);
138 129
@@ -147,9 +138,6 @@ static void parport_detach(struct pcmcia_device *link)
147 138
148======================================================================*/ 139======================================================================*/
149 140
150#define CS_CHECK(fn, ret) \
151do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
152
153static int parport_config_check(struct pcmcia_device *p_dev, 141static int parport_config_check(struct pcmcia_device *p_dev,
154 cistpl_cftable_entry_t *cfg, 142 cistpl_cftable_entry_t *cfg,
155 cistpl_cftable_entry_t *dflt, 143 cistpl_cftable_entry_t *dflt,
@@ -178,18 +166,20 @@ static int parport_config(struct pcmcia_device *link)
178{ 166{
179 parport_info_t *info = link->priv; 167 parport_info_t *info = link->priv;
180 struct parport *p; 168 struct parport *p;
181 int last_ret, last_fn; 169 int ret;
182 170
183 DEBUG(0, "parport_config(0x%p)\n", link); 171 dev_dbg(&link->dev, "parport_config\n");
184 172
185 last_ret = pcmcia_loop_config(link, parport_config_check, NULL); 173 ret = pcmcia_loop_config(link, parport_config_check, NULL);
186 if (last_ret) { 174 if (ret)
187 cs_error(link, RequestIO, last_ret);
188 goto failed; 175 goto failed;
189 }
190 176
191 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 177 ret = pcmcia_request_irq(link, &link->irq);
192 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 178 if (ret)
179 goto failed;
180 ret = pcmcia_request_configuration(link, &link->conf);
181 if (ret)
182 goto failed;
193 183
194 p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, 184 p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2,
195 link->irq.AssignedIRQ, PARPORT_DMA_NONE, 185 link->irq.AssignedIRQ, PARPORT_DMA_NONE,
@@ -213,8 +203,6 @@ static int parport_config(struct pcmcia_device *link)
213 203
214 return 0; 204 return 0;
215 205
216cs_failed:
217 cs_error(link, last_fn, last_ret);
218failed: 206failed:
219 parport_cs_release(link); 207 parport_cs_release(link);
220 return -ENODEV; 208 return -ENODEV;
@@ -232,7 +220,7 @@ static void parport_cs_release(struct pcmcia_device *link)
232{ 220{
233 parport_info_t *info = link->priv; 221 parport_info_t *info = link->priv;
234 222
235 DEBUG(0, "parport_release(0x%p)\n", link); 223 dev_dbg(&link->dev, "parport_release\n");
236 224
237 if (info->ndev) { 225 if (info->ndev) {
238 struct parport *p = info->port; 226 struct parport *p = info->port;
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 8eefe56f1cbe..3f56bc086cb5 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -233,10 +233,10 @@ static int do_hardware_modes (ctl_table *table, int write,
233 return copy_to_user(result, buffer, len) ? -EFAULT : 0; 233 return copy_to_user(result, buffer, len) ? -EFAULT : 0;
234} 234}
235 235
236#define PARPORT_PORT_DIR(CHILD) { .ctl_name = 0, .procname = NULL, .mode = 0555, .child = CHILD } 236#define PARPORT_PORT_DIR(CHILD) { .procname = NULL, .mode = 0555, .child = CHILD }
237#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ 237#define PARPORT_PARPORT_DIR(CHILD) { .procname = "parport", \
238 .mode = 0555, .child = CHILD } 238 .mode = 0555, .child = CHILD }
239#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD } 239#define PARPORT_DEV_DIR(CHILD) { .procname = "dev", .mode = 0555, .child = CHILD }
240#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \ 240#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \
241 .mode = 0555, .child = NULL } 241 .mode = 0555, .child = NULL }
242 242
@@ -270,7 +270,7 @@ static const struct parport_sysctl_table parport_sysctl_template = {
270 .data = NULL, 270 .data = NULL,
271 .maxlen = sizeof(int), 271 .maxlen = sizeof(int),
272 .mode = 0644, 272 .mode = 0644,
273 .proc_handler = &proc_dointvec_minmax, 273 .proc_handler = proc_dointvec_minmax,
274 .extra1 = (void*) &parport_min_spintime_value, 274 .extra1 = (void*) &parport_min_spintime_value,
275 .extra2 = (void*) &parport_max_spintime_value 275 .extra2 = (void*) &parport_max_spintime_value
276 }, 276 },
@@ -279,28 +279,28 @@ static const struct parport_sysctl_table parport_sysctl_template = {
279 .data = NULL, 279 .data = NULL,
280 .maxlen = 0, 280 .maxlen = 0,
281 .mode = 0444, 281 .mode = 0444,
282 .proc_handler = &do_hardware_base_addr 282 .proc_handler = do_hardware_base_addr
283 }, 283 },
284 { 284 {
285 .procname = "irq", 285 .procname = "irq",
286 .data = NULL, 286 .data = NULL,
287 .maxlen = 0, 287 .maxlen = 0,
288 .mode = 0444, 288 .mode = 0444,
289 .proc_handler = &do_hardware_irq 289 .proc_handler = do_hardware_irq
290 }, 290 },
291 { 291 {
292 .procname = "dma", 292 .procname = "dma",
293 .data = NULL, 293 .data = NULL,
294 .maxlen = 0, 294 .maxlen = 0,
295 .mode = 0444, 295 .mode = 0444,
296 .proc_handler = &do_hardware_dma 296 .proc_handler = do_hardware_dma
297 }, 297 },
298 { 298 {
299 .procname = "modes", 299 .procname = "modes",
300 .data = NULL, 300 .data = NULL,
301 .maxlen = 0, 301 .maxlen = 0,
302 .mode = 0444, 302 .mode = 0444,
303 .proc_handler = &do_hardware_modes 303 .proc_handler = do_hardware_modes
304 }, 304 },
305 PARPORT_DEVICES_ROOT_DIR, 305 PARPORT_DEVICES_ROOT_DIR,
306#ifdef CONFIG_PARPORT_1284 306#ifdef CONFIG_PARPORT_1284
@@ -309,35 +309,35 @@ static const struct parport_sysctl_table parport_sysctl_template = {
309 .data = NULL, 309 .data = NULL,
310 .maxlen = 0, 310 .maxlen = 0,
311 .mode = 0444, 311 .mode = 0444,
312 .proc_handler = &do_autoprobe 312 .proc_handler = do_autoprobe
313 }, 313 },
314 { 314 {
315 .procname = "autoprobe0", 315 .procname = "autoprobe0",
316 .data = NULL, 316 .data = NULL,
317 .maxlen = 0, 317 .maxlen = 0,
318 .mode = 0444, 318 .mode = 0444,
319 .proc_handler = &do_autoprobe 319 .proc_handler = do_autoprobe
320 }, 320 },
321 { 321 {
322 .procname = "autoprobe1", 322 .procname = "autoprobe1",
323 .data = NULL, 323 .data = NULL,
324 .maxlen = 0, 324 .maxlen = 0,
325 .mode = 0444, 325 .mode = 0444,
326 .proc_handler = &do_autoprobe 326 .proc_handler = do_autoprobe
327 }, 327 },
328 { 328 {
329 .procname = "autoprobe2", 329 .procname = "autoprobe2",
330 .data = NULL, 330 .data = NULL,
331 .maxlen = 0, 331 .maxlen = 0,
332 .mode = 0444, 332 .mode = 0444,
333 .proc_handler = &do_autoprobe 333 .proc_handler = do_autoprobe
334 }, 334 },
335 { 335 {
336 .procname = "autoprobe3", 336 .procname = "autoprobe3",
337 .data = NULL, 337 .data = NULL,
338 .maxlen = 0, 338 .maxlen = 0,
339 .mode = 0444, 339 .mode = 0444,
340 .proc_handler = &do_autoprobe 340 .proc_handler = do_autoprobe
341 }, 341 },
342#endif /* IEEE 1284 support */ 342#endif /* IEEE 1284 support */
343 {} 343 {}
@@ -348,7 +348,7 @@ static const struct parport_sysctl_table parport_sysctl_template = {
348 .data = NULL, 348 .data = NULL,
349 .maxlen = 0, 349 .maxlen = 0,
350 .mode = 0444, 350 .mode = 0444,
351 .proc_handler = &do_active_device 351 .proc_handler = do_active_device
352 }, 352 },
353 {} 353 {}
354 }, 354 },
@@ -386,14 +386,13 @@ parport_device_sysctl_template = {
386 .data = NULL, 386 .data = NULL,
387 .maxlen = sizeof(unsigned long), 387 .maxlen = sizeof(unsigned long),
388 .mode = 0644, 388 .mode = 0644,
389 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 389 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
390 .extra1 = (void*) &parport_min_timeslice_value, 390 .extra1 = (void*) &parport_min_timeslice_value,
391 .extra2 = (void*) &parport_max_timeslice_value 391 .extra2 = (void*) &parport_max_timeslice_value
392 }, 392 },
393 }, 393 },
394 { 394 {
395 { 395 {
396 .ctl_name = 0,
397 .procname = NULL, 396 .procname = NULL,
398 .data = NULL, 397 .data = NULL,
399 .maxlen = 0, 398 .maxlen = 0,
@@ -438,7 +437,7 @@ parport_default_sysctl_table = {
438 .data = &parport_default_timeslice, 437 .data = &parport_default_timeslice,
439 .maxlen = sizeof(parport_default_timeslice), 438 .maxlen = sizeof(parport_default_timeslice),
440 .mode = 0644, 439 .mode = 0644,
441 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 440 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
442 .extra1 = (void*) &parport_min_timeslice_value, 441 .extra1 = (void*) &parport_min_timeslice_value,
443 .extra2 = (void*) &parport_max_timeslice_value 442 .extra2 = (void*) &parport_max_timeslice_value
444 }, 443 },
@@ -447,7 +446,7 @@ parport_default_sysctl_table = {
447 .data = &parport_default_spintime, 446 .data = &parport_default_spintime,
448 .maxlen = sizeof(parport_default_spintime), 447 .maxlen = sizeof(parport_default_spintime),
449 .mode = 0644, 448 .mode = 0644,
450 .proc_handler = &proc_dointvec_minmax, 449 .proc_handler = proc_dointvec_minmax,
451 .extra1 = (void*) &parport_min_spintime_value, 450 .extra1 = (void*) &parport_min_spintime_value,
452 .extra2 = (void*) &parport_max_spintime_value 451 .extra2 = (void*) &parport_max_spintime_value
453 }, 452 },
@@ -455,7 +454,6 @@ parport_default_sysctl_table = {
455 }, 454 },
456 { 455 {
457 { 456 {
458 .ctl_name = DEV_PARPORT_DEFAULT,
459 .procname = "default", 457 .procname = "default",
460 .mode = 0555, 458 .mode = 0555,
461 .child = parport_default_sysctl_table.vars 459 .child = parport_default_sysctl_table.vars
@@ -495,7 +493,6 @@ int parport_proc_register(struct parport *port)
495 t->vars[6 + i].extra2 = &port->probe_info[i]; 493 t->vars[6 + i].extra2 = &port->probe_info[i];
496 494
497 t->port_dir[0].procname = port->name; 495 t->port_dir[0].procname = port->name;
498 t->port_dir[0].ctl_name = 0;
499 496
500 t->port_dir[0].child = t->vars; 497 t->port_dir[0].child = t->vars;
501 t->parport_dir[0].child = t->port_dir; 498 t->parport_dir[0].child = t->port_dir;
@@ -534,11 +531,9 @@ int parport_device_proc_register(struct pardevice *device)
534 t->dev_dir[0].child = t->parport_dir; 531 t->dev_dir[0].child = t->parport_dir;
535 t->parport_dir[0].child = t->port_dir; 532 t->parport_dir[0].child = t->port_dir;
536 t->port_dir[0].procname = port->name; 533 t->port_dir[0].procname = port->name;
537 t->port_dir[0].ctl_name = 0;
538 t->port_dir[0].child = t->devices_root_dir; 534 t->port_dir[0].child = t->devices_root_dir;
539 t->devices_root_dir[0].child = t->device_dir; 535 t->devices_root_dir[0].child = t->device_dir;
540 536
541 t->device_dir[0].ctl_name = 0;
542 t->device_dir[0].procname = device->name; 537 t->device_dir[0].procname = device->name;
543 t->device_dir[0].child = t->vars; 538 t->device_dir[0].child = t->vars;
544 t->vars[0].data = &device->timeslice; 539 t->vars[0].data = &device->timeslice;