diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/fw-card.c | 68 | ||||
-rw-r--r-- | drivers/firewire/fw-cdev.c | 88 | ||||
-rw-r--r-- | drivers/firewire/fw-device.c | 40 | ||||
-rw-r--r-- | drivers/firewire/fw-device.h | 3 | ||||
-rw-r--r-- | drivers/firewire/fw-iso.c | 28 | ||||
-rw-r--r-- | drivers/firewire/fw-ohci.c | 100 | ||||
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 57 | ||||
-rw-r--r-- | drivers/firewire/fw-topology.c | 28 | ||||
-rw-r--r-- | drivers/firewire/fw-topology.h | 13 | ||||
-rw-r--r-- | drivers/firewire/fw-transaction.c | 92 | ||||
-rw-r--r-- | drivers/firewire/fw-transaction.h | 109 |
11 files changed, 249 insertions, 377 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c index a5dd7a665aa8..27a3aae58cfd 100644 --- a/drivers/firewire/fw-card.c +++ b/drivers/firewire/fw-card.c | |||
@@ -63,8 +63,7 @@ static int descriptor_count; | |||
63 | #define BIB_CMC ((1) << 30) | 63 | #define BIB_CMC ((1) << 30) |
64 | #define BIB_IMC ((1) << 31) | 64 | #define BIB_IMC ((1) << 31) |
65 | 65 | ||
66 | static u32 * | 66 | static u32 *generate_config_rom(struct fw_card *card, size_t *config_rom_length) |
67 | generate_config_rom(struct fw_card *card, size_t *config_rom_length) | ||
68 | { | 67 | { |
69 | struct fw_descriptor *desc; | 68 | struct fw_descriptor *desc; |
70 | static u32 config_rom[256]; | 69 | static u32 config_rom[256]; |
@@ -128,8 +127,7 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length) | |||
128 | return config_rom; | 127 | return config_rom; |
129 | } | 128 | } |
130 | 129 | ||
131 | static void | 130 | static void update_config_roms(void) |
132 | update_config_roms(void) | ||
133 | { | 131 | { |
134 | struct fw_card *card; | 132 | struct fw_card *card; |
135 | u32 *config_rom; | 133 | u32 *config_rom; |
@@ -141,8 +139,7 @@ update_config_roms(void) | |||
141 | } | 139 | } |
142 | } | 140 | } |
143 | 141 | ||
144 | int | 142 | int fw_core_add_descriptor(struct fw_descriptor *desc) |
145 | fw_core_add_descriptor(struct fw_descriptor *desc) | ||
146 | { | 143 | { |
147 | size_t i; | 144 | size_t i; |
148 | 145 | ||
@@ -171,8 +168,7 @@ fw_core_add_descriptor(struct fw_descriptor *desc) | |||
171 | return 0; | 168 | return 0; |
172 | } | 169 | } |
173 | 170 | ||
174 | void | 171 | void fw_core_remove_descriptor(struct fw_descriptor *desc) |
175 | fw_core_remove_descriptor(struct fw_descriptor *desc) | ||
176 | { | 172 | { |
177 | mutex_lock(&card_mutex); | 173 | mutex_lock(&card_mutex); |
178 | 174 | ||
@@ -189,8 +185,7 @@ static const char gap_count_table[] = { | |||
189 | 63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40 | 185 | 63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40 |
190 | }; | 186 | }; |
191 | 187 | ||
192 | void | 188 | void fw_schedule_bm_work(struct fw_card *card, unsigned long delay) |
193 | fw_schedule_bm_work(struct fw_card *card, unsigned long delay) | ||
194 | { | 189 | { |
195 | int scheduled; | 190 | int scheduled; |
196 | 191 | ||
@@ -200,8 +195,7 @@ fw_schedule_bm_work(struct fw_card *card, unsigned long delay) | |||
200 | fw_card_put(card); | 195 | fw_card_put(card); |
201 | } | 196 | } |
202 | 197 | ||
203 | static void | 198 | static void fw_card_bm_work(struct work_struct *work) |
204 | fw_card_bm_work(struct work_struct *work) | ||
205 | { | 199 | { |
206 | struct fw_card *card = container_of(work, struct fw_card, work.work); | 200 | struct fw_card *card = container_of(work, struct fw_card, work.work); |
207 | struct fw_device *root_device; | 201 | struct fw_device *root_device; |
@@ -371,17 +365,16 @@ fw_card_bm_work(struct work_struct *work) | |||
371 | fw_card_put(card); | 365 | fw_card_put(card); |
372 | } | 366 | } |
373 | 367 | ||
374 | static void | 368 | static void flush_timer_callback(unsigned long data) |
375 | flush_timer_callback(unsigned long data) | ||
376 | { | 369 | { |
377 | struct fw_card *card = (struct fw_card *)data; | 370 | struct fw_card *card = (struct fw_card *)data; |
378 | 371 | ||
379 | fw_flush_transactions(card); | 372 | fw_flush_transactions(card); |
380 | } | 373 | } |
381 | 374 | ||
382 | void | 375 | void fw_card_initialize(struct fw_card *card, |
383 | fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, | 376 | const struct fw_card_driver *driver, |
384 | struct device *device) | 377 | struct device *device) |
385 | { | 378 | { |
386 | static atomic_t index = ATOMIC_INIT(-1); | 379 | static atomic_t index = ATOMIC_INIT(-1); |
387 | 380 | ||
@@ -406,9 +399,8 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, | |||
406 | } | 399 | } |
407 | EXPORT_SYMBOL(fw_card_initialize); | 400 | EXPORT_SYMBOL(fw_card_initialize); |
408 | 401 | ||
409 | int | 402 | int fw_card_add(struct fw_card *card, |
410 | fw_card_add(struct fw_card *card, | 403 | u32 max_receive, u32 link_speed, u64 guid) |
411 | u32 max_receive, u32 link_speed, u64 guid) | ||
412 | { | 404 | { |
413 | u32 *config_rom; | 405 | u32 *config_rom; |
414 | size_t length; | 406 | size_t length; |
@@ -442,23 +434,20 @@ EXPORT_SYMBOL(fw_card_add); | |||
442 | * dummy driver just fails all IO. | 434 | * dummy driver just fails all IO. |
443 | */ | 435 | */ |
444 | 436 | ||
445 | static int | 437 | static int dummy_enable(struct fw_card *card, u32 *config_rom, size_t length) |
446 | dummy_enable(struct fw_card *card, u32 *config_rom, size_t length) | ||
447 | { | 438 | { |
448 | BUG(); | 439 | BUG(); |
449 | return -1; | 440 | return -1; |
450 | } | 441 | } |
451 | 442 | ||
452 | static int | 443 | static int dummy_update_phy_reg(struct fw_card *card, int address, |
453 | dummy_update_phy_reg(struct fw_card *card, int address, | 444 | int clear_bits, int set_bits) |
454 | int clear_bits, int set_bits) | ||
455 | { | 445 | { |
456 | return -ENODEV; | 446 | return -ENODEV; |
457 | } | 447 | } |
458 | 448 | ||
459 | static int | 449 | static int dummy_set_config_rom(struct fw_card *card, |
460 | dummy_set_config_rom(struct fw_card *card, | 450 | u32 *config_rom, size_t length) |
461 | u32 *config_rom, size_t length) | ||
462 | { | 451 | { |
463 | /* | 452 | /* |
464 | * We take the card out of card_list before setting the dummy | 453 | * We take the card out of card_list before setting the dummy |
@@ -468,27 +457,23 @@ dummy_set_config_rom(struct fw_card *card, | |||
468 | return -1; | 457 | return -1; |
469 | } | 458 | } |
470 | 459 | ||
471 | static void | 460 | static void dummy_send_request(struct fw_card *card, struct fw_packet *packet) |
472 | dummy_send_request(struct fw_card *card, struct fw_packet *packet) | ||
473 | { | 461 | { |
474 | packet->callback(packet, card, -ENODEV); | 462 | packet->callback(packet, card, -ENODEV); |
475 | } | 463 | } |
476 | 464 | ||
477 | static void | 465 | static void dummy_send_response(struct fw_card *card, struct fw_packet *packet) |
478 | dummy_send_response(struct fw_card *card, struct fw_packet *packet) | ||
479 | { | 466 | { |
480 | packet->callback(packet, card, -ENODEV); | 467 | packet->callback(packet, card, -ENODEV); |
481 | } | 468 | } |
482 | 469 | ||
483 | static int | 470 | static int dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet) |
484 | dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet) | ||
485 | { | 471 | { |
486 | return -ENOENT; | 472 | return -ENOENT; |
487 | } | 473 | } |
488 | 474 | ||
489 | static int | 475 | static int dummy_enable_phys_dma(struct fw_card *card, |
490 | dummy_enable_phys_dma(struct fw_card *card, | 476 | int node_id, int generation) |
491 | int node_id, int generation) | ||
492 | { | 477 | { |
493 | return -ENODEV; | 478 | return -ENODEV; |
494 | } | 479 | } |
@@ -503,16 +488,14 @@ static struct fw_card_driver dummy_driver = { | |||
503 | .enable_phys_dma = dummy_enable_phys_dma, | 488 | .enable_phys_dma = dummy_enable_phys_dma, |
504 | }; | 489 | }; |
505 | 490 | ||
506 | void | 491 | void fw_card_release(struct kref *kref) |
507 | fw_card_release(struct kref *kref) | ||
508 | { | 492 | { |
509 | struct fw_card *card = container_of(kref, struct fw_card, kref); | 493 | struct fw_card *card = container_of(kref, struct fw_card, kref); |
510 | 494 | ||
511 | complete(&card->done); | 495 | complete(&card->done); |
512 | } | 496 | } |
513 | 497 | ||
514 | void | 498 | void fw_core_remove_card(struct fw_card *card) |
515 | fw_core_remove_card(struct fw_card *card) | ||
516 | { | 499 | { |
517 | card->driver->update_phy_reg(card, 4, | 500 | card->driver->update_phy_reg(card, 4, |
518 | PHY_LINK_ACTIVE | PHY_CONTENDER, 0); | 501 | PHY_LINK_ACTIVE | PHY_CONTENDER, 0); |
@@ -536,8 +519,7 @@ fw_core_remove_card(struct fw_card *card) | |||
536 | } | 519 | } |
537 | EXPORT_SYMBOL(fw_core_remove_card); | 520 | EXPORT_SYMBOL(fw_core_remove_card); |
538 | 521 | ||
539 | int | 522 | int fw_core_initiate_bus_reset(struct fw_card *card, int short_reset) |
540 | fw_core_initiate_bus_reset(struct fw_card *card, int short_reset) | ||
541 | { | 523 | { |
542 | int reg = short_reset ? 5 : 1; | 524 | int reg = short_reset ? 5 : 1; |
543 | int bit = short_reset ? PHY_BUS_SHORT_RESET : PHY_BUS_RESET; | 525 | int bit = short_reset ? PHY_BUS_SHORT_RESET : PHY_BUS_RESET; |
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 07c32a4bada2..3c075b2eedf9 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -96,14 +96,12 @@ struct client { | |||
96 | struct list_head link; | 96 | struct list_head link; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static inline void __user * | 99 | static inline void __user *u64_to_uptr(__u64 value) |
100 | u64_to_uptr(__u64 value) | ||
101 | { | 100 | { |
102 | return (void __user *)(unsigned long)value; | 101 | return (void __user *)(unsigned long)value; |
103 | } | 102 | } |
104 | 103 | ||
105 | static inline __u64 | 104 | static inline __u64 uptr_to_u64(void __user *ptr) |
106 | uptr_to_u64(void __user *ptr) | ||
107 | { | 105 | { |
108 | return (__u64)(unsigned long)ptr; | 106 | return (__u64)(unsigned long)ptr; |
109 | } | 107 | } |
@@ -163,8 +161,8 @@ static void queue_event(struct client *client, struct event *event, | |||
163 | wake_up_interruptible(&client->wait); | 161 | wake_up_interruptible(&client->wait); |
164 | } | 162 | } |
165 | 163 | ||
166 | static int | 164 | static int dequeue_event(struct client *client, |
167 | dequeue_event(struct client *client, char __user *buffer, size_t count) | 165 | char __user *buffer, size_t count) |
168 | { | 166 | { |
169 | unsigned long flags; | 167 | unsigned long flags; |
170 | struct event *event; | 168 | struct event *event; |
@@ -203,18 +201,16 @@ dequeue_event(struct client *client, char __user *buffer, size_t count) | |||
203 | return ret; | 201 | return ret; |
204 | } | 202 | } |
205 | 203 | ||
206 | static ssize_t | 204 | static ssize_t fw_device_op_read(struct file *file, char __user *buffer, |
207 | fw_device_op_read(struct file *file, | 205 | size_t count, loff_t *offset) |
208 | char __user *buffer, size_t count, loff_t *offset) | ||
209 | { | 206 | { |
210 | struct client *client = file->private_data; | 207 | struct client *client = file->private_data; |
211 | 208 | ||
212 | return dequeue_event(client, buffer, count); | 209 | return dequeue_event(client, buffer, count); |
213 | } | 210 | } |
214 | 211 | ||
215 | static void | 212 | static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, |
216 | fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, | 213 | struct client *client) |
217 | struct client *client) | ||
218 | { | 214 | { |
219 | struct fw_card *card = client->device->card; | 215 | struct fw_card *card = client->device->card; |
220 | unsigned long flags; | 216 | unsigned long flags; |
@@ -233,9 +229,8 @@ fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, | |||
233 | spin_unlock_irqrestore(&card->lock, flags); | 229 | spin_unlock_irqrestore(&card->lock, flags); |
234 | } | 230 | } |
235 | 231 | ||
236 | static void | 232 | static void for_each_client(struct fw_device *device, |
237 | for_each_client(struct fw_device *device, | 233 | void (*callback)(struct client *client)) |
238 | void (*callback)(struct client *client)) | ||
239 | { | 234 | { |
240 | struct client *c; | 235 | struct client *c; |
241 | 236 | ||
@@ -245,8 +240,7 @@ for_each_client(struct fw_device *device, | |||
245 | mutex_unlock(&device->client_list_mutex); | 240 | mutex_unlock(&device->client_list_mutex); |
246 | } | 241 | } |
247 | 242 | ||
248 | static void | 243 | static void queue_bus_reset_event(struct client *client) |
249 | queue_bus_reset_event(struct client *client) | ||
250 | { | 244 | { |
251 | struct bus_reset *bus_reset; | 245 | struct bus_reset *bus_reset; |
252 | 246 | ||
@@ -316,9 +310,8 @@ static int ioctl_get_info(struct client *client, void *buffer) | |||
316 | return 0; | 310 | return 0; |
317 | } | 311 | } |
318 | 312 | ||
319 | static int | 313 | static int add_client_resource(struct client *client, |
320 | add_client_resource(struct client *client, struct client_resource *resource, | 314 | struct client_resource *resource, gfp_t gfp_mask) |
321 | gfp_t gfp_mask) | ||
322 | { | 315 | { |
323 | unsigned long flags; | 316 | unsigned long flags; |
324 | int ret; | 317 | int ret; |
@@ -341,10 +334,9 @@ add_client_resource(struct client *client, struct client_resource *resource, | |||
341 | return ret < 0 ? ret : 0; | 334 | return ret < 0 ? ret : 0; |
342 | } | 335 | } |
343 | 336 | ||
344 | static int | 337 | static int release_client_resource(struct client *client, u32 handle, |
345 | release_client_resource(struct client *client, u32 handle, | 338 | client_resource_release_fn_t release, |
346 | client_resource_release_fn_t release, | 339 | struct client_resource **resource) |
347 | struct client_resource **resource) | ||
348 | { | 340 | { |
349 | struct client_resource *r; | 341 | struct client_resource *r; |
350 | unsigned long flags; | 342 | unsigned long flags; |
@@ -369,8 +361,8 @@ release_client_resource(struct client *client, u32 handle, | |||
369 | return 0; | 361 | return 0; |
370 | } | 362 | } |
371 | 363 | ||
372 | static void | 364 | static void release_transaction(struct client *client, |
373 | release_transaction(struct client *client, struct client_resource *resource) | 365 | struct client_resource *resource) |
374 | { | 366 | { |
375 | struct response *response = | 367 | struct response *response = |
376 | container_of(resource, struct response, resource); | 368 | container_of(resource, struct response, resource); |
@@ -378,9 +370,8 @@ release_transaction(struct client *client, struct client_resource *resource) | |||
378 | fw_cancel_transaction(client->device->card, &response->transaction); | 370 | fw_cancel_transaction(client->device->card, &response->transaction); |
379 | } | 371 | } |
380 | 372 | ||
381 | static void | 373 | static void complete_transaction(struct fw_card *card, int rcode, |
382 | complete_transaction(struct fw_card *card, int rcode, | 374 | void *payload, size_t length, void *data) |
383 | void *payload, size_t length, void *data) | ||
384 | { | 375 | { |
385 | struct response *response = data; | 376 | struct response *response = data; |
386 | struct client *client = response->client; | 377 | struct client *client = response->client; |
@@ -506,8 +497,8 @@ struct request_event { | |||
506 | struct fw_cdev_event_request request; | 497 | struct fw_cdev_event_request request; |
507 | }; | 498 | }; |
508 | 499 | ||
509 | static void | 500 | static void release_request(struct client *client, |
510 | release_request(struct client *client, struct client_resource *resource) | 501 | struct client_resource *resource) |
511 | { | 502 | { |
512 | struct request *request = | 503 | struct request *request = |
513 | container_of(resource, struct request, resource); | 504 | container_of(resource, struct request, resource); |
@@ -517,12 +508,11 @@ release_request(struct client *client, struct client_resource *resource) | |||
517 | kfree(request); | 508 | kfree(request); |
518 | } | 509 | } |
519 | 510 | ||
520 | static void | 511 | static void handle_request(struct fw_card *card, struct fw_request *r, |
521 | handle_request(struct fw_card *card, struct fw_request *r, | 512 | int tcode, int destination, int source, |
522 | int tcode, int destination, int source, | 513 | int generation, int speed, |
523 | int generation, int speed, | 514 | unsigned long long offset, |
524 | unsigned long long offset, | 515 | void *payload, size_t length, void *callback_data) |
525 | void *payload, size_t length, void *callback_data) | ||
526 | { | 516 | { |
527 | struct address_handler *handler = callback_data; | 517 | struct address_handler *handler = callback_data; |
528 | struct request *request; | 518 | struct request *request; |
@@ -561,9 +551,8 @@ handle_request(struct fw_card *card, struct fw_request *r, | |||
561 | fw_send_response(card, r, RCODE_CONFLICT_ERROR); | 551 | fw_send_response(card, r, RCODE_CONFLICT_ERROR); |
562 | } | 552 | } |
563 | 553 | ||
564 | static void | 554 | static void release_address_handler(struct client *client, |
565 | release_address_handler(struct client *client, | 555 | struct client_resource *resource) |
566 | struct client_resource *resource) | ||
567 | { | 556 | { |
568 | struct address_handler *handler = | 557 | struct address_handler *handler = |
569 | container_of(resource, struct address_handler, resource); | 558 | container_of(resource, struct address_handler, resource); |
@@ -716,9 +705,8 @@ static int ioctl_remove_descriptor(struct client *client, void *buffer) | |||
716 | release_descriptor, NULL); | 705 | release_descriptor, NULL); |
717 | } | 706 | } |
718 | 707 | ||
719 | static void | 708 | static void iso_callback(struct fw_iso_context *context, u32 cycle, |
720 | iso_callback(struct fw_iso_context *context, u32 cycle, | 709 | size_t header_length, void *header, void *data) |
721 | size_t header_length, void *header, void *data) | ||
722 | { | 710 | { |
723 | struct client *client = data; | 711 | struct client *client = data; |
724 | struct iso_interrupt *irq; | 712 | struct iso_interrupt *irq; |
@@ -954,8 +942,8 @@ static int (* const ioctl_handlers[])(struct client *client, void *buffer) = { | |||
954 | ioctl_get_cycle_timer, | 942 | ioctl_get_cycle_timer, |
955 | }; | 943 | }; |
956 | 944 | ||
957 | static int | 945 | static int dispatch_ioctl(struct client *client, |
958 | dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg) | 946 | unsigned int cmd, void __user *arg) |
959 | { | 947 | { |
960 | char buffer[256]; | 948 | char buffer[256]; |
961 | int ret; | 949 | int ret; |
@@ -983,9 +971,8 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg) | |||
983 | return ret; | 971 | return ret; |
984 | } | 972 | } |
985 | 973 | ||
986 | static long | 974 | static long fw_device_op_ioctl(struct file *file, |
987 | fw_device_op_ioctl(struct file *file, | 975 | unsigned int cmd, unsigned long arg) |
988 | unsigned int cmd, unsigned long arg) | ||
989 | { | 976 | { |
990 | struct client *client = file->private_data; | 977 | struct client *client = file->private_data; |
991 | 978 | ||
@@ -996,9 +983,8 @@ fw_device_op_ioctl(struct file *file, | |||
996 | } | 983 | } |
997 | 984 | ||
998 | #ifdef CONFIG_COMPAT | 985 | #ifdef CONFIG_COMPAT |
999 | static long | 986 | static long fw_device_op_compat_ioctl(struct file *file, |
1000 | fw_device_op_compat_ioctl(struct file *file, | 987 | unsigned int cmd, unsigned long arg) |
1001 | unsigned int cmd, unsigned long arg) | ||
1002 | { | 988 | { |
1003 | struct client *client = file->private_data; | 989 | struct client *client = file->private_data; |
1004 | 990 | ||
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c index 2de3dd5ebc4b..ac5043cc9ad0 100644 --- a/drivers/firewire/fw-device.c +++ b/drivers/firewire/fw-device.c | |||
@@ -134,8 +134,7 @@ static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) | |||
134 | vendor, model, specifier_id, version); | 134 | vendor, model, specifier_id, version); |
135 | } | 135 | } |
136 | 136 | ||
137 | static int | 137 | static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env) |
138 | fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
139 | { | 138 | { |
140 | struct fw_unit *unit = fw_unit(dev); | 139 | struct fw_unit *unit = fw_unit(dev); |
141 | char modalias[64]; | 140 | char modalias[64]; |
@@ -193,8 +192,8 @@ struct config_rom_attribute { | |||
193 | u32 key; | 192 | u32 key; |
194 | }; | 193 | }; |
195 | 194 | ||
196 | static ssize_t | 195 | static ssize_t show_immediate(struct device *dev, |
197 | show_immediate(struct device *dev, struct device_attribute *dattr, char *buf) | 196 | struct device_attribute *dattr, char *buf) |
198 | { | 197 | { |
199 | struct config_rom_attribute *attr = | 198 | struct config_rom_attribute *attr = |
200 | container_of(dattr, struct config_rom_attribute, attr); | 199 | container_of(dattr, struct config_rom_attribute, attr); |
@@ -225,8 +224,8 @@ show_immediate(struct device *dev, struct device_attribute *dattr, char *buf) | |||
225 | #define IMMEDIATE_ATTR(name, key) \ | 224 | #define IMMEDIATE_ATTR(name, key) \ |
226 | { __ATTR(name, S_IRUGO, show_immediate, NULL), key } | 225 | { __ATTR(name, S_IRUGO, show_immediate, NULL), key } |
227 | 226 | ||
228 | static ssize_t | 227 | static ssize_t show_text_leaf(struct device *dev, |
229 | show_text_leaf(struct device *dev, struct device_attribute *dattr, char *buf) | 228 | struct device_attribute *dattr, char *buf) |
230 | { | 229 | { |
231 | struct config_rom_attribute *attr = | 230 | struct config_rom_attribute *attr = |
232 | container_of(dattr, struct config_rom_attribute, attr); | 231 | container_of(dattr, struct config_rom_attribute, attr); |
@@ -295,10 +294,9 @@ static struct config_rom_attribute config_rom_attributes[] = { | |||
295 | TEXT_LEAF_ATTR(hardware_version_name, CSR_HARDWARE_VERSION), | 294 | TEXT_LEAF_ATTR(hardware_version_name, CSR_HARDWARE_VERSION), |
296 | }; | 295 | }; |
297 | 296 | ||
298 | static void | 297 | static void init_fw_attribute_group(struct device *dev, |
299 | init_fw_attribute_group(struct device *dev, | 298 | struct device_attribute *attrs, |
300 | struct device_attribute *attrs, | 299 | struct fw_attribute_group *group) |
301 | struct fw_attribute_group *group) | ||
302 | { | 300 | { |
303 | struct device_attribute *attr; | 301 | struct device_attribute *attr; |
304 | int i, j; | 302 | int i, j; |
@@ -321,9 +319,8 @@ init_fw_attribute_group(struct device *dev, | |||
321 | dev->groups = group->groups; | 319 | dev->groups = group->groups; |
322 | } | 320 | } |
323 | 321 | ||
324 | static ssize_t | 322 | static ssize_t modalias_show(struct device *dev, |
325 | modalias_show(struct device *dev, | 323 | struct device_attribute *attr, char *buf) |
326 | struct device_attribute *attr, char *buf) | ||
327 | { | 324 | { |
328 | struct fw_unit *unit = fw_unit(dev); | 325 | struct fw_unit *unit = fw_unit(dev); |
329 | int length; | 326 | int length; |
@@ -334,9 +331,8 @@ modalias_show(struct device *dev, | |||
334 | return length + 1; | 331 | return length + 1; |
335 | } | 332 | } |
336 | 333 | ||
337 | static ssize_t | 334 | static ssize_t rom_index_show(struct device *dev, |
338 | rom_index_show(struct device *dev, | 335 | struct device_attribute *attr, char *buf) |
339 | struct device_attribute *attr, char *buf) | ||
340 | { | 336 | { |
341 | struct fw_device *device = fw_device(dev->parent); | 337 | struct fw_device *device = fw_device(dev->parent); |
342 | struct fw_unit *unit = fw_unit(dev); | 338 | struct fw_unit *unit = fw_unit(dev); |
@@ -351,8 +347,8 @@ static struct device_attribute fw_unit_attributes[] = { | |||
351 | __ATTR_NULL, | 347 | __ATTR_NULL, |
352 | }; | 348 | }; |
353 | 349 | ||
354 | static ssize_t | 350 | static ssize_t config_rom_show(struct device *dev, |
355 | config_rom_show(struct device *dev, struct device_attribute *attr, char *buf) | 351 | struct device_attribute *attr, char *buf) |
356 | { | 352 | { |
357 | struct fw_device *device = fw_device(dev); | 353 | struct fw_device *device = fw_device(dev); |
358 | size_t length; | 354 | size_t length; |
@@ -365,8 +361,8 @@ config_rom_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
365 | return length; | 361 | return length; |
366 | } | 362 | } |
367 | 363 | ||
368 | static ssize_t | 364 | static ssize_t guid_show(struct device *dev, |
369 | guid_show(struct device *dev, struct device_attribute *attr, char *buf) | 365 | struct device_attribute *attr, char *buf) |
370 | { | 366 | { |
371 | struct fw_device *device = fw_device(dev); | 367 | struct fw_device *device = fw_device(dev); |
372 | int ret; | 368 | int ret; |
@@ -385,8 +381,8 @@ static struct device_attribute fw_device_attributes[] = { | |||
385 | __ATTR_NULL, | 381 | __ATTR_NULL, |
386 | }; | 382 | }; |
387 | 383 | ||
388 | static int | 384 | static int read_rom(struct fw_device *device, |
389 | read_rom(struct fw_device *device, int generation, int index, u32 *data) | 385 | int generation, int index, u32 *data) |
390 | { | 386 | { |
391 | int rcode; | 387 | int rcode; |
392 | 388 | ||
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h index 655d7e838012..41483f1a1beb 100644 --- a/drivers/firewire/fw-device.h +++ b/drivers/firewire/fw-device.h | |||
@@ -180,8 +180,7 @@ struct fw_driver { | |||
180 | const struct fw_device_id *id_table; | 180 | const struct fw_device_id *id_table; |
181 | }; | 181 | }; |
182 | 182 | ||
183 | static inline struct fw_driver * | 183 | static inline struct fw_driver *fw_driver(struct device_driver *drv) |
184 | fw_driver(struct device_driver *drv) | ||
185 | { | 184 | { |
186 | return container_of(drv, struct fw_driver, driver); | 185 | return container_of(drv, struct fw_driver, driver); |
187 | } | 186 | } |
diff --git a/drivers/firewire/fw-iso.c b/drivers/firewire/fw-iso.c index cb32b20da9a0..3ff2cfc1bba6 100644 --- a/drivers/firewire/fw-iso.c +++ b/drivers/firewire/fw-iso.c | |||
@@ -28,9 +28,8 @@ | |||
28 | #include "fw-topology.h" | 28 | #include "fw-topology.h" |
29 | #include "fw-device.h" | 29 | #include "fw-device.h" |
30 | 30 | ||
31 | int | 31 | int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, |
32 | fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, | 32 | int page_count, enum dma_data_direction direction) |
33 | int page_count, enum dma_data_direction direction) | ||
34 | { | 33 | { |
35 | int i, j; | 34 | int i, j; |
36 | dma_addr_t address; | 35 | dma_addr_t address; |
@@ -105,10 +104,9 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, | |||
105 | buffer->pages = NULL; | 104 | buffer->pages = NULL; |
106 | } | 105 | } |
107 | 106 | ||
108 | struct fw_iso_context * | 107 | struct fw_iso_context *fw_iso_context_create(struct fw_card *card, |
109 | fw_iso_context_create(struct fw_card *card, int type, | 108 | int type, int channel, int speed, size_t header_size, |
110 | int channel, int speed, size_t header_size, | 109 | fw_iso_callback_t callback, void *callback_data) |
111 | fw_iso_callback_t callback, void *callback_data) | ||
112 | { | 110 | { |
113 | struct fw_iso_context *ctx; | 111 | struct fw_iso_context *ctx; |
114 | 112 | ||
@@ -134,25 +132,23 @@ void fw_iso_context_destroy(struct fw_iso_context *ctx) | |||
134 | card->driver->free_iso_context(ctx); | 132 | card->driver->free_iso_context(ctx); |
135 | } | 133 | } |
136 | 134 | ||
137 | int | 135 | int fw_iso_context_start(struct fw_iso_context *ctx, |
138 | fw_iso_context_start(struct fw_iso_context *ctx, int cycle, int sync, int tags) | 136 | int cycle, int sync, int tags) |
139 | { | 137 | { |
140 | return ctx->card->driver->start_iso(ctx, cycle, sync, tags); | 138 | return ctx->card->driver->start_iso(ctx, cycle, sync, tags); |
141 | } | 139 | } |
142 | 140 | ||
143 | int | 141 | int fw_iso_context_queue(struct fw_iso_context *ctx, |
144 | fw_iso_context_queue(struct fw_iso_context *ctx, | 142 | struct fw_iso_packet *packet, |
145 | struct fw_iso_packet *packet, | 143 | struct fw_iso_buffer *buffer, |
146 | struct fw_iso_buffer *buffer, | 144 | unsigned long payload) |
147 | unsigned long payload) | ||
148 | { | 145 | { |
149 | struct fw_card *card = ctx->card; | 146 | struct fw_card *card = ctx->card; |
150 | 147 | ||
151 | return card->driver->queue_iso(ctx, packet, buffer, payload); | 148 | return card->driver->queue_iso(ctx, packet, buffer, payload); |
152 | } | 149 | } |
153 | 150 | ||
154 | int | 151 | int fw_iso_context_stop(struct fw_iso_context *ctx) |
155 | fw_iso_context_stop(struct fw_iso_context *ctx) | ||
156 | { | 152 | { |
157 | return ctx->card->driver->stop_iso(ctx); | 153 | return ctx->card->driver->stop_iso(ctx); |
158 | } | 154 | } |
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index b941ab3da18e..4c7cf15986ae 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -441,9 +441,8 @@ static inline void flush_writes(const struct fw_ohci *ohci) | |||
441 | reg_read(ohci, OHCI1394_Version); | 441 | reg_read(ohci, OHCI1394_Version); |
442 | } | 442 | } |
443 | 443 | ||
444 | static int | 444 | static int ohci_update_phy_reg(struct fw_card *card, int addr, |
445 | ohci_update_phy_reg(struct fw_card *card, int addr, | 445 | int clear_bits, int set_bits) |
446 | int clear_bits, int set_bits) | ||
447 | { | 446 | { |
448 | struct fw_ohci *ohci = fw_ohci(card); | 447 | struct fw_ohci *ohci = fw_ohci(card); |
449 | u32 val, old; | 448 | u32 val, old; |
@@ -658,8 +657,8 @@ static void ar_context_tasklet(unsigned long data) | |||
658 | } | 657 | } |
659 | } | 658 | } |
660 | 659 | ||
661 | static int | 660 | static int ar_context_init(struct ar_context *ctx, |
662 | ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, u32 regs) | 661 | struct fw_ohci *ohci, u32 regs) |
663 | { | 662 | { |
664 | struct ar_buffer ab; | 663 | struct ar_buffer ab; |
665 | 664 | ||
@@ -690,8 +689,7 @@ static void ar_context_run(struct ar_context *ctx) | |||
690 | flush_writes(ctx->ohci); | 689 | flush_writes(ctx->ohci); |
691 | } | 690 | } |
692 | 691 | ||
693 | static struct descriptor * | 692 | static struct descriptor *find_branch_descriptor(struct descriptor *d, int z) |
694 | find_branch_descriptor(struct descriptor *d, int z) | ||
695 | { | 693 | { |
696 | int b, key; | 694 | int b, key; |
697 | 695 | ||
@@ -751,8 +749,7 @@ static void context_tasklet(unsigned long data) | |||
751 | * Allocate a new buffer and add it to the list of free buffers for this | 749 | * Allocate a new buffer and add it to the list of free buffers for this |
752 | * context. Must be called with ohci->lock held. | 750 | * context. Must be called with ohci->lock held. |
753 | */ | 751 | */ |
754 | static int | 752 | static int context_add_buffer(struct context *ctx) |
755 | context_add_buffer(struct context *ctx) | ||
756 | { | 753 | { |
757 | struct descriptor_buffer *desc; | 754 | struct descriptor_buffer *desc; |
758 | dma_addr_t uninitialized_var(bus_addr); | 755 | dma_addr_t uninitialized_var(bus_addr); |
@@ -781,9 +778,8 @@ context_add_buffer(struct context *ctx) | |||
781 | return 0; | 778 | return 0; |
782 | } | 779 | } |
783 | 780 | ||
784 | static int | 781 | static int context_init(struct context *ctx, struct fw_ohci *ohci, |
785 | context_init(struct context *ctx, struct fw_ohci *ohci, | 782 | u32 regs, descriptor_callback_t callback) |
786 | u32 regs, descriptor_callback_t callback) | ||
787 | { | 783 | { |
788 | ctx->ohci = ohci; | 784 | ctx->ohci = ohci; |
789 | ctx->regs = regs; | 785 | ctx->regs = regs; |
@@ -814,8 +810,7 @@ context_init(struct context *ctx, struct fw_ohci *ohci, | |||
814 | return 0; | 810 | return 0; |
815 | } | 811 | } |
816 | 812 | ||
817 | static void | 813 | static void context_release(struct context *ctx) |
818 | context_release(struct context *ctx) | ||
819 | { | 814 | { |
820 | struct fw_card *card = &ctx->ohci->card; | 815 | struct fw_card *card = &ctx->ohci->card; |
821 | struct descriptor_buffer *desc, *tmp; | 816 | struct descriptor_buffer *desc, *tmp; |
@@ -827,8 +822,8 @@ context_release(struct context *ctx) | |||
827 | } | 822 | } |
828 | 823 | ||
829 | /* Must be called with ohci->lock held */ | 824 | /* Must be called with ohci->lock held */ |
830 | static struct descriptor * | 825 | static struct descriptor *context_get_descriptors(struct context *ctx, |
831 | context_get_descriptors(struct context *ctx, int z, dma_addr_t *d_bus) | 826 | int z, dma_addr_t *d_bus) |
832 | { | 827 | { |
833 | struct descriptor *d = NULL; | 828 | struct descriptor *d = NULL; |
834 | struct descriptor_buffer *desc = ctx->buffer_tail; | 829 | struct descriptor_buffer *desc = ctx->buffer_tail; |
@@ -912,8 +907,8 @@ struct driver_data { | |||
912 | * Must always be called with the ochi->lock held to ensure proper | 907 | * Must always be called with the ochi->lock held to ensure proper |
913 | * generation handling and locking around packet queue manipulation. | 908 | * generation handling and locking around packet queue manipulation. |
914 | */ | 909 | */ |
915 | static int | 910 | static int at_context_queue_packet(struct context *ctx, |
916 | at_context_queue_packet(struct context *ctx, struct fw_packet *packet) | 911 | struct fw_packet *packet) |
917 | { | 912 | { |
918 | struct fw_ohci *ohci = ctx->ohci; | 913 | struct fw_ohci *ohci = ctx->ohci; |
919 | dma_addr_t d_bus, uninitialized_var(payload_bus); | 914 | dma_addr_t d_bus, uninitialized_var(payload_bus); |
@@ -1095,8 +1090,8 @@ static int handle_at_packet(struct context *context, | |||
1095 | #define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff) | 1090 | #define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff) |
1096 | #define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff) | 1091 | #define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff) |
1097 | 1092 | ||
1098 | static void | 1093 | static void handle_local_rom(struct fw_ohci *ohci, |
1099 | handle_local_rom(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr) | 1094 | struct fw_packet *packet, u32 csr) |
1100 | { | 1095 | { |
1101 | struct fw_packet response; | 1096 | struct fw_packet response; |
1102 | int tcode, length, i; | 1097 | int tcode, length, i; |
@@ -1122,8 +1117,8 @@ handle_local_rom(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr) | |||
1122 | fw_core_handle_response(&ohci->card, &response); | 1117 | fw_core_handle_response(&ohci->card, &response); |
1123 | } | 1118 | } |
1124 | 1119 | ||
1125 | static void | 1120 | static void handle_local_lock(struct fw_ohci *ohci, |
1126 | handle_local_lock(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr) | 1121 | struct fw_packet *packet, u32 csr) |
1127 | { | 1122 | { |
1128 | struct fw_packet response; | 1123 | struct fw_packet response; |
1129 | int tcode, length, ext_tcode, sel; | 1124 | int tcode, length, ext_tcode, sel; |
@@ -1164,8 +1159,7 @@ handle_local_lock(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr) | |||
1164 | fw_core_handle_response(&ohci->card, &response); | 1159 | fw_core_handle_response(&ohci->card, &response); |
1165 | } | 1160 | } |
1166 | 1161 | ||
1167 | static void | 1162 | static void handle_local_request(struct context *ctx, struct fw_packet *packet) |
1168 | handle_local_request(struct context *ctx, struct fw_packet *packet) | ||
1169 | { | 1163 | { |
1170 | u64 offset; | 1164 | u64 offset; |
1171 | u32 csr; | 1165 | u32 csr; |
@@ -1205,8 +1199,7 @@ handle_local_request(struct context *ctx, struct fw_packet *packet) | |||
1205 | } | 1199 | } |
1206 | } | 1200 | } |
1207 | 1201 | ||
1208 | static void | 1202 | static void at_context_transmit(struct context *ctx, struct fw_packet *packet) |
1209 | at_context_transmit(struct context *ctx, struct fw_packet *packet) | ||
1210 | { | 1203 | { |
1211 | unsigned long flags; | 1204 | unsigned long flags; |
1212 | int ret; | 1205 | int ret; |
@@ -1590,8 +1583,8 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length) | |||
1590 | return 0; | 1583 | return 0; |
1591 | } | 1584 | } |
1592 | 1585 | ||
1593 | static int | 1586 | static int ohci_set_config_rom(struct fw_card *card, |
1594 | ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | 1587 | u32 *config_rom, size_t length) |
1595 | { | 1588 | { |
1596 | struct fw_ohci *ohci; | 1589 | struct fw_ohci *ohci; |
1597 | unsigned long flags; | 1590 | unsigned long flags; |
@@ -1711,8 +1704,8 @@ static int ohci_cancel_packet(struct fw_card *card, struct fw_packet *packet) | |||
1711 | return ret; | 1704 | return ret; |
1712 | } | 1705 | } |
1713 | 1706 | ||
1714 | static int | 1707 | static int ohci_enable_phys_dma(struct fw_card *card, |
1715 | ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation) | 1708 | int node_id, int generation) |
1716 | { | 1709 | { |
1717 | #ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA | 1710 | #ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA |
1718 | return 0; | 1711 | return 0; |
@@ -1752,8 +1745,7 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation) | |||
1752 | #endif /* CONFIG_FIREWIRE_OHCI_REMOTE_DMA */ | 1745 | #endif /* CONFIG_FIREWIRE_OHCI_REMOTE_DMA */ |
1753 | } | 1746 | } |
1754 | 1747 | ||
1755 | static u64 | 1748 | static u64 ohci_get_bus_time(struct fw_card *card) |
1756 | ohci_get_bus_time(struct fw_card *card) | ||
1757 | { | 1749 | { |
1758 | struct fw_ohci *ohci = fw_ohci(card); | 1750 | struct fw_ohci *ohci = fw_ohci(card); |
1759 | u32 cycle_time; | 1751 | u32 cycle_time; |
@@ -1884,8 +1876,8 @@ static int handle_it_packet(struct context *context, | |||
1884 | return 1; | 1876 | return 1; |
1885 | } | 1877 | } |
1886 | 1878 | ||
1887 | static struct fw_iso_context * | 1879 | static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, |
1888 | ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size) | 1880 | int type, size_t header_size) |
1889 | { | 1881 | { |
1890 | struct fw_ohci *ohci = fw_ohci(card); | 1882 | struct fw_ohci *ohci = fw_ohci(card); |
1891 | struct iso_context *ctx, *list; | 1883 | struct iso_context *ctx, *list; |
@@ -2025,11 +2017,10 @@ static void ohci_free_iso_context(struct fw_iso_context *base) | |||
2025 | spin_unlock_irqrestore(&ohci->lock, flags); | 2017 | spin_unlock_irqrestore(&ohci->lock, flags); |
2026 | } | 2018 | } |
2027 | 2019 | ||
2028 | static int | 2020 | static int ohci_queue_iso_transmit(struct fw_iso_context *base, |
2029 | ohci_queue_iso_transmit(struct fw_iso_context *base, | 2021 | struct fw_iso_packet *packet, |
2030 | struct fw_iso_packet *packet, | 2022 | struct fw_iso_buffer *buffer, |
2031 | struct fw_iso_buffer *buffer, | 2023 | unsigned long payload) |
2032 | unsigned long payload) | ||
2033 | { | 2024 | { |
2034 | struct iso_context *ctx = container_of(base, struct iso_context, base); | 2025 | struct iso_context *ctx = container_of(base, struct iso_context, base); |
2035 | struct descriptor *d, *last, *pd; | 2026 | struct descriptor *d, *last, *pd; |
@@ -2124,11 +2115,10 @@ ohci_queue_iso_transmit(struct fw_iso_context *base, | |||
2124 | return 0; | 2115 | return 0; |
2125 | } | 2116 | } |
2126 | 2117 | ||
2127 | static int | 2118 | static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, |
2128 | ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, | 2119 | struct fw_iso_packet *packet, |
2129 | struct fw_iso_packet *packet, | 2120 | struct fw_iso_buffer *buffer, |
2130 | struct fw_iso_buffer *buffer, | 2121 | unsigned long payload) |
2131 | unsigned long payload) | ||
2132 | { | 2122 | { |
2133 | struct iso_context *ctx = container_of(base, struct iso_context, base); | 2123 | struct iso_context *ctx = container_of(base, struct iso_context, base); |
2134 | struct db_descriptor *db = NULL; | 2124 | struct db_descriptor *db = NULL; |
@@ -2205,11 +2195,10 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, | |||
2205 | return 0; | 2195 | return 0; |
2206 | } | 2196 | } |
2207 | 2197 | ||
2208 | static int | 2198 | static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base, |
2209 | ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base, | 2199 | struct fw_iso_packet *packet, |
2210 | struct fw_iso_packet *packet, | 2200 | struct fw_iso_buffer *buffer, |
2211 | struct fw_iso_buffer *buffer, | 2201 | unsigned long payload) |
2212 | unsigned long payload) | ||
2213 | { | 2202 | { |
2214 | struct iso_context *ctx = container_of(base, struct iso_context, base); | 2203 | struct iso_context *ctx = container_of(base, struct iso_context, base); |
2215 | struct descriptor *d = NULL, *pd = NULL; | 2204 | struct descriptor *d = NULL, *pd = NULL; |
@@ -2283,11 +2272,10 @@ ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base, | |||
2283 | return 0; | 2272 | return 0; |
2284 | } | 2273 | } |
2285 | 2274 | ||
2286 | static int | 2275 | static int ohci_queue_iso(struct fw_iso_context *base, |
2287 | ohci_queue_iso(struct fw_iso_context *base, | 2276 | struct fw_iso_packet *packet, |
2288 | struct fw_iso_packet *packet, | 2277 | struct fw_iso_buffer *buffer, |
2289 | struct fw_iso_buffer *buffer, | 2278 | unsigned long payload) |
2290 | unsigned long payload) | ||
2291 | { | 2279 | { |
2292 | struct iso_context *ctx = container_of(base, struct iso_context, base); | 2280 | struct iso_context *ctx = container_of(base, struct iso_context, base); |
2293 | unsigned long flags; | 2281 | unsigned long flags; |
@@ -2353,8 +2341,8 @@ static void ohci_pmac_off(struct pci_dev *dev) | |||
2353 | #define ohci_pmac_off(dev) | 2341 | #define ohci_pmac_off(dev) |
2354 | #endif /* CONFIG_PPC_PMAC */ | 2342 | #endif /* CONFIG_PPC_PMAC */ |
2355 | 2343 | ||
2356 | static int __devinit | 2344 | static int __devinit pci_probe(struct pci_dev *dev, |
2357 | pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | 2345 | const struct pci_device_id *ent) |
2358 | { | 2346 | { |
2359 | struct fw_ohci *ohci; | 2347 | struct fw_ohci *ohci; |
2360 | u32 bus_options, max_receive, link_speed, version; | 2348 | u32 bus_options, max_receive, link_speed, version; |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index c71c4419d9e8..2bcf51557c72 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -392,20 +392,18 @@ static const struct { | |||
392 | } | 392 | } |
393 | }; | 393 | }; |
394 | 394 | ||
395 | static void | 395 | static void free_orb(struct kref *kref) |
396 | free_orb(struct kref *kref) | ||
397 | { | 396 | { |
398 | struct sbp2_orb *orb = container_of(kref, struct sbp2_orb, kref); | 397 | struct sbp2_orb *orb = container_of(kref, struct sbp2_orb, kref); |
399 | 398 | ||
400 | kfree(orb); | 399 | kfree(orb); |
401 | } | 400 | } |
402 | 401 | ||
403 | static void | 402 | static void sbp2_status_write(struct fw_card *card, struct fw_request *request, |
404 | sbp2_status_write(struct fw_card *card, struct fw_request *request, | 403 | int tcode, int destination, int source, |
405 | int tcode, int destination, int source, | 404 | int generation, int speed, |
406 | int generation, int speed, | 405 | unsigned long long offset, |
407 | unsigned long long offset, | 406 | void *payload, size_t length, void *callback_data) |
408 | void *payload, size_t length, void *callback_data) | ||
409 | { | 407 | { |
410 | struct sbp2_logical_unit *lu = callback_data; | 408 | struct sbp2_logical_unit *lu = callback_data; |
411 | struct sbp2_orb *orb; | 409 | struct sbp2_orb *orb; |
@@ -451,9 +449,8 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request, | |||
451 | fw_send_response(card, request, RCODE_COMPLETE); | 449 | fw_send_response(card, request, RCODE_COMPLETE); |
452 | } | 450 | } |
453 | 451 | ||
454 | static void | 452 | static void complete_transaction(struct fw_card *card, int rcode, |
455 | complete_transaction(struct fw_card *card, int rcode, | 453 | void *payload, size_t length, void *data) |
456 | void *payload, size_t length, void *data) | ||
457 | { | 454 | { |
458 | struct sbp2_orb *orb = data; | 455 | struct sbp2_orb *orb = data; |
459 | unsigned long flags; | 456 | unsigned long flags; |
@@ -482,9 +479,8 @@ complete_transaction(struct fw_card *card, int rcode, | |||
482 | kref_put(&orb->kref, free_orb); | 479 | kref_put(&orb->kref, free_orb); |
483 | } | 480 | } |
484 | 481 | ||
485 | static void | 482 | static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, |
486 | sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, | 483 | int node_id, int generation, u64 offset) |
487 | int node_id, int generation, u64 offset) | ||
488 | { | 484 | { |
489 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); | 485 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); |
490 | unsigned long flags; | 486 | unsigned long flags; |
@@ -531,8 +527,8 @@ static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu) | |||
531 | return retval; | 527 | return retval; |
532 | } | 528 | } |
533 | 529 | ||
534 | static void | 530 | static void complete_management_orb(struct sbp2_orb *base_orb, |
535 | complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) | 531 | struct sbp2_status *status) |
536 | { | 532 | { |
537 | struct sbp2_management_orb *orb = | 533 | struct sbp2_management_orb *orb = |
538 | container_of(base_orb, struct sbp2_management_orb, base); | 534 | container_of(base_orb, struct sbp2_management_orb, base); |
@@ -542,10 +538,9 @@ complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) | |||
542 | complete(&orb->done); | 538 | complete(&orb->done); |
543 | } | 539 | } |
544 | 540 | ||
545 | static int | 541 | static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, |
546 | sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, | 542 | int generation, int function, |
547 | int generation, int function, int lun_or_login_id, | 543 | int lun_or_login_id, void *response) |
548 | void *response) | ||
549 | { | 544 | { |
550 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); | 545 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); |
551 | struct sbp2_management_orb *orb; | 546 | struct sbp2_management_orb *orb; |
@@ -652,9 +647,8 @@ static void sbp2_agent_reset(struct sbp2_logical_unit *lu) | |||
652 | &d, sizeof(d)); | 647 | &d, sizeof(d)); |
653 | } | 648 | } |
654 | 649 | ||
655 | static void | 650 | static void complete_agent_reset_write_no_wait(struct fw_card *card, |
656 | complete_agent_reset_write_no_wait(struct fw_card *card, int rcode, | 651 | int rcode, void *payload, size_t length, void *data) |
657 | void *payload, size_t length, void *data) | ||
658 | { | 652 | { |
659 | kfree(data); | 653 | kfree(data); |
660 | } | 654 | } |
@@ -1299,8 +1293,7 @@ static void sbp2_unmap_scatterlist(struct device *card_device, | |||
1299 | sizeof(orb->page_table), DMA_TO_DEVICE); | 1293 | sizeof(orb->page_table), DMA_TO_DEVICE); |
1300 | } | 1294 | } |
1301 | 1295 | ||
1302 | static unsigned int | 1296 | static unsigned int sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data) |
1303 | sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data) | ||
1304 | { | 1297 | { |
1305 | int sam_status; | 1298 | int sam_status; |
1306 | 1299 | ||
@@ -1337,8 +1330,8 @@ sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data) | |||
1337 | } | 1330 | } |
1338 | } | 1331 | } |
1339 | 1332 | ||
1340 | static void | 1333 | static void complete_command_orb(struct sbp2_orb *base_orb, |
1341 | complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) | 1334 | struct sbp2_status *status) |
1342 | { | 1335 | { |
1343 | struct sbp2_command_orb *orb = | 1336 | struct sbp2_command_orb *orb = |
1344 | container_of(base_orb, struct sbp2_command_orb, base); | 1337 | container_of(base_orb, struct sbp2_command_orb, base); |
@@ -1384,9 +1377,8 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) | |||
1384 | orb->done(orb->cmd); | 1377 | orb->done(orb->cmd); |
1385 | } | 1378 | } |
1386 | 1379 | ||
1387 | static int | 1380 | static int sbp2_map_scatterlist(struct sbp2_command_orb *orb, |
1388 | sbp2_map_scatterlist(struct sbp2_command_orb *orb, struct fw_device *device, | 1381 | struct fw_device *device, struct sbp2_logical_unit *lu) |
1389 | struct sbp2_logical_unit *lu) | ||
1390 | { | 1382 | { |
1391 | struct scatterlist *sg = scsi_sglist(orb->cmd); | 1383 | struct scatterlist *sg = scsi_sglist(orb->cmd); |
1392 | int i, n; | 1384 | int i, n; |
@@ -1584,9 +1576,8 @@ static int sbp2_scsi_abort(struct scsi_cmnd *cmd) | |||
1584 | * This is the concatenation of target port identifier and logical unit | 1576 | * This is the concatenation of target port identifier and logical unit |
1585 | * identifier as per SAM-2...SAM-4 annex A. | 1577 | * identifier as per SAM-2...SAM-4 annex A. |
1586 | */ | 1578 | */ |
1587 | static ssize_t | 1579 | static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, |
1588 | sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, | 1580 | struct device_attribute *attr, char *buf) |
1589 | char *buf) | ||
1590 | { | 1581 | { |
1591 | struct scsi_device *sdev = to_scsi_device(dev); | 1582 | struct scsi_device *sdev = to_scsi_device(dev); |
1592 | struct sbp2_logical_unit *lu; | 1583 | struct sbp2_logical_unit *lu; |
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index 8dd6703b55cd..b44131cf0c62 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c | |||
@@ -314,9 +314,8 @@ typedef void (*fw_node_callback_t)(struct fw_card * card, | |||
314 | struct fw_node * node, | 314 | struct fw_node * node, |
315 | struct fw_node * parent); | 315 | struct fw_node * parent); |
316 | 316 | ||
317 | static void | 317 | static void for_each_fw_node(struct fw_card *card, struct fw_node *root, |
318 | for_each_fw_node(struct fw_card *card, struct fw_node *root, | 318 | fw_node_callback_t callback) |
319 | fw_node_callback_t callback) | ||
320 | { | 319 | { |
321 | struct list_head list; | 320 | struct list_head list; |
322 | struct fw_node *node, *next, *child, *parent; | 321 | struct fw_node *node, *next, *child, *parent; |
@@ -349,9 +348,8 @@ for_each_fw_node(struct fw_card *card, struct fw_node *root, | |||
349 | fw_node_put(node); | 348 | fw_node_put(node); |
350 | } | 349 | } |
351 | 350 | ||
352 | static void | 351 | static void report_lost_node(struct fw_card *card, |
353 | report_lost_node(struct fw_card *card, | 352 | struct fw_node *node, struct fw_node *parent) |
354 | struct fw_node *node, struct fw_node *parent) | ||
355 | { | 353 | { |
356 | fw_node_event(card, node, FW_NODE_DESTROYED); | 354 | fw_node_event(card, node, FW_NODE_DESTROYED); |
357 | fw_node_put(node); | 355 | fw_node_put(node); |
@@ -360,9 +358,8 @@ report_lost_node(struct fw_card *card, | |||
360 | card->bm_retries = 0; | 358 | card->bm_retries = 0; |
361 | } | 359 | } |
362 | 360 | ||
363 | static void | 361 | static void report_found_node(struct fw_card *card, |
364 | report_found_node(struct fw_card *card, | 362 | struct fw_node *node, struct fw_node *parent) |
365 | struct fw_node *node, struct fw_node *parent) | ||
366 | { | 363 | { |
367 | int b_path = (node->phy_speed == SCODE_BETA); | 364 | int b_path = (node->phy_speed == SCODE_BETA); |
368 | 365 | ||
@@ -415,8 +412,7 @@ static void move_tree(struct fw_node *node0, struct fw_node *node1, int port) | |||
415 | * found, lost or updated. Update the nodes in the card topology tree | 412 | * found, lost or updated. Update the nodes in the card topology tree |
416 | * as we go. | 413 | * as we go. |
417 | */ | 414 | */ |
418 | static void | 415 | static void update_tree(struct fw_card *card, struct fw_node *root) |
419 | update_tree(struct fw_card *card, struct fw_node *root) | ||
420 | { | 416 | { |
421 | struct list_head list0, list1; | 417 | struct list_head list0, list1; |
422 | struct fw_node *node0, *node1, *next1; | 418 | struct fw_node *node0, *node1, *next1; |
@@ -497,8 +493,8 @@ update_tree(struct fw_card *card, struct fw_node *root) | |||
497 | } | 493 | } |
498 | } | 494 | } |
499 | 495 | ||
500 | static void | 496 | static void update_topology_map(struct fw_card *card, |
501 | update_topology_map(struct fw_card *card, u32 *self_ids, int self_id_count) | 497 | u32 *self_ids, int self_id_count) |
502 | { | 498 | { |
503 | int node_count; | 499 | int node_count; |
504 | 500 | ||
@@ -510,10 +506,8 @@ update_topology_map(struct fw_card *card, u32 *self_ids, int self_id_count) | |||
510 | fw_compute_block_crc(card->topology_map); | 506 | fw_compute_block_crc(card->topology_map); |
511 | } | 507 | } |
512 | 508 | ||
513 | void | 509 | void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, |
514 | fw_core_handle_bus_reset(struct fw_card *card, | 510 | int self_id_count, u32 *self_ids) |
515 | int node_id, int generation, | ||
516 | int self_id_count, u32 * self_ids) | ||
517 | { | 511 | { |
518 | struct fw_node *local_node; | 512 | struct fw_node *local_node; |
519 | unsigned long flags; | 513 | unsigned long flags; |
diff --git a/drivers/firewire/fw-topology.h b/drivers/firewire/fw-topology.h index addb9f8ea776..7e930f80beb3 100644 --- a/drivers/firewire/fw-topology.h +++ b/drivers/firewire/fw-topology.h | |||
@@ -51,26 +51,21 @@ struct fw_node { | |||
51 | struct fw_node *ports[0]; | 51 | struct fw_node *ports[0]; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static inline struct fw_node * | 54 | static inline struct fw_node *fw_node_get(struct fw_node *node) |
55 | fw_node_get(struct fw_node *node) | ||
56 | { | 55 | { |
57 | atomic_inc(&node->ref_count); | 56 | atomic_inc(&node->ref_count); |
58 | 57 | ||
59 | return node; | 58 | return node; |
60 | } | 59 | } |
61 | 60 | ||
62 | static inline void | 61 | static inline void fw_node_put(struct fw_node *node) |
63 | fw_node_put(struct fw_node *node) | ||
64 | { | 62 | { |
65 | if (atomic_dec_and_test(&node->ref_count)) | 63 | if (atomic_dec_and_test(&node->ref_count)) |
66 | kfree(node); | 64 | kfree(node); |
67 | } | 65 | } |
68 | 66 | ||
69 | void | 67 | void fw_destroy_nodes(struct fw_card *card); |
70 | fw_destroy_nodes(struct fw_card *card); | ||
71 | |||
72 | int | ||
73 | fw_compute_block_crc(u32 *block); | ||
74 | 68 | ||
69 | int fw_compute_block_crc(u32 *block); | ||
75 | 70 | ||
76 | #endif /* __fw_topology_h */ | 71 | #endif /* __fw_topology_h */ |
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index e17ebc42f12c..1537737e4420 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -64,10 +64,9 @@ | |||
64 | #define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23)) | 64 | #define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23)) |
65 | #define PHY_IDENTIFIER(id) ((id) << 30) | 65 | #define PHY_IDENTIFIER(id) ((id) << 30) |
66 | 66 | ||
67 | static int | 67 | static int close_transaction(struct fw_transaction *transaction, |
68 | close_transaction(struct fw_transaction *transaction, | 68 | struct fw_card *card, int rcode, |
69 | struct fw_card *card, int rcode, | 69 | u32 *payload, size_t length) |
70 | u32 *payload, size_t length) | ||
71 | { | 70 | { |
72 | struct fw_transaction *t; | 71 | struct fw_transaction *t; |
73 | unsigned long flags; | 72 | unsigned long flags; |
@@ -94,9 +93,8 @@ close_transaction(struct fw_transaction *transaction, | |||
94 | * Only valid for transactions that are potentially pending (ie have | 93 | * Only valid for transactions that are potentially pending (ie have |
95 | * been sent). | 94 | * been sent). |
96 | */ | 95 | */ |
97 | int | 96 | int fw_cancel_transaction(struct fw_card *card, |
98 | fw_cancel_transaction(struct fw_card *card, | 97 | struct fw_transaction *transaction) |
99 | struct fw_transaction *transaction) | ||
100 | { | 98 | { |
101 | /* | 99 | /* |
102 | * Cancel the packet transmission if it's still queued. That | 100 | * Cancel the packet transmission if it's still queued. That |
@@ -116,9 +114,8 @@ fw_cancel_transaction(struct fw_card *card, | |||
116 | } | 114 | } |
117 | EXPORT_SYMBOL(fw_cancel_transaction); | 115 | EXPORT_SYMBOL(fw_cancel_transaction); |
118 | 116 | ||
119 | static void | 117 | static void transmit_complete_callback(struct fw_packet *packet, |
120 | transmit_complete_callback(struct fw_packet *packet, | 118 | struct fw_card *card, int status) |
121 | struct fw_card *card, int status) | ||
122 | { | 119 | { |
123 | struct fw_transaction *t = | 120 | struct fw_transaction *t = |
124 | container_of(packet, struct fw_transaction, packet); | 121 | container_of(packet, struct fw_transaction, packet); |
@@ -151,8 +148,7 @@ transmit_complete_callback(struct fw_packet *packet, | |||
151 | } | 148 | } |
152 | } | 149 | } |
153 | 150 | ||
154 | static void | 151 | static void fw_fill_request(struct fw_packet *packet, int tcode, int tlabel, |
155 | fw_fill_request(struct fw_packet *packet, int tcode, int tlabel, | ||
156 | int destination_id, int source_id, int generation, int speed, | 152 | int destination_id, int source_id, int generation, int speed, |
157 | unsigned long long offset, void *payload, size_t length) | 153 | unsigned long long offset, void *payload, size_t length) |
158 | { | 154 | { |
@@ -247,12 +243,10 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel, | |||
247 | * @param callback_data pointer to arbitrary data, which will be | 243 | * @param callback_data pointer to arbitrary data, which will be |
248 | * passed to the callback | 244 | * passed to the callback |
249 | */ | 245 | */ |
250 | void | 246 | void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode, |
251 | fw_send_request(struct fw_card *card, struct fw_transaction *t, | 247 | int destination_id, int generation, int speed, |
252 | int tcode, int destination_id, int generation, int speed, | 248 | unsigned long long offset, void *payload, size_t length, |
253 | unsigned long long offset, | 249 | fw_transaction_callback_t callback, void *callback_data) |
254 | void *payload, size_t length, | ||
255 | fw_transaction_callback_t callback, void *callback_data) | ||
256 | { | 250 | { |
257 | unsigned long flags; | 251 | unsigned long flags; |
258 | int tlabel; | 252 | int tlabel; |
@@ -322,8 +316,8 @@ static void transaction_callback(struct fw_card *card, int rcode, | |||
322 | * Returns the RCODE. | 316 | * Returns the RCODE. |
323 | */ | 317 | */ |
324 | int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, | 318 | int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, |
325 | int generation, int speed, unsigned long long offset, | 319 | int generation, int speed, unsigned long long offset, |
326 | void *data, size_t length) | 320 | void *data, size_t length) |
327 | { | 321 | { |
328 | struct transaction_callback_data d; | 322 | struct transaction_callback_data d; |
329 | struct fw_transaction t; | 323 | struct fw_transaction t; |
@@ -399,9 +393,8 @@ void fw_flush_transactions(struct fw_card *card) | |||
399 | } | 393 | } |
400 | } | 394 | } |
401 | 395 | ||
402 | static struct fw_address_handler * | 396 | static struct fw_address_handler *lookup_overlapping_address_handler( |
403 | lookup_overlapping_address_handler(struct list_head *list, | 397 | struct list_head *list, unsigned long long offset, size_t length) |
404 | unsigned long long offset, size_t length) | ||
405 | { | 398 | { |
406 | struct fw_address_handler *handler; | 399 | struct fw_address_handler *handler; |
407 | 400 | ||
@@ -414,9 +407,8 @@ lookup_overlapping_address_handler(struct list_head *list, | |||
414 | return NULL; | 407 | return NULL; |
415 | } | 408 | } |
416 | 409 | ||
417 | static struct fw_address_handler * | 410 | static struct fw_address_handler *lookup_enclosing_address_handler( |
418 | lookup_enclosing_address_handler(struct list_head *list, | 411 | struct list_head *list, unsigned long long offset, size_t length) |
419 | unsigned long long offset, size_t length) | ||
420 | { | 412 | { |
421 | struct fw_address_handler *handler; | 413 | struct fw_address_handler *handler; |
422 | 414 | ||
@@ -463,9 +455,8 @@ const struct fw_address_region fw_unit_space_region = | |||
463 | * The start offset of the handler's address region is determined by | 455 | * The start offset of the handler's address region is determined by |
464 | * fw_core_add_address_handler() and is returned in handler->offset. | 456 | * fw_core_add_address_handler() and is returned in handler->offset. |
465 | */ | 457 | */ |
466 | int | 458 | int fw_core_add_address_handler(struct fw_address_handler *handler, |
467 | fw_core_add_address_handler(struct fw_address_handler *handler, | 459 | const struct fw_address_region *region) |
468 | const struct fw_address_region *region) | ||
469 | { | 460 | { |
470 | struct fw_address_handler *other; | 461 | struct fw_address_handler *other; |
471 | unsigned long flags; | 462 | unsigned long flags; |
@@ -522,9 +513,8 @@ struct fw_request { | |||
522 | u32 data[0]; | 513 | u32 data[0]; |
523 | }; | 514 | }; |
524 | 515 | ||
525 | static void | 516 | static void free_response_callback(struct fw_packet *packet, |
526 | free_response_callback(struct fw_packet *packet, | 517 | struct fw_card *card, int status) |
527 | struct fw_card *card, int status) | ||
528 | { | 518 | { |
529 | struct fw_request *request; | 519 | struct fw_request *request; |
530 | 520 | ||
@@ -532,9 +522,8 @@ free_response_callback(struct fw_packet *packet, | |||
532 | kfree(request); | 522 | kfree(request); |
533 | } | 523 | } |
534 | 524 | ||
535 | void | 525 | void fw_fill_response(struct fw_packet *response, u32 *request_header, |
536 | fw_fill_response(struct fw_packet *response, u32 *request_header, | 526 | int rcode, void *payload, size_t length) |
537 | int rcode, void *payload, size_t length) | ||
538 | { | 527 | { |
539 | int tcode, tlabel, extended_tcode, source, destination; | 528 | int tcode, tlabel, extended_tcode, source, destination; |
540 | 529 | ||
@@ -592,8 +581,7 @@ fw_fill_response(struct fw_packet *response, u32 *request_header, | |||
592 | } | 581 | } |
593 | EXPORT_SYMBOL(fw_fill_response); | 582 | EXPORT_SYMBOL(fw_fill_response); |
594 | 583 | ||
595 | static struct fw_request * | 584 | static struct fw_request *allocate_request(struct fw_packet *p) |
596 | allocate_request(struct fw_packet *p) | ||
597 | { | 585 | { |
598 | struct fw_request *request; | 586 | struct fw_request *request; |
599 | u32 *data, length; | 587 | u32 *data, length; |
@@ -653,8 +641,8 @@ allocate_request(struct fw_packet *p) | |||
653 | return request; | 641 | return request; |
654 | } | 642 | } |
655 | 643 | ||
656 | void | 644 | void fw_send_response(struct fw_card *card, |
657 | fw_send_response(struct fw_card *card, struct fw_request *request, int rcode) | 645 | struct fw_request *request, int rcode) |
658 | { | 646 | { |
659 | /* unified transaction or broadcast transaction: don't respond */ | 647 | /* unified transaction or broadcast transaction: don't respond */ |
660 | if (request->ack != ACK_PENDING || | 648 | if (request->ack != ACK_PENDING || |
@@ -674,8 +662,7 @@ fw_send_response(struct fw_card *card, struct fw_request *request, int rcode) | |||
674 | } | 662 | } |
675 | EXPORT_SYMBOL(fw_send_response); | 663 | EXPORT_SYMBOL(fw_send_response); |
676 | 664 | ||
677 | void | 665 | void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) |
678 | fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | ||
679 | { | 666 | { |
680 | struct fw_address_handler *handler; | 667 | struct fw_address_handler *handler; |
681 | struct fw_request *request; | 668 | struct fw_request *request; |
@@ -723,8 +710,7 @@ fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | |||
723 | } | 710 | } |
724 | EXPORT_SYMBOL(fw_core_handle_request); | 711 | EXPORT_SYMBOL(fw_core_handle_request); |
725 | 712 | ||
726 | void | 713 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
727 | fw_core_handle_response(struct fw_card *card, struct fw_packet *p) | ||
728 | { | 714 | { |
729 | struct fw_transaction *t; | 715 | struct fw_transaction *t; |
730 | unsigned long flags; | 716 | unsigned long flags; |
@@ -797,12 +783,10 @@ static const struct fw_address_region topology_map_region = | |||
797 | { .start = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP, | 783 | { .start = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP, |
798 | .end = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP_END, }; | 784 | .end = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP_END, }; |
799 | 785 | ||
800 | static void | 786 | static void handle_topology_map(struct fw_card *card, struct fw_request *request, |
801 | handle_topology_map(struct fw_card *card, struct fw_request *request, | 787 | int tcode, int destination, int source, int generation, |
802 | int tcode, int destination, int source, | 788 | int speed, unsigned long long offset, |
803 | int generation, int speed, | 789 | void *payload, size_t length, void *callback_data) |
804 | unsigned long long offset, | ||
805 | void *payload, size_t length, void *callback_data) | ||
806 | { | 790 | { |
807 | int i, start, end; | 791 | int i, start, end; |
808 | __be32 *map; | 792 | __be32 *map; |
@@ -836,12 +820,10 @@ static const struct fw_address_region registers_region = | |||
836 | { .start = CSR_REGISTER_BASE, | 820 | { .start = CSR_REGISTER_BASE, |
837 | .end = CSR_REGISTER_BASE | CSR_CONFIG_ROM, }; | 821 | .end = CSR_REGISTER_BASE | CSR_CONFIG_ROM, }; |
838 | 822 | ||
839 | static void | 823 | static void handle_registers(struct fw_card *card, struct fw_request *request, |
840 | handle_registers(struct fw_card *card, struct fw_request *request, | 824 | int tcode, int destination, int source, int generation, |
841 | int tcode, int destination, int source, | 825 | int speed, unsigned long long offset, |
842 | int generation, int speed, | 826 | void *payload, size_t length, void *callback_data) |
843 | unsigned long long offset, | ||
844 | void *payload, size_t length, void *callback_data) | ||
845 | { | 827 | { |
846 | int reg = offset & ~CSR_REGISTER_BASE; | 828 | int reg = offset & ~CSR_REGISTER_BASE; |
847 | unsigned long long bus_time; | 829 | unsigned long long bus_time; |
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 1d78e9cc5940..7112e62942ff 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -88,8 +88,7 @@ | |||
88 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) | 88 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) |
89 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) | 89 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) |
90 | 90 | ||
91 | static inline void | 91 | static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size) |
92 | fw_memcpy_from_be32(void *_dst, void *_src, size_t size) | ||
93 | { | 92 | { |
94 | u32 *dst = _dst; | 93 | u32 *dst = _dst; |
95 | __be32 *src = _src; | 94 | __be32 *src = _src; |
@@ -99,8 +98,7 @@ fw_memcpy_from_be32(void *_dst, void *_src, size_t size) | |||
99 | dst[i] = be32_to_cpu(src[i]); | 98 | dst[i] = be32_to_cpu(src[i]); |
100 | } | 99 | } |
101 | 100 | ||
102 | static inline void | 101 | static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size) |
103 | fw_memcpy_to_be32(void *_dst, void *_src, size_t size) | ||
104 | { | 102 | { |
105 | fw_memcpy_from_be32(_dst, _src, size); | 103 | fw_memcpy_from_be32(_dst, _src, size); |
106 | } | 104 | } |
@@ -125,8 +123,7 @@ typedef void (*fw_packet_callback_t)(struct fw_packet *packet, | |||
125 | struct fw_card *card, int status); | 123 | struct fw_card *card, int status); |
126 | 124 | ||
127 | typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | 125 | typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, |
128 | void *data, | 126 | void *data, size_t length, |
129 | size_t length, | ||
130 | void *callback_data); | 127 | void *callback_data); |
131 | 128 | ||
132 | /* | 129 | /* |
@@ -201,7 +198,6 @@ struct fw_address_handler { | |||
201 | struct list_head link; | 198 | struct list_head link; |
202 | }; | 199 | }; |
203 | 200 | ||
204 | |||
205 | struct fw_address_region { | 201 | struct fw_address_region { |
206 | u64 start; | 202 | u64 start; |
207 | u64 end; | 203 | u64 end; |
@@ -315,10 +311,8 @@ struct fw_iso_packet { | |||
315 | struct fw_iso_context; | 311 | struct fw_iso_context; |
316 | 312 | ||
317 | typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, | 313 | typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, |
318 | u32 cycle, | 314 | u32 cycle, size_t header_length, |
319 | size_t header_length, | 315 | void *header, void *data); |
320 | void *header, | ||
321 | void *data); | ||
322 | 316 | ||
323 | /* | 317 | /* |
324 | * An iso buffer is just a set of pages mapped for DMA in the | 318 | * An iso buffer is just a set of pages mapped for DMA in the |
@@ -344,36 +338,22 @@ struct fw_iso_context { | |||
344 | void *callback_data; | 338 | void *callback_data; |
345 | }; | 339 | }; |
346 | 340 | ||
347 | int | 341 | int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, |
348 | fw_iso_buffer_init(struct fw_iso_buffer *buffer, | 342 | int page_count, enum dma_data_direction direction); |
349 | struct fw_card *card, | 343 | int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma); |
350 | int page_count, | 344 | void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); |
351 | enum dma_data_direction direction); | 345 | |
352 | int | 346 | struct fw_iso_context *fw_iso_context_create(struct fw_card *card, |
353 | fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma); | 347 | int type, int channel, int speed, size_t header_size, |
354 | void | 348 | fw_iso_callback_t callback, void *callback_data); |
355 | fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); | 349 | int fw_iso_context_queue(struct fw_iso_context *ctx, |
356 | 350 | struct fw_iso_packet *packet, | |
357 | struct fw_iso_context * | 351 | struct fw_iso_buffer *buffer, |
358 | fw_iso_context_create(struct fw_card *card, int type, | 352 | unsigned long payload); |
359 | int channel, int speed, size_t header_size, | 353 | int fw_iso_context_start(struct fw_iso_context *ctx, |
360 | fw_iso_callback_t callback, void *callback_data); | 354 | int cycle, int sync, int tags); |
361 | 355 | int fw_iso_context_stop(struct fw_iso_context *ctx); | |
362 | void | 356 | void fw_iso_context_destroy(struct fw_iso_context *ctx); |
363 | fw_iso_context_destroy(struct fw_iso_context *ctx); | ||
364 | |||
365 | int | ||
366 | fw_iso_context_queue(struct fw_iso_context *ctx, | ||
367 | struct fw_iso_packet *packet, | ||
368 | struct fw_iso_buffer *buffer, | ||
369 | unsigned long payload); | ||
370 | |||
371 | int | ||
372 | fw_iso_context_start(struct fw_iso_context *ctx, | ||
373 | int cycle, int sync, int tags); | ||
374 | |||
375 | int | ||
376 | fw_iso_context_stop(struct fw_iso_context *ctx); | ||
377 | 357 | ||
378 | struct fw_card_driver { | 358 | struct fw_card_driver { |
379 | /* | 359 | /* |
@@ -429,24 +409,18 @@ struct fw_card_driver { | |||
429 | int (*stop_iso)(struct fw_iso_context *ctx); | 409 | int (*stop_iso)(struct fw_iso_context *ctx); |
430 | }; | 410 | }; |
431 | 411 | ||
432 | int | 412 | int fw_core_initiate_bus_reset(struct fw_card *card, int short_reset); |
433 | fw_core_initiate_bus_reset(struct fw_card *card, int short_reset); | ||
434 | 413 | ||
435 | void | 414 | void fw_send_request(struct fw_card *card, struct fw_transaction *t, |
436 | fw_send_request(struct fw_card *card, struct fw_transaction *t, | ||
437 | int tcode, int destination_id, int generation, int speed, | 415 | int tcode, int destination_id, int generation, int speed, |
438 | unsigned long long offset, void *data, size_t length, | 416 | unsigned long long offset, void *data, size_t length, |
439 | fw_transaction_callback_t callback, void *callback_data); | 417 | fw_transaction_callback_t callback, void *callback_data); |
440 | |||
441 | int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, | ||
442 | int generation, int speed, unsigned long long offset, | ||
443 | void *data, size_t length); | ||
444 | |||
445 | int fw_cancel_transaction(struct fw_card *card, | 418 | int fw_cancel_transaction(struct fw_card *card, |
446 | struct fw_transaction *transaction); | 419 | struct fw_transaction *transaction); |
447 | |||
448 | void fw_flush_transactions(struct fw_card *card); | 420 | void fw_flush_transactions(struct fw_card *card); |
449 | 421 | int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, | |
422 | int generation, int speed, unsigned long long offset, | ||
423 | void *data, size_t length); | ||
450 | void fw_send_phy_config(struct fw_card *card, | 424 | void fw_send_phy_config(struct fw_card *card, |
451 | int node_id, int generation, int gap_count); | 425 | int node_id, int generation, int gap_count); |
452 | 426 | ||
@@ -454,29 +428,18 @@ void fw_send_phy_config(struct fw_card *card, | |||
454 | * Called by the topology code to inform the device code of node | 428 | * Called by the topology code to inform the device code of node |
455 | * activity; found, lost, or updated nodes. | 429 | * activity; found, lost, or updated nodes. |
456 | */ | 430 | */ |
457 | void | 431 | void fw_node_event(struct fw_card *card, struct fw_node *node, int event); |
458 | fw_node_event(struct fw_card *card, struct fw_node *node, int event); | ||
459 | 432 | ||
460 | /* API used by card level drivers */ | 433 | /* API used by card level drivers */ |
461 | 434 | ||
462 | void | 435 | void fw_card_initialize(struct fw_card *card, |
463 | fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, | 436 | const struct fw_card_driver *driver, struct device *device); |
464 | struct device *device); | 437 | int fw_card_add(struct fw_card *card, |
465 | int | 438 | u32 max_receive, u32 link_speed, u64 guid); |
466 | fw_card_add(struct fw_card *card, | 439 | void fw_core_remove_card(struct fw_card *card); |
467 | u32 max_receive, u32 link_speed, u64 guid); | 440 | void fw_core_handle_bus_reset(struct fw_card *card, int node_id, |
468 | 441 | int generation, int self_id_count, u32 *self_ids); | |
469 | void | 442 | void fw_core_handle_request(struct fw_card *card, struct fw_packet *request); |
470 | fw_core_remove_card(struct fw_card *card); | 443 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *packet); |
471 | |||
472 | void | ||
473 | fw_core_handle_bus_reset(struct fw_card *card, | ||
474 | int node_id, int generation, | ||
475 | int self_id_count, u32 *self_ids); | ||
476 | void | ||
477 | fw_core_handle_request(struct fw_card *card, struct fw_packet *request); | ||
478 | |||
479 | void | ||
480 | fw_core_handle_response(struct fw_card *card, struct fw_packet *packet); | ||
481 | 444 | ||
482 | #endif /* __fw_transaction_h */ | 445 | #endif /* __fw_transaction_h */ |