aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/parport/daisy.c29
-rw-r--r--drivers/parport/procfs.c38
2 files changed, 5 insertions, 62 deletions
diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c
index ff9f34453530..5bbff2028f8f 100644
--- a/drivers/parport/daisy.c
+++ b/drivers/parport/daisy.c
@@ -275,35 +275,6 @@ void parport_close(struct pardevice *dev)
275 parport_unregister_device(dev); 275 parport_unregister_device(dev);
276} 276}
277 277
278/**
279 * parport_device_num - convert device coordinates
280 * @parport: parallel port number
281 * @mux: multiplexor port number (-1 for no multiplexor)
282 * @daisy: daisy chain address (-1 for no daisy chain address)
283 *
284 * This tries to locate a device on the given parallel port,
285 * multiplexor port and daisy chain address, and returns its
286 * device number or %-ENXIO if no device with those coordinates
287 * exists.
288 **/
289
290int parport_device_num(int parport, int mux, int daisy)
291{
292 int res = -ENXIO;
293 struct daisydev *dev;
294
295 spin_lock(&topology_lock);
296 dev = topology;
297 while (dev && dev->port->portnum != parport &&
298 dev->port->muxport != mux && dev->daisy != daisy)
299 dev = dev->next;
300 if (dev)
301 res = dev->devnum;
302 spin_unlock(&topology_lock);
303
304 return res;
305}
306
307/* Send a daisy-chain-style CPP command packet. */ 278/* Send a daisy-chain-style CPP command packet. */
308static int cpp_daisy(struct parport *port, int cmd) 279static int cpp_daisy(struct parport *port, int cmd)
309{ 280{
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index bdbdab9285ca..ed82e41210d1 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -237,7 +237,7 @@ static int do_hardware_modes (ctl_table *table, int write,
237#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ 237#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .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) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD }
240#define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \ 240#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \
241 .mode = 0555, .child = NULL } 241 .mode = 0555, .child = NULL }
242 242
243static const unsigned long parport_min_timeslice_value = 243static const unsigned long parport_min_timeslice_value =
@@ -266,7 +266,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
266 .sysctl_header = NULL, 266 .sysctl_header = NULL,
267 { 267 {
268 { 268 {
269 .ctl_name = DEV_PARPORT_SPINTIME,
270 .procname = "spintime", 269 .procname = "spintime",
271 .data = NULL, 270 .data = NULL,
272 .maxlen = sizeof(int), 271 .maxlen = sizeof(int),
@@ -276,7 +275,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
276 .extra2 = (void*) &parport_max_spintime_value 275 .extra2 = (void*) &parport_max_spintime_value
277 }, 276 },
278 { 277 {
279 .ctl_name = DEV_PARPORT_BASE_ADDR,
280 .procname = "base-addr", 278 .procname = "base-addr",
281 .data = NULL, 279 .data = NULL,
282 .maxlen = 0, 280 .maxlen = 0,
@@ -284,7 +282,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
284 .proc_handler = &do_hardware_base_addr 282 .proc_handler = &do_hardware_base_addr
285 }, 283 },
286 { 284 {
287 .ctl_name = DEV_PARPORT_IRQ,
288 .procname = "irq", 285 .procname = "irq",
289 .data = NULL, 286 .data = NULL,
290 .maxlen = 0, 287 .maxlen = 0,
@@ -292,7 +289,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
292 .proc_handler = &do_hardware_irq 289 .proc_handler = &do_hardware_irq
293 }, 290 },
294 { 291 {
295 .ctl_name = DEV_PARPORT_DMA,
296 .procname = "dma", 292 .procname = "dma",
297 .data = NULL, 293 .data = NULL,
298 .maxlen = 0, 294 .maxlen = 0,
@@ -300,7 +296,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
300 .proc_handler = &do_hardware_dma 296 .proc_handler = &do_hardware_dma
301 }, 297 },
302 { 298 {
303 .ctl_name = DEV_PARPORT_MODES,
304 .procname = "modes", 299 .procname = "modes",
305 .data = NULL, 300 .data = NULL,
306 .maxlen = 0, 301 .maxlen = 0,
@@ -310,7 +305,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
310 PARPORT_DEVICES_ROOT_DIR, 305 PARPORT_DEVICES_ROOT_DIR,
311#ifdef CONFIG_PARPORT_1284 306#ifdef CONFIG_PARPORT_1284
312 { 307 {
313 .ctl_name = DEV_PARPORT_AUTOPROBE,
314 .procname = "autoprobe", 308 .procname = "autoprobe",
315 .data = NULL, 309 .data = NULL,
316 .maxlen = 0, 310 .maxlen = 0,
@@ -318,7 +312,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
318 .proc_handler = &do_autoprobe 312 .proc_handler = &do_autoprobe
319 }, 313 },
320 { 314 {
321 .ctl_name = DEV_PARPORT_AUTOPROBE + 1,
322 .procname = "autoprobe0", 315 .procname = "autoprobe0",
323 .data = NULL, 316 .data = NULL,
324 .maxlen = 0, 317 .maxlen = 0,
@@ -326,7 +319,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
326 .proc_handler = &do_autoprobe 319 .proc_handler = &do_autoprobe
327 }, 320 },
328 { 321 {
329 .ctl_name = DEV_PARPORT_AUTOPROBE + 2,
330 .procname = "autoprobe1", 322 .procname = "autoprobe1",
331 .data = NULL, 323 .data = NULL,
332 .maxlen = 0, 324 .maxlen = 0,
@@ -334,7 +326,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
334 .proc_handler = &do_autoprobe 326 .proc_handler = &do_autoprobe
335 }, 327 },
336 { 328 {
337 .ctl_name = DEV_PARPORT_AUTOPROBE + 3,
338 .procname = "autoprobe2", 329 .procname = "autoprobe2",
339 .data = NULL, 330 .data = NULL,
340 .maxlen = 0, 331 .maxlen = 0,
@@ -342,7 +333,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
342 .proc_handler = &do_autoprobe 333 .proc_handler = &do_autoprobe
343 }, 334 },
344 { 335 {
345 .ctl_name = DEV_PARPORT_AUTOPROBE + 4,
346 .procname = "autoprobe3", 336 .procname = "autoprobe3",
347 .data = NULL, 337 .data = NULL,
348 .maxlen = 0, 338 .maxlen = 0,
@@ -354,7 +344,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
354 }, 344 },
355 { 345 {
356 { 346 {
357 .ctl_name = DEV_PARPORT_DEVICES_ACTIVE,
358 .procname = "active", 347 .procname = "active",
359 .data = NULL, 348 .data = NULL,
360 .maxlen = 0, 349 .maxlen = 0,
@@ -393,7 +382,6 @@ parport_device_sysctl_template = {
393 .sysctl_header = NULL, 382 .sysctl_header = NULL,
394 { 383 {
395 { 384 {
396 .ctl_name = DEV_PARPORT_DEVICE_TIMESLICE,
397 .procname = "timeslice", 385 .procname = "timeslice",
398 .data = NULL, 386 .data = NULL,
399 .maxlen = sizeof(int), 387 .maxlen = sizeof(int),
@@ -449,7 +437,6 @@ parport_default_sysctl_table = {
449 .sysctl_header = NULL, 437 .sysctl_header = NULL,
450 { 438 {
451 { 439 {
452 .ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE,
453 .procname = "timeslice", 440 .procname = "timeslice",
454 .data = &parport_default_timeslice, 441 .data = &parport_default_timeslice,
455 .maxlen = sizeof(parport_default_timeslice), 442 .maxlen = sizeof(parport_default_timeslice),
@@ -459,7 +446,6 @@ parport_default_sysctl_table = {
459 .extra2 = (void*) &parport_max_timeslice_value 446 .extra2 = (void*) &parport_max_timeslice_value
460 }, 447 },
461 { 448 {
462 .ctl_name = DEV_PARPORT_DEFAULT_SPINTIME,
463 .procname = "spintime", 449 .procname = "spintime",
464 .data = &parport_default_spintime, 450 .data = &parport_default_spintime,
465 .maxlen = sizeof(parport_default_spintime), 451 .maxlen = sizeof(parport_default_spintime),
@@ -502,7 +488,7 @@ int parport_proc_register(struct parport *port)
502 488
503 t->device_dir[0].extra1 = port; 489 t->device_dir[0].extra1 = port;
504 490
505 for (i = 0; i < 8; i++) 491 for (i = 0; i < 5; i++)
506 t->vars[i].extra1 = port; 492 t->vars[i].extra1 = port;
507 493
508 t->vars[0].data = &port->spintime; 494 t->vars[0].data = &port->spintime;
@@ -512,7 +498,7 @@ int parport_proc_register(struct parport *port)
512 t->vars[6 + i].extra2 = &port->probe_info[i]; 498 t->vars[6 + i].extra2 = &port->probe_info[i];
513 499
514 t->port_dir[0].procname = port->name; 500 t->port_dir[0].procname = port->name;
515 t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ 501 t->port_dir[0].ctl_name = 0;
516 502
517 t->port_dir[0].child = t->vars; 503 t->port_dir[0].child = t->vars;
518 t->parport_dir[0].child = t->port_dir; 504 t->parport_dir[0].child = t->port_dir;
@@ -551,26 +537,12 @@ int parport_device_proc_register(struct pardevice *device)
551 t->dev_dir[0].child = t->parport_dir; 537 t->dev_dir[0].child = t->parport_dir;
552 t->parport_dir[0].child = t->port_dir; 538 t->parport_dir[0].child = t->port_dir;
553 t->port_dir[0].procname = port->name; 539 t->port_dir[0].procname = port->name;
554 t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ 540 t->port_dir[0].ctl_name = 0;
555 t->port_dir[0].child = t->devices_root_dir; 541 t->port_dir[0].child = t->devices_root_dir;
556 t->devices_root_dir[0].child = t->device_dir; 542 t->devices_root_dir[0].child = t->device_dir;
557 543
558#ifdef CONFIG_PARPORT_1284 544 t->device_dir[0].ctl_name = 0;
559
560 t->device_dir[0].ctl_name =
561 parport_device_num(port->number, port->muxport,
562 device->daisy)
563 + 1; /* nb 0 isn't legal here */
564
565#else /* No IEEE 1284 support */
566
567 /* parport_device_num isn't available. */
568 t->device_dir[0].ctl_name = 1;
569
570#endif /* IEEE 1284 support or not */
571
572 t->device_dir[0].procname = device->name; 545 t->device_dir[0].procname = device->name;
573 t->device_dir[0].extra1 = device;
574 t->device_dir[0].child = t->vars; 546 t->device_dir[0].child = t->vars;
575 t->vars[0].data = &device->timeslice; 547 t->vars[0].data = &device->timeslice;
576 548