aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/parport-lowlevel.txt29
-rw-r--r--drivers/parport/daisy.c29
-rw-r--r--drivers/parport/procfs.c38
-rw-r--r--include/linux/parport.h1
4 files changed, 8 insertions, 89 deletions
diff --git a/Documentation/parport-lowlevel.txt b/Documentation/parport-lowlevel.txt
index 8f2302415eff..265fcdcb8e5f 100644
--- a/Documentation/parport-lowlevel.txt
+++ b/Documentation/parport-lowlevel.txt
@@ -25,7 +25,6 @@ Global functions:
25 parport_open 25 parport_open
26 parport_close 26 parport_close
27 parport_device_id 27 parport_device_id
28 parport_device_num
29 parport_device_coords 28 parport_device_coords
30 parport_find_class 29 parport_find_class
31 parport_find_device 30 parport_find_device
@@ -735,7 +734,7 @@ NULL is returned.
735 734
736SEE ALSO 735SEE ALSO
737 736
738parport_register_device, parport_device_num 737parport_register_device
739 738
740parport_close - unregister device for particular device number 739parport_close - unregister device for particular device number
741------------- 740-------------
@@ -787,29 +786,7 @@ Many devices have ill-formed IEEE 1284 Device IDs.
787 786
788SEE ALSO 787SEE ALSO
789 788
790parport_find_class, parport_find_device, parport_device_num 789parport_find_class, parport_find_device
791
792parport_device_num - convert device coordinates to device number
793------------------
794
795SYNOPSIS
796
797#include <linux/parport.h>
798
799int parport_device_num (int parport, int mux, int daisy);
800
801DESCRIPTION
802
803Convert between device coordinates (port, multiplexor, daisy chain
804address) and device number (zero-based).
805
806RETURN VALUE
807
808Device number, or -1 if no device at given coordinates.
809
810SEE ALSO
811
812parport_device_coords, parport_open, parport_device_id
813 790
814parport_device_coords - convert device number to device coordinates 791parport_device_coords - convert device number to device coordinates
815------------------ 792------------------
@@ -833,7 +810,7 @@ Zero on success, in which case the coordinates are (*parport, *mux,
833 810
834SEE ALSO 811SEE ALSO
835 812
836parport_device_num, parport_open, parport_device_id 813parport_open, parport_device_id
837 814
838parport_find_class - find a device by its class 815parport_find_class - find a device by its class
839------------------ 816------------------
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
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 9cdd6943e01b..ec3f76598327 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -510,7 +510,6 @@ extern struct pardevice *parport_open (int devnum, const char *name,
510 int flags, void *handle); 510 int flags, void *handle);
511extern void parport_close (struct pardevice *dev); 511extern void parport_close (struct pardevice *dev);
512extern ssize_t parport_device_id (int devnum, char *buffer, size_t len); 512extern ssize_t parport_device_id (int devnum, char *buffer, size_t len);
513extern int parport_device_num (int parport, int mux, int daisy);
514extern void parport_daisy_deselect_all (struct parport *port); 513extern void parport_daisy_deselect_all (struct parport *port);
515extern int parport_daisy_select (struct parport *port, int daisy, int mode); 514extern int parport_daisy_select (struct parport *port, int daisy, int mode);
516 515