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

ieee1394: move some comments from declaration to definition

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+349 -240
+5 -2
drivers/ieee1394/config_roms.c
··· 39 39 unsigned int flag; 40 40 }; 41 41 42 - 42 + /* The default host entry. This must succeed. */ 43 43 int hpsb_default_host_entry(struct hpsb_host *host) 44 44 { 45 45 struct csr1212_keyval *root; ··· 170 170 NULL, 171 171 }; 172 172 173 - 173 + /* Initialize all config roms */ 174 174 int hpsb_init_config_roms(void) 175 175 { 176 176 int i, error = 0; ··· 191 191 return error; 192 192 } 193 193 194 + /* Cleanup all config roms */ 194 195 void hpsb_cleanup_config_roms(void) 195 196 { 196 197 int i; ··· 202 201 } 203 202 } 204 203 204 + /* Add extra config roms to specified host */ 205 205 int hpsb_add_extra_config_roms(struct hpsb_host *host) 206 206 { 207 207 int i, error = 0; ··· 221 219 return error; 222 220 } 223 221 222 + /* Remove extra config roms from specified host */ 224 223 void hpsb_remove_extra_config_roms(struct hpsb_host *host) 225 224 { 226 225 int i;
-10
drivers/ieee1394/config_roms.h
··· 4 4 #include "ieee1394_types.h" 5 5 #include "hosts.h" 6 6 7 - /* The default host entry. This must succeed. */ 8 7 int hpsb_default_host_entry(struct hpsb_host *host); 9 - 10 - /* Initialize all config roms */ 11 8 int hpsb_init_config_roms(void); 12 - 13 - /* Cleanup all config roms */ 14 9 void hpsb_cleanup_config_roms(void); 15 - 16 - /* Add extra config roms to specified host */ 17 10 int hpsb_add_extra_config_roms(struct hpsb_host *host); 18 - 19 - /* Remove extra config roms from specified host */ 20 11 void hpsb_remove_extra_config_roms(struct hpsb_host *host); 21 - 22 12 23 13 /* List of flags to check if a host contains a certain extra config rom 24 14 * entry. Available in the host->config_roms member. */
+24
drivers/ieee1394/dma.c
··· 62 62 63 63 /* dma_region */ 64 64 65 + /** 66 + * dma_region_init - clear out all fields but do not allocate anything 67 + */ 65 68 void dma_region_init(struct dma_region *dma) 66 69 { 67 70 dma->kvirt = NULL; ··· 74 71 dma->sglist = NULL; 75 72 } 76 73 74 + /** 75 + * dma_region_alloc - allocate the buffer and map it to the IOMMU 76 + */ 77 77 int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, 78 78 struct pci_dev *dev, int direction) 79 79 { ··· 134 128 return -ENOMEM; 135 129 } 136 130 131 + /** 132 + * dma_region_free - unmap and free the buffer 133 + */ 137 134 void dma_region_free(struct dma_region *dma) 138 135 { 139 136 if (dma->n_dma_pages) { ··· 176 167 return i; 177 168 } 178 169 170 + /** 171 + * dma_region_offset_to_bus - get bus address of an offset within a DMA region 172 + * 173 + * Returns the DMA bus address of the byte with the given @offset relative to 174 + * the beginning of the @dma. 175 + */ 179 176 dma_addr_t dma_region_offset_to_bus(struct dma_region * dma, 180 177 unsigned long offset) 181 178 { ··· 192 177 return sg_dma_address(sg) + rem; 193 178 } 194 179 180 + /** 181 + * dma_region_sync_for_cpu - sync the CPU's view of the buffer 182 + */ 195 183 void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, 196 184 unsigned long len) 197 185 { ··· 211 193 dma->direction); 212 194 } 213 195 196 + /** 197 + * dma_region_sync_for_device - sync the IO bus' view of the buffer 198 + */ 214 199 void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, 215 200 unsigned long len) 216 201 { ··· 265 244 .nopage = dma_region_pagefault, 266 245 }; 267 246 247 + /** 248 + * dma_region_mmap - map the buffer into a user space process 249 + */ 268 250 int dma_region_mmap(struct dma_region *dma, struct file *file, 269 251 struct vm_area_struct *vma) 270 252 {
+6 -18
drivers/ieee1394/dma.h
··· 66 66 int direction; 67 67 }; 68 68 69 - /* clear out all fields but do not allocate anything */ 70 69 void dma_region_init(struct dma_region *dma); 71 - 72 - /* allocate the buffer and map it to the IOMMU */ 73 70 int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, 74 71 struct pci_dev *dev, int direction); 75 - 76 - /* unmap and free the buffer */ 77 72 void dma_region_free(struct dma_region *dma); 78 - 79 - /* sync the CPU's view of the buffer */ 80 73 void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, 81 74 unsigned long len); 82 - 83 - /* sync the IO bus' view of the buffer */ 84 75 void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, 85 76 unsigned long len); 86 - 87 - /* map the buffer into a user space process */ 88 77 int dma_region_mmap(struct dma_region *dma, struct file *file, 89 78 struct vm_area_struct *vma); 90 - 91 - /* macro to index into a DMA region (or dma_prog_region) */ 92 - #define dma_region_i(_dma, _type, _index) \ 93 - ( ((_type*) ((_dma)->kvirt)) + (_index) ) 94 - 95 - /* return the DMA bus address of the byte with the given offset 96 - * relative to the beginning of the dma_region */ 97 79 dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, 98 80 unsigned long offset); 81 + 82 + /** 83 + * dma_region_i - macro to index into a DMA region (or dma_prog_region) 84 + */ 85 + #define dma_region_i(_dma, _type, _index) \ 86 + ( ((_type*) ((_dma)->kvirt)) + (_index) ) 99 87 100 88 #endif /* IEEE1394_DMA_H */
+86 -3
drivers/ieee1394/highlevel.c
··· 70 70 return NULL; 71 71 } 72 72 73 - /* Returns a per host/driver data structure that was previously stored by 74 - * hpsb_create_hostinfo. */ 73 + /** 74 + * hpsb_get_hostinfo - retrieve a hostinfo pointer bound to this driver/host 75 + * 76 + * Returns a per @host and @hl driver data structure that was previously stored 77 + * by hpsb_create_hostinfo. 78 + */ 75 79 void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host) 76 80 { 77 81 struct hl_host_info *hi = hl_get_hostinfo(hl, host); ··· 83 79 return hi ? hi->data : NULL; 84 80 } 85 81 86 - /* If size is zero, then the return here is only valid for error checking */ 82 + /** 83 + * hpsb_create_hostinfo - allocate a hostinfo pointer bound to this driver/host 84 + * 85 + * Allocate a hostinfo pointer backed by memory with @data_size and bind it to 86 + * to this @hl driver and @host. If @data_size is zero, then the return here is 87 + * only valid for error checking. 88 + */ 87 89 void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, 88 90 size_t data_size) 89 91 { ··· 123 113 return data; 124 114 } 125 115 116 + /** 117 + * hpsb_set_hostinfo - set the hostinfo pointer to something useful 118 + * 119 + * Usually follows a call to hpsb_create_hostinfo, where the size is 0. 120 + */ 126 121 int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, 127 122 void *data) 128 123 { ··· 147 132 return -EINVAL; 148 133 } 149 134 135 + /** 136 + * hpsb_destroy_hostinfo - free and remove a hostinfo pointer 137 + * 138 + * Free and remove the hostinfo pointer bound to this @hl driver and @host. 139 + */ 150 140 void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host) 151 141 { 152 142 struct hl_host_info *hi; ··· 167 147 return; 168 148 } 169 149 150 + /** 151 + * hpsb_set_hostinfo_key - set an alternate lookup key for an hostinfo 152 + * 153 + * Sets an alternate lookup key for the hostinfo bound to this @hl driver and 154 + * @host. 155 + */ 170 156 void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, 171 157 unsigned long key) 172 158 { ··· 184 158 return; 185 159 } 186 160 161 + /** 162 + * hpsb_get_hostinfo_bykey - retrieve a hostinfo pointer by its alternate key 163 + */ 187 164 void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key) 188 165 { 189 166 struct hl_host_info *hi; ··· 218 189 return 0; 219 190 } 220 191 192 + /** 193 + * hpsb_register_highlevel - register highlevel driver 194 + * 195 + * The name pointer in @hl has to stay valid at all times because the string is 196 + * not copied. 197 + */ 221 198 void hpsb_register_highlevel(struct hpsb_highlevel *hl) 222 199 { 223 200 unsigned long flags; ··· 293 258 return 0; 294 259 } 295 260 261 + /** 262 + * hpsb_unregister_highlevel - unregister highlevel driver 263 + */ 296 264 void hpsb_unregister_highlevel(struct hpsb_highlevel *hl) 297 265 { 298 266 unsigned long flags; ··· 311 273 nodemgr_for_each_host(hl, highlevel_for_each_host_unreg); 312 274 } 313 275 276 + /** 277 + * hpsb_allocate_and_register_addrspace - alloc' and reg' a host address space 278 + * 279 + * @start and @end are 48 bit pointers and have to be quadlet aligned. 280 + * @end points to the first address behind the handled addresses. This 281 + * function can be called multiple times for a single hpsb_highlevel @hl to 282 + * implement sparse register sets. The requested region must not overlap any 283 + * previously allocated region, otherwise registering will fail. 284 + * 285 + * It returns true for successful allocation. Address spaces can be 286 + * unregistered with hpsb_unregister_addrspace. All remaining address spaces 287 + * are automatically deallocated together with the hpsb_highlevel @hl. 288 + */ 314 289 u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, 315 290 struct hpsb_host *host, 316 291 struct hpsb_address_ops *ops, ··· 399 348 return retval; 400 349 } 401 350 351 + /** 352 + * hpsb_register_addrspace - register a host address space 353 + * 354 + * @start and @end are 48 bit pointers and have to be quadlet aligned. 355 + * @end points to the first address behind the handled addresses. This 356 + * function can be called multiple times for a single hpsb_highlevel @hl to 357 + * implement sparse register sets. The requested region must not overlap any 358 + * previously allocated region, otherwise registering will fail. 359 + * 360 + * It returns true for successful allocation. Address spaces can be 361 + * unregistered with hpsb_unregister_addrspace. All remaining address spaces 362 + * are automatically deallocated together with the hpsb_highlevel @hl. 363 + */ 402 364 int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 403 365 struct hpsb_address_ops *ops, u64 start, u64 end) 404 366 { ··· 483 419 return retval; 484 420 } 485 421 422 + /** 423 + * hpsb_listen_channel - enable receving a certain isochronous channel 424 + * 425 + * Reception is handled through the @hl's iso_receive op. 426 + */ 486 427 int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 487 428 unsigned int channel) 488 429 { ··· 500 431 return 0; 501 432 } 502 433 434 + /** 435 + * hpsb_unlisten_channel - disable receving a certain isochronous channel 436 + */ 503 437 void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 504 438 unsigned int channel) 505 439 { ··· 600 528 read_unlock_irqrestore(&hl_irqs_lock, flags); 601 529 } 602 530 531 + /* 532 + * highlevel_read, highlevel_write, highlevel_lock, highlevel_lock64: 533 + * 534 + * These functions are called to handle transactions. They are called when a 535 + * packet arrives. The flags argument contains the second word of the first 536 + * header quadlet of the incoming packet (containing transaction label, retry 537 + * code, transaction code and priority). These functions either return a 538 + * response code or a negative number. In the first case a response will be 539 + * generated. In the latter case, no response will be sent and the driver which 540 + * handled the request will send the response itself. 541 + */ 603 542 int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr, 604 543 unsigned int length, u16 flags) 605 544 {
+1 -45
drivers/ieee1394/highlevel.h
··· 99 99 void highlevel_add_host(struct hpsb_host *host); 100 100 void highlevel_remove_host(struct hpsb_host *host); 101 101 void highlevel_host_reset(struct hpsb_host *host); 102 - 103 - /* 104 - * These functions are called to handle transactions. They are called when a 105 - * packet arrives. The flags argument contains the second word of the first 106 - * header quadlet of the incoming packet (containing transaction label, retry 107 - * code, transaction code and priority). These functions either return a 108 - * response code or a negative number. In the first case a response will be 109 - * generated. In the latter case, no response will be sent and the driver which 110 - * handled the request will send the response itself. 111 - */ 112 102 int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr, 113 103 unsigned int length, u16 flags); 114 104 int highlevel_write(struct hpsb_host *host, int nodeid, int destid, void *data, ··· 109 119 int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store, 110 120 u64 addr, octlet_t data, octlet_t arg, int ext_tcode, 111 121 u16 flags); 112 - 113 122 void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length); 114 123 void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, 115 124 void *data, size_t length); 116 125 117 - /* 118 - * Register highlevel driver. The name pointer has to stay valid at all times 119 - * because the string is not copied. 120 - */ 121 126 void hpsb_register_highlevel(struct hpsb_highlevel *hl); 122 127 void hpsb_unregister_highlevel(struct hpsb_highlevel *hl); 123 128 124 - /* 125 - * Register handlers for host address spaces. Start and end are 48 bit pointers 126 - * and have to be quadlet aligned. Argument "end" points to the first address 127 - * behind the handled addresses. This function can be called multiple times for 128 - * a single hpsb_highlevel to implement sparse register sets. The requested 129 - * region must not overlap any previously allocated region, otherwise 130 - * registering will fail. 131 - * 132 - * It returns true for successful allocation. Address spaces can be 133 - * unregistered with hpsb_unregister_addrspace. All remaining address spaces 134 - * are automatically deallocated together with the hpsb_highlevel. 135 - */ 136 129 u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, 137 130 struct hpsb_host *host, 138 131 struct hpsb_address_ops *ops, ··· 125 152 struct hpsb_address_ops *ops, u64 start, u64 end); 126 153 int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 127 154 u64 start); 128 - 129 - /* 130 - * Enable or disable receving a certain isochronous channel through the 131 - * iso_receive op. 132 - */ 133 155 int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 134 - unsigned int channel); 156 + unsigned int channel); 135 157 void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 136 158 unsigned int channel); 137 159 138 - /* Retrieve a hostinfo pointer bound to this driver/host */ 139 160 void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); 140 - 141 - /* Allocate a hostinfo pointer of data_size bound to this driver/host */ 142 161 void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, 143 162 size_t data_size); 144 - 145 - /* Free and remove the hostinfo pointer bound to this driver/host */ 146 163 void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); 147 - 148 - /* Set an alternate lookup key for the hostinfo bound to this driver/host */ 149 164 void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, 150 165 unsigned long key); 151 - 152 - /* Retrieve a hostinfo pointer bound to this driver using its alternate key */ 153 166 void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key); 154 - 155 - /* Set the hostinfo pointer to something useful. Usually follows a call to 156 - * hpsb_create_hostinfo, where the size is 0. */ 157 167 int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, 158 168 void *data); 159 169
+8
drivers/ieee1394/hosts.c
··· 218 218 device_unregister(&host->device); 219 219 } 220 220 221 + /** 222 + * hpsb_update_config_rom_image - updates configuration ROM image of a host 223 + * 224 + * Updates the configuration ROM image of a host. rom_version must be the 225 + * current version, otherwise it will fail with return value -1. If this 226 + * host does not support config-rom-update, it will return -%EINVAL. 227 + * Return value 0 indicates success. 228 + */ 221 229 int hpsb_update_config_rom_image(struct hpsb_host *host) 222 230 { 223 231 unsigned long reset_delay;
-6
drivers/ieee1394/hosts.h
··· 202 202 int hpsb_add_host(struct hpsb_host *host); 203 203 void hpsb_resume_host(struct hpsb_host *host); 204 204 void hpsb_remove_host(struct hpsb_host *host); 205 - 206 - /* Updates the configuration rom image of a host. rom_version must be the 207 - * current version, otherwise it will fail with return value -1. If this 208 - * host does not support config-rom-update, it will return -EINVAL. 209 - * Return value 0 indicates success. 210 - */ 211 205 int hpsb_update_config_rom_image(struct hpsb_host *host); 212 206 213 207 #endif /* _IEEE1394_HOSTS_H */
+69 -8
drivers/ieee1394/ieee1394_core.c
··· 96 96 97 97 98 98 /** 99 - * hpsb_set_packet_complete_task - set the task that runs when a packet 100 - * completes. You cannot call this more than once on a single packet 101 - * before it is sent. 102 - * 99 + * hpsb_set_packet_complete_task - set task that runs when a packet completes 103 100 * @packet: the packet whose completion we want the task added to 104 101 * @routine: function to call 105 102 * @data: data (if any) to pass to the above function 103 + * 104 + * Set the task that runs when a packet completes. You cannot call this more 105 + * than once on a single packet before it is sent. 106 106 */ 107 107 void hpsb_set_packet_complete_task(struct hpsb_packet *packet, 108 108 void (*routine)(void *), void *data) ··· 179 179 } 180 180 181 181 182 + /** 183 + * hpsb_reset_bus - initiate bus reset on the given host 184 + * @host: host controller whose bus to reset 185 + * @type: one of enum reset_types 186 + * 187 + * Returns 1 if bus reset already in progress, 0 otherwise. 188 + */ 182 189 int hpsb_reset_bus(struct hpsb_host *host, int type) 183 190 { 184 191 if (!host->in_bus_reset) { ··· 236 229 return 0; 237 230 } 238 231 232 + /** 233 + * hpsb_bus_reset - notify a bus reset to the core 234 + * 235 + * For host driver module usage. Safe to use in interrupt context, although 236 + * quite complex; so you may want to run it in the bottom rather than top half. 237 + * 238 + * Returns 1 if bus reset already in progress, 0 otherwise. 239 + */ 239 240 int hpsb_bus_reset(struct hpsb_host *host) 240 241 { 241 242 if (host->in_bus_reset) { ··· 420 405 } 421 406 422 407 408 + /** 409 + * hpsb_selfid_received - hand over received selfid packet to the core 410 + * 411 + * For host driver module usage. Safe to use in interrupt context. 412 + * 413 + * The host driver should have done a successful complement check (second 414 + * quadlet is complement of first) beforehand. 415 + */ 423 416 void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid) 424 417 { 425 418 if (host->in_bus_reset) { ··· 439 416 } 440 417 } 441 418 419 + /** 420 + * hpsb_selfid_complete - notify completion of SelfID stage to the core 421 + * 422 + * For host driver module usage. Safe to use in interrupt context, although 423 + * quite complex; so you may want to run it in the bottom rather than top half. 424 + * 425 + * Notify completion of SelfID stage to the core and report new physical ID 426 + * and whether host is root now. 427 + */ 442 428 void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot) 443 429 { 444 430 if (!host->in_bus_reset) ··· 494 462 highlevel_host_reset(host); 495 463 } 496 464 497 - 465 + /** 466 + * hpsb_packet_sent - notify core of sending a packet 467 + * 468 + * For host driver module usage. Safe to call from within a transmit packet 469 + * routine. 470 + * 471 + * Notify core of sending a packet. Ackcode is the ack code returned for async 472 + * transmits or ACKX_SEND_ERROR if the transmission failed completely; ACKX_NONE 473 + * for other cases (internal errors that don't justify a panic). 474 + */ 498 475 void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet, 499 476 int ackcode) 500 477 { ··· 545 504 * @rootid: root whose force_root bit should get set (-1 = don't set force_root) 546 505 * @gapcnt: gap count value to set (-1 = don't set gap count) 547 506 * 548 - * This function sends a PHY config packet on the bus through the specified host. 507 + * This function sends a PHY config packet on the bus through the specified 508 + * host. 549 509 * 550 - * Return value: 0 for success or error number otherwise. 510 + * Return value: 0 for success or negative error number otherwise. 551 511 */ 552 512 int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt) 553 513 { ··· 663 621 complete((struct completion *) data); 664 622 } 665 623 624 + /** 625 + * hpsb_send_packet_and_wait - enqueue packet, block until transaction completes 626 + * @packet: packet to send 627 + * 628 + * Return value: 0 on success, negative errno on failure. 629 + */ 666 630 int hpsb_send_packet_and_wait(struct hpsb_packet *packet) 667 631 { 668 632 struct completion done; ··· 983 935 } 984 936 #undef PREP_REPLY_PACKET 985 937 986 - 938 + /** 939 + * hpsb_packet_received - hand over received packet to the core 940 + * 941 + * For host driver module usage. 942 + * 943 + * The contents of data are expected to be the full packet but with the CRCs 944 + * left out (data block follows header immediately), with the header (i.e. the 945 + * first four quadlets) in machine byte order and the data block in big endian. 946 + * *@data can be safely overwritten after this call. 947 + * 948 + * If the packet is a write request, @write_acked is to be set to true if it was 949 + * ack_complete'd already, false otherwise. This argument is ignored for any 950 + * other packet type. 951 + */ 987 952 void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size, 988 953 int write_acked) 989 954 {
+7 -66
drivers/ieee1394/ieee1394_core.h
··· 80 80 quadlet_t embedded_header[5]; 81 81 }; 82 82 83 - /* Set a task for when a packet completes */ 84 83 void hpsb_set_packet_complete_task(struct hpsb_packet *packet, 85 84 void (*routine)(void *), void *data); 86 - 87 85 static inline struct hpsb_packet *driver_packet(struct list_head *l) 88 86 { 89 87 return list_entry(l, struct hpsb_packet, driver_list); 90 88 } 91 - 92 89 void abort_timedouts(unsigned long __opaque); 93 - 94 90 struct hpsb_packet *hpsb_alloc_packet(size_t data_size); 95 91 void hpsb_free_packet(struct hpsb_packet *packet); 96 92 97 - /* 98 - * Generation counter for the complete 1394 subsystem. Generation gets 99 - * incremented on every change in the subsystem (e.g. bus reset). 93 + /** 94 + * get_hpsb_generation - generation counter for the complete 1394 subsystem 100 95 * 101 - * Use the functions, not the variable. 96 + * Generation gets incremented on every change in the subsystem (notably on bus 97 + * resets). Use the functions, not the variable. 102 98 */ 103 99 static inline unsigned int get_hpsb_generation(struct hpsb_host *host) 104 100 { 105 101 return atomic_read(&host->generation); 106 102 } 107 103 108 - /* 109 - * Send a PHY configuration packet, return 0 on success, negative 110 - * errno on failure. 111 - */ 112 104 int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt); 113 - 114 - /* 115 - * Queue packet for transmitting, return 0 on success, negative errno 116 - * on failure. 117 - */ 118 105 int hpsb_send_packet(struct hpsb_packet *packet); 119 - 120 - /* 121 - * Queue packet for transmitting, and block until the transaction 122 - * completes. Return 0 on success, negative errno on failure. 123 - */ 124 106 int hpsb_send_packet_and_wait(struct hpsb_packet *packet); 125 - 126 - /* Initiate bus reset on the given host. Returns 1 if bus reset already in 127 - * progress, 0 otherwise. */ 128 107 int hpsb_reset_bus(struct hpsb_host *host, int type); 129 - 130 108 int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer, 131 109 u64 *local_time); 132 110 133 - /* 134 - * The following functions are exported for host driver module usage. All of 135 - * them are safe to use in interrupt contexts, although some are quite 136 - * complicated so you may want to run them in bottom halves instead of calling 137 - * them directly. 138 - */ 139 - 140 - /* Notify a bus reset to the core. Returns 1 if bus reset already in progress, 141 - * 0 otherwise. */ 142 111 int hpsb_bus_reset(struct hpsb_host *host); 143 - 144 - /* 145 - * Hand over received selfid packet to the core. Complement check (second 146 - * quadlet is complement of first) is expected to be done and successful. 147 - */ 148 112 void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid); 149 - 150 - /* 151 - * Notify completion of SelfID stage to the core and report new physical ID 152 - * and whether host is root now. 153 - */ 154 113 void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot); 155 - 156 - /* 157 - * Notify core of sending a packet. Ackcode is the ack code returned for async 158 - * transmits or ACKX_SEND_ERROR if the transmission failed completely; ACKX_NONE 159 - * for other cases (internal errors that don't justify a panic). Safe to call 160 - * from within a transmit packet routine. 161 - */ 162 114 void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet, 163 115 int ackcode); 164 - 165 - /* 166 - * Hand over received packet to the core. The contents of data are expected to 167 - * be the full packet but with the CRCs left out (data block follows header 168 - * immediately), with the header (i.e. the first four quadlets) in machine byte 169 - * order and the data block in big endian. *data can be safely overwritten 170 - * after this call. 171 - * 172 - * If the packet is a write request, write_acked is to be set to true if it was 173 - * ack_complete'd already, false otherwise. This arg is ignored for any other 174 - * packet type. 175 - */ 176 116 void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size, 177 117 int write_acked); 178 - 179 118 180 119 /* 181 120 * CHARACTER DEVICE DISPATCHING ··· 156 217 #define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, \ 157 218 IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16) 158 219 159 - /* return the index (within a minor number block) of a file */ 220 + /** 221 + * ieee1394_file_to_instance - get the index within a minor number block 222 + */ 160 223 static inline unsigned char ieee1394_file_to_instance(struct file *file) 161 224 { 162 225 return file->f_path.dentry->d_inode->i_cindex;
+29
drivers/ieee1394/ieee1394_transactions.c
··· 212 212 wake_up_interruptible(&tlabel_wq); 213 213 } 214 214 215 + /** 216 + * hpsb_packet_success - Make sense of the ack and reply codes 217 + * 218 + * Make sense of the ack and reply codes and return more convenient error codes: 219 + * 0 = success. -%EBUSY = node is busy, try again. -%EAGAIN = error which can 220 + * probably resolved by retry. -%EREMOTEIO = node suffers from an internal 221 + * error. -%EACCES = this transaction is not allowed on requested address. 222 + * -%EINVAL = invalid address at node. 223 + */ 215 224 int hpsb_packet_success(struct hpsb_packet *packet) 216 225 { 217 226 switch (packet->ack_code) { ··· 502 493 * avoid in kernel buffers for user space callers 503 494 */ 504 495 496 + /** 497 + * hpsb_read - generic read function 498 + * 499 + * Recognizes the local node ID and act accordingly. Automatically uses a 500 + * quadlet read request if @length == 4 and and a block read request otherwise. 501 + * It does not yet support lengths that are not a multiple of 4. 502 + * 503 + * You must explicitly specifiy the @generation for which the node ID is valid, 504 + * to avoid sending packets to the wrong nodes when we race with a bus reset. 505 + */ 505 506 int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, 506 507 u64 addr, quadlet_t * buffer, size_t length) 507 508 { ··· 551 532 return retval; 552 533 } 553 534 535 + /** 536 + * hpsb_write - generic write function 537 + * 538 + * Recognizes the local node ID and act accordingly. Automatically uses a 539 + * quadlet write request if @length == 4 and and a block write request 540 + * otherwise. It does not yet support lengths that are not a multiple of 4. 541 + * 542 + * You must explicitly specifiy the @generation for which the node ID is valid, 543 + * to avoid sending packets to the wrong nodes when we race with a bus reset. 544 + */ 554 545 int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, 555 546 u64 addr, quadlet_t * buffer, size_t length) 556 547 {
-20
drivers/ieee1394/ieee1394_transactions.h
··· 27 27 struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, 28 28 int length, int channel, int tag, 29 29 int sync); 30 - 31 - /* 32 - * hpsb_packet_success - Make sense of the ack and reply codes and 33 - * return more convenient error codes: 34 - * 0 success 35 - * -EBUSY node is busy, try again 36 - * -EAGAIN error which can probably resolved by retry 37 - * -EREMOTEIO node suffers from an internal error 38 - * -EACCES this transaction is not allowed on requested address 39 - * -EINVAL invalid address at node 40 - */ 41 30 int hpsb_packet_success(struct hpsb_packet *packet); 42 - 43 - /* 44 - * The generic read and write functions. All recognize the local node ID 45 - * and act accordingly. Read and write automatically use quadlet commands if 46 - * length == 4 and and block commands otherwise (however, they do not yet 47 - * support lengths that are not a multiple of 4). You must explicitly specifiy 48 - * the generation for which the node ID is valid, to avoid sending packets to 49 - * the wrong nodes when we race with a bus reset. 50 - */ 51 31 int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, 52 32 u64 addr, quadlet_t *buffer, size_t length); 53 33 int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
+82 -2
drivers/ieee1394/iso.c
··· 15 15 #include "hosts.h" 16 16 #include "iso.h" 17 17 18 + /** 19 + * hpsb_iso_stop - stop DMA 20 + */ 18 21 void hpsb_iso_stop(struct hpsb_iso *iso) 19 22 { 20 23 if (!(iso->flags & HPSB_ISO_DRIVER_STARTED)) ··· 28 25 iso->flags &= ~HPSB_ISO_DRIVER_STARTED; 29 26 } 30 27 28 + /** 29 + * hpsb_iso_shutdown - deallocate buffer and DMA context 30 + */ 31 31 void hpsb_iso_shutdown(struct hpsb_iso *iso) 32 32 { 33 33 if (iso->flags & HPSB_ISO_DRIVER_INIT) { ··· 136 130 return NULL; 137 131 } 138 132 133 + /** 134 + * hpsb_iso_n_ready - returns number of packets ready to send or receive 135 + */ 139 136 int hpsb_iso_n_ready(struct hpsb_iso *iso) 140 137 { 141 138 unsigned long flags; ··· 151 142 return val; 152 143 } 153 144 145 + /** 146 + * hpsb_iso_xmit_init - allocate the buffer and DMA context 147 + */ 154 148 struct hpsb_iso *hpsb_iso_xmit_init(struct hpsb_host *host, 155 149 unsigned int data_buf_size, 156 150 unsigned int buf_packets, ··· 184 172 return NULL; 185 173 } 186 174 175 + /** 176 + * hpsb_iso_recv_init - allocate the buffer and DMA context 177 + * 178 + * Note, if channel = -1, multi-channel receive is enabled. 179 + */ 187 180 struct hpsb_iso *hpsb_iso_recv_init(struct hpsb_host *host, 188 181 unsigned int data_buf_size, 189 182 unsigned int buf_packets, ··· 216 199 return NULL; 217 200 } 218 201 202 + /** 203 + * hpsb_iso_recv_listen_channel 204 + * 205 + * multi-channel only 206 + */ 219 207 int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel) 220 208 { 221 209 if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64) ··· 228 206 return iso->host->driver->isoctl(iso, RECV_LISTEN_CHANNEL, channel); 229 207 } 230 208 209 + /** 210 + * hpsb_iso_recv_unlisten_channel 211 + * 212 + * multi-channel only 213 + */ 231 214 int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel) 232 215 { 233 216 if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64) ··· 240 213 return iso->host->driver->isoctl(iso, RECV_UNLISTEN_CHANNEL, channel); 241 214 } 242 215 216 + /** 217 + * hpsb_iso_recv_set_channel_mask 218 + * 219 + * multi-channel only 220 + */ 243 221 int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask) 244 222 { 245 223 if (iso->type != HPSB_ISO_RECV || iso->channel != -1) ··· 253 221 (unsigned long)&mask); 254 222 } 255 223 224 + /** 225 + * hpsb_iso_recv_flush - check for arrival of new packets 226 + * 227 + * check for arrival of new packets immediately (even if irq_interval 228 + * has not yet been reached) 229 + */ 256 230 int hpsb_iso_recv_flush(struct hpsb_iso *iso) 257 231 { 258 232 if (iso->type != HPSB_ISO_RECV) ··· 276 238 return retval; 277 239 } 278 240 241 + /** 242 + * hpsb_iso_xmit_start - start DMA 243 + */ 279 244 int hpsb_iso_xmit_start(struct hpsb_iso *iso, int cycle, int prebuffer) 280 245 { 281 246 if (iso->type != HPSB_ISO_XMIT) ··· 311 270 return 0; 312 271 } 313 272 273 + /** 274 + * hpsb_iso_recv_start - start DMA 275 + */ 314 276 int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) 315 277 { 316 278 int retval = 0; ··· 350 306 } 351 307 352 308 /* check to make sure the user has not supplied bogus values of offset/len 353 - that would cause the kernel to access memory outside the buffer */ 354 - 309 + * that would cause the kernel to access memory outside the buffer */ 355 310 static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, 356 311 unsigned int offset, unsigned short len, 357 312 unsigned int *out_offset, ··· 374 331 return 0; 375 332 } 376 333 334 + /** 335 + * hpsb_iso_xmit_queue_packet - queue a packet for transmission. 336 + * 337 + * @offset is relative to the beginning of the DMA buffer, where the packet's 338 + * data payload should already have been placed. 339 + */ 377 340 int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, 378 341 u8 tag, u8 sy) 379 342 { ··· 429 380 return rv; 430 381 } 431 382 383 + /** 384 + * hpsb_iso_xmit_sync - wait until all queued packets have been transmitted 385 + */ 432 386 int hpsb_iso_xmit_sync(struct hpsb_iso *iso) 433 387 { 434 388 if (iso->type != HPSB_ISO_XMIT) ··· 442 390 iso->buf_packets); 443 391 } 444 392 393 + /** 394 + * hpsb_iso_packet_sent 395 + * 396 + * Available to low-level drivers. 397 + * 398 + * Call after a packet has been transmitted to the bus (interrupt context is 399 + * OK). @cycle is the _exact_ cycle the packet was sent on. @error should be 400 + * non-zero if some sort of error occurred when sending the packet. 401 + */ 445 402 void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) 446 403 { 447 404 unsigned long flags; ··· 474 413 spin_unlock_irqrestore(&iso->lock, flags); 475 414 } 476 415 416 + /** 417 + * hpsb_iso_packet_received 418 + * 419 + * Available to low-level drivers. 420 + * 421 + * Call after a packet has been received (interrupt context is OK). 422 + */ 477 423 void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, 478 424 u16 total_len, u16 cycle, u8 channel, u8 tag, 479 425 u8 sy) ··· 510 442 spin_unlock_irqrestore(&iso->lock, flags); 511 443 } 512 444 445 + /** 446 + * hpsb_iso_recv_release_packets - release packets, reuse buffer 447 + * 448 + * @n_packets have been read out of the buffer, re-use the buffer space 449 + */ 513 450 int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets) 514 451 { 515 452 unsigned long flags; ··· 550 477 return rv; 551 478 } 552 479 480 + /** 481 + * hpsb_iso_wake 482 + * 483 + * Available to low-level drivers. 484 + * 485 + * Call to wake waiting processes after buffer space has opened up. 486 + */ 553 487 void hpsb_iso_wake(struct hpsb_iso *iso) 554 488 { 555 489 wake_up_interruptible(&iso->waitq);
+2 -33
drivers/ieee1394/iso.h
··· 150 150 151 151 /* functions available to high-level drivers (e.g. raw1394) */ 152 152 153 - /* allocate the buffer and DMA context */ 154 - 155 153 struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host, 156 154 unsigned int data_buf_size, 157 155 unsigned int buf_packets, ··· 157 159 int speed, 158 160 int irq_interval, 159 161 void (*callback)(struct hpsb_iso*)); 160 - 161 - /* note: if channel = -1, multi-channel receive is enabled */ 162 162 struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host, 163 163 unsigned int data_buf_size, 164 164 unsigned int buf_packets, ··· 164 168 int dma_mode, 165 169 int irq_interval, 166 170 void (*callback)(struct hpsb_iso*)); 167 - 168 - /* multi-channel only */ 169 171 int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel); 170 172 int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel); 171 173 int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask); 172 - 173 - /* start/stop DMA */ 174 174 int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle, 175 175 int prebuffer); 176 176 int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle, 177 177 int tag_mask, int sync); 178 178 void hpsb_iso_stop(struct hpsb_iso *iso); 179 - 180 - /* deallocate buffer and DMA context */ 181 179 void hpsb_iso_shutdown(struct hpsb_iso *iso); 182 - 183 - /* queue a packet for transmission. 184 - * 'offset' is relative to the beginning of the DMA buffer, where the packet's 185 - * data payload should already have been placed. */ 186 180 int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, 187 181 u8 tag, u8 sy); 188 - 189 - /* wait until all queued packets have been transmitted to the bus */ 190 182 int hpsb_iso_xmit_sync(struct hpsb_iso *iso); 191 - 192 - /* N packets have been read out of the buffer, re-use the buffer space */ 193 - int hpsb_iso_recv_release_packets(struct hpsb_iso *recv, 194 - unsigned int n_packets); 195 - 196 - /* check for arrival of new packets immediately (even if irq_interval 197 - * has not yet been reached) */ 183 + int hpsb_iso_recv_release_packets(struct hpsb_iso *recv, 184 + unsigned int n_packets); 198 185 int hpsb_iso_recv_flush(struct hpsb_iso *iso); 199 - 200 - /* returns # of packets ready to send or receive */ 201 186 int hpsb_iso_n_ready(struct hpsb_iso *iso); 202 187 203 188 /* the following are callbacks available to low-level drivers */ 204 189 205 - /* call after a packet has been transmitted to the bus (interrupt context is OK) 206 - * 'cycle' is the _exact_ cycle the packet was sent on 207 - * 'error' should be non-zero if some sort of error occurred when sending the 208 - * packet */ 209 190 void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error); 210 - 211 - /* call after a packet has been received (interrupt context OK) */ 212 191 void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, 213 192 u16 total_len, u16 cycle, u8 channel, u8 tag, 214 193 u8 sy); 215 - 216 - /* call to wake waiting processes after buffer space has opened up. */ 217 194 void hpsb_iso_wake(struct hpsb_iso *iso); 218 195 219 196 #endif /* IEEE1394_ISO_H */
+26 -6
drivers/ieee1394/nodemgr.c
··· 1738 1738 return 0; 1739 1739 } 1740 1740 1741 - int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *)) 1741 + /** 1742 + * nodemgr_for_each_host - call a function for each IEEE 1394 host 1743 + * @data: an address to supply to the callback 1744 + * @cb: function to call for each host 1745 + * 1746 + * Iterate the hosts, calling a given function with supplied data for each host. 1747 + * If the callback fails on a host, i.e. if it returns a non-zero value, the 1748 + * iteration is stopped. 1749 + * 1750 + * Return value: 0 on success, non-zero on failure (same as returned by last run 1751 + * of the callback). 1752 + */ 1753 + int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *)) 1742 1754 { 1743 1755 struct class_device *cdev; 1744 1756 struct hpsb_host *host; ··· 1760 1748 list_for_each_entry(cdev, &hpsb_host_class.children, node) { 1761 1749 host = container_of(cdev, struct hpsb_host, class_dev); 1762 1750 1763 - if ((error = cb(host, __data))) 1751 + if ((error = cb(host, data))) 1764 1752 break; 1765 1753 } 1766 1754 up(&hpsb_host_class.sem); ··· 1783 1771 * ID's. 1784 1772 */ 1785 1773 1786 - void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt) 1774 + /** 1775 + * hpsb_node_fill_packet - fill some destination information into a packet 1776 + * @ne: destination node 1777 + * @packet: packet to fill in 1778 + * 1779 + * This will fill in the given, pre-initialised hpsb_packet with the current 1780 + * information from the node entry (host, node ID, bus generation number). 1781 + */ 1782 + void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet) 1787 1783 { 1788 - pkt->host = ne->host; 1789 - pkt->generation = ne->generation; 1784 + packet->host = ne->host; 1785 + packet->generation = ne->generation; 1790 1786 barrier(); 1791 - pkt->node_id = ne->nodeid; 1787 + packet->node_id = ne->nodeid; 1792 1788 } 1793 1789 1794 1790 int hpsb_node_write(struct node_entry *ne, u64 addr,
+2 -18
drivers/ieee1394/nodemgr.h
··· 153 153 { 154 154 return ne->generation == get_hpsb_generation(ne->host); 155 155 } 156 - 157 - /* 158 - * This will fill in the given, pre-initialised hpsb_packet with the current 159 - * information from the node entry (host, node ID, generation number). It will 160 - * return false if the node owning the GUID is not accessible (and not modify 161 - * the hpsb_packet) and return true otherwise. 162 - * 163 - * Note that packet sending may still fail in hpsb_send_packet if a bus reset 164 - * happens while you are trying to set up the packet (due to obsolete generation 165 - * number). It will at least reliably fail so that you don't accidentally and 166 - * unknowingly send your packet to the wrong node. 167 - */ 168 - void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt); 169 - 156 + void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet); 170 157 int hpsb_node_write(struct node_entry *ne, u64 addr, 171 158 quadlet_t *buffer, size_t length); 172 - 173 - /* Iterate the hosts, calling a given function with supplied data for each 174 - * host. */ 175 - int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *)); 159 + int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *)); 176 160 177 161 int init_ieee1394_nodemgr(void); 178 162 void cleanup_ieee1394_nodemgr(void);
+1
drivers/ieee1394/ohci1394.c
··· 3658 3658 /* essentially the only purpose of this code is to allow another 3659 3659 module to hook into ohci's interrupt handler */ 3660 3660 3661 + /* returns zero if successful, one if DMA context is locked up */ 3661 3662 int ohci1394_stop_context(struct ti_ohci *ohci, int reg, char *msg) 3662 3663 { 3663 3664 int i=0;
+1 -3
drivers/ieee1394/ohci1394.h
··· 461 461 struct ohci1394_iso_tasklet *tasklet); 462 462 void ohci1394_unregister_iso_tasklet(struct ti_ohci *ohci, 463 463 struct ohci1394_iso_tasklet *tasklet); 464 - 465 - /* returns zero if successful, one if DMA context is locked up */ 466 - int ohci1394_stop_context (struct ti_ohci *ohci, int reg, char *msg); 464 + int ohci1394_stop_context(struct ti_ohci *ohci, int reg, char *msg); 467 465 struct ti_ohci *ohci1394_get_struct(int card_num); 468 466 469 467 #endif