Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pcmcia: Documentation update

Fill in missing descriptions and update some others for functions in
pcmcia_resource.c.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

+89 -22
+89 -22
drivers/pcmcia/pcmcia_resource.c
··· 6 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 7 * 8 8 * Copyright (C) 1999 David A. Hinds 9 - * Copyright (C) 2004-2005 Dominik Brodowski 9 + * Copyright (C) 2004-2010 Dominik Brodowski 10 10 * 11 11 * This program is free software; you can redistribute it and/or modify 12 12 * it under the terms of the GNU General Public License version 2 as ··· 55 55 } 56 56 57 57 58 + /** 59 + * release_io_space() - release IO ports allocated with alloc_io_space() 60 + * @s: pcmcia socket 61 + * @res: resource to release 62 + * 63 + */ 58 64 static void release_io_space(struct pcmcia_socket *s, struct resource *res) 59 65 { 60 66 resource_size_t num = resource_size(res); ··· 86 80 } 87 81 } 88 82 } 89 - } /* release_io_space */ 83 + } 90 84 91 - /** alloc_io_space 85 + 86 + /** 87 + * alloc_io_space() - allocate IO ports for use by a PCMCIA device 88 + * @s: pcmcia socket 89 + * @res: resource to allocate (begin: begin, end: size) 90 + * @lines: number of IO lines decoded by the PCMCIA card 92 91 * 93 92 * Special stuff for managing IO windows, because they are scarce 94 93 */ ··· 145 134 } 146 135 dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); 147 136 return ret; 148 - } /* alloc_io_space */ 137 + } 149 138 150 139 151 140 /** ··· 185 174 mutex_unlock(&s->ops_mutex); 186 175 187 176 return ret; 188 - } /* pcmcia_access_config */ 177 + } 189 178 190 179 191 180 /** ··· 214 203 EXPORT_SYMBOL(pcmcia_write_config_byte); 215 204 216 205 206 + /** 207 + * pcmcia_map_mem_page() - modify iomem window to point to a different offset 208 + * @p_dev: pcmcia device 209 + * @res: iomem resource already enabled by pcmcia_request_window() 210 + * @offset: card_offset to map 211 + * 212 + * pcmcia_map_mem_page() modifies what can be read and written by accessing 213 + * an iomem range previously enabled by pcmcia_request_window(), by setting 214 + * the card_offset value to @offset. 215 + */ 217 216 int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, 218 217 unsigned int offset) 219 218 { ··· 242 221 dev_warn(&p_dev->dev, "failed to set_mem_map\n"); 243 222 mutex_unlock(&s->ops_mutex); 244 223 return ret; 245 - } /* pcmcia_map_mem_page */ 224 + } 246 225 EXPORT_SYMBOL(pcmcia_map_mem_page); 247 226 248 227 249 228 /** 250 229 * pcmcia_fixup_iowidth() - reduce io width to 8bit 230 + * @p_dev: pcmcia device 251 231 * 252 232 * pcmcia_fixup_iowidth() allows a PCMCIA device driver to reduce the 253 233 * IO width to 8bit after having called pcmcia_enable_device() ··· 297 275 298 276 /** 299 277 * pcmcia_fixup_vpp() - set Vpp to a new voltage level 278 + * @p_dev: pcmcia device 279 + * @new_vpp: new Vpp voltage 300 280 * 301 281 * pcmcia_fixup_vpp() allows a PCMCIA device driver to set Vpp to 302 282 * a new voltage level between calls to pcmcia_enable_device() ··· 336 312 EXPORT_SYMBOL(pcmcia_fixup_vpp); 337 313 338 314 315 + /** 316 + * pcmcia_release_configuration() - physically disable a PCMCIA device 317 + * @p_dev: pcmcia device 318 + * 319 + * pcmcia_release_configuration() is the 1:1 counterpart to 320 + * pcmcia_enable_device(): If a PCMCIA device is no longer used by any 321 + * driver, the Vpp voltage is set to 0, IRQs will no longer be generated, 322 + * and I/O ranges will be disabled. As pcmcia_release_io() and 323 + * pcmcia_release_window() still need to be called, device drivers are 324 + * expected to call pcmcia_disable_device() instead. 325 + */ 339 326 int pcmcia_release_configuration(struct pcmcia_device *p_dev) 340 327 { 341 328 pccard_io_map io = { 0, 0, 0, 0, 1 }; ··· 359 324 if (p_dev->_locked) { 360 325 p_dev->_locked = 0; 361 326 if (--(s->lock_count) == 0) { 362 - s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 327 + s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 363 328 s->socket.Vpp = 0; 364 329 s->socket.io_irq = 0; 365 330 s->ops->set_socket(s, &s->socket); ··· 381 346 mutex_unlock(&s->ops_mutex); 382 347 383 348 return 0; 384 - } /* pcmcia_release_configuration */ 349 + } 385 350 386 351 387 - /** pcmcia_release_io 352 + /** 353 + * pcmcia_release_io() - release I/O allocated by a PCMCIA device 354 + * @p_dev: pcmcia device 388 355 * 389 - * Release_io() releases the I/O ranges allocated by a client. This 390 - * may be invoked some time after a card ejection has already dumped 391 - * the actual socket configuration, so if the client is "stale", we 392 - * don't bother checking the port ranges against the current socket 393 - * values. 356 + * pcmcia_release_io() releases the I/O ranges allocated by a PCMCIA 357 + * device. This may be invoked some time after a card ejection has 358 + * already dumped the actual socket configuration, so if the client is 359 + * "stale", we don't bother checking the port ranges against the 360 + * current socket values. 394 361 */ 395 362 static int pcmcia_release_io(struct pcmcia_device *p_dev) 396 363 { ··· 420 383 return ret; 421 384 } /* pcmcia_release_io */ 422 385 386 + 423 387 /** 424 388 * pcmcia_release_window() - release reserved iomem for PCMCIA devices 389 + * @p_dev: pcmcia device 390 + * @res: iomem resource to release 425 391 * 426 - * pcmcia_release_window() releases struct resource *res which was 392 + * pcmcia_release_window() releases &struct resource *res which was 427 393 * previously reserved by calling pcmcia_request_window(). 428 394 */ 429 395 int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) ··· 471 431 } /* pcmcia_release_window */ 472 432 EXPORT_SYMBOL(pcmcia_release_window); 473 433 434 + 474 435 /** 475 436 * pcmcia_enable_device() - set up and activate a PCMCIA device 437 + * @p_dev: the associated PCMCIA device 476 438 * 439 + * pcmcia_enable_device() physically enables a PCMCIA device. It parses 440 + * the flags passed to in @flags and stored in @p_dev->flags and sets up 441 + * the Vpp voltage, enables the speaker line, I/O ports and store proper 442 + * values to configuration registers. 477 443 */ 478 444 int pcmcia_enable_device(struct pcmcia_device *p_dev) 479 445 { ··· 611 565 612 566 /** 613 567 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices 568 + * @p_dev: the associated PCMCIA device 614 569 * 615 - * pcmcia_request_io() attepts to reserve the IO port ranges specified in 570 + * pcmcia_request_io() attempts to reserve the IO port ranges specified in 616 571 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The 617 572 * "start" value is the requested start of the IO port resource; "end" 618 573 * reflects the number of ports requested. The number of IO lines requested ··· 677 630 678 631 /** 679 632 * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device 633 + * @p_dev: the associated PCMCIA device 634 + * @handler: IRQ handler to register 680 635 * 681 - * pcmcia_request_irq() is a wrapper around request_irq which will allow 636 + * pcmcia_request_irq() is a wrapper around request_irq() which allows 682 637 * the PCMCIA core to clean up the registration in pcmcia_disable_device(). 683 638 * Drivers are free to use request_irq() directly, but then they need to 684 - * call free_irq themselfves, too. Also, only IRQF_SHARED capable IRQ 639 + * call free_irq() themselfves, too. Also, only %IRQF_SHARED capable IRQ 685 640 * handlers are allowed. 686 641 */ 687 642 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, ··· 706 657 707 658 /** 708 659 * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first 660 + * @p_dev: the associated PCMCIA device 661 + * @handler: IRQ handler to register 709 662 * 710 - * pcmcia_request_exclusive_irq() is a wrapper around request_irq which 663 + * pcmcia_request_exclusive_irq() is a wrapper around request_irq() which 711 664 * attempts first to request an exclusive IRQ. If it fails, it also accepts 712 665 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for 713 666 * IRQ sharing and either use request_irq directly (then they need to call 714 - * free_irq themselves, too), or the pcmcia_request_irq() function. 667 + * free_irq() themselves, too), or the pcmcia_request_irq() function. 715 668 */ 716 669 int __must_check 717 670 __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, ··· 856 805 857 806 /** 858 807 * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices 808 + * @p_dev: the associated PCMCIA device 809 + * @res: &struct resource pointing to p_dev->resource[2..5] 810 + * @speed: access speed 859 811 * 860 812 * pcmcia_request_window() attepts to reserve an iomem ranges specified in 861 - * struct resource *res pointing to one of the entries in 862 - * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the 813 + * &struct resource @res pointing to one of the entries in 814 + * &struct pcmcia_device @p_dev->resource[2..5]. The "start" value is the 863 815 * requested start of the IO mem resource; "end" reflects the size 864 816 * requested. 865 817 */ ··· 954 900 } /* pcmcia_request_window */ 955 901 EXPORT_SYMBOL(pcmcia_request_window); 956 902 903 + 904 + /** 905 + * pcmcia_disable_device() - disable and clean up a PCMCIA device 906 + * @p_dev: the associated PCMCIA device 907 + * 908 + * pcmcia_disable_device() is the driver-callable counterpart to 909 + * pcmcia_enable_device(): If a PCMCIA device is no longer used, 910 + * drivers are expected to clean up and disable the device by calling 911 + * this function. Any I/O ranges (iomem and ioports) will be released, 912 + * the Vpp voltage will be set to 0, and IRQs will no longer be 913 + * generated -- at least if there is no other card function (of 914 + * multifunction devices) being used. 915 + */ 957 916 void pcmcia_disable_device(struct pcmcia_device *p_dev) 958 917 { 959 918 int i;