diff options
Diffstat (limited to 'drivers/ieee1394/raw1394.c')
-rw-r--r-- | drivers/ieee1394/raw1394.c | 176 |
1 files changed, 5 insertions, 171 deletions
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 1dadd5a15ba1..336e5ff4cfcf 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -98,21 +98,6 @@ static struct hpsb_address_ops arm_ops = { | |||
98 | 98 | ||
99 | static void queue_complete_cb(struct pending_request *req); | 99 | static void queue_complete_cb(struct pending_request *req); |
100 | 100 | ||
101 | #include <asm/current.h> | ||
102 | static void print_old_iso_deprecation(void) | ||
103 | { | ||
104 | static pid_t p; | ||
105 | |||
106 | if (p == current->pid) | ||
107 | return; | ||
108 | p = current->pid; | ||
109 | printk(KERN_WARNING "raw1394: WARNING - Program \"%s\" uses unsupported" | ||
110 | " isochronous request types which will be removed in a next" | ||
111 | " kernel release\n", current->comm); | ||
112 | printk(KERN_WARNING "raw1394: Update your software to use libraw1394's" | ||
113 | " newer interface\n"); | ||
114 | } | ||
115 | |||
116 | static struct pending_request *__alloc_pending_request(gfp_t flags) | 101 | static struct pending_request *__alloc_pending_request(gfp_t flags) |
117 | { | 102 | { |
118 | struct pending_request *req; | 103 | struct pending_request *req; |
@@ -297,67 +282,6 @@ static void host_reset(struct hpsb_host *host) | |||
297 | spin_unlock_irqrestore(&host_info_lock, flags); | 282 | spin_unlock_irqrestore(&host_info_lock, flags); |
298 | } | 283 | } |
299 | 284 | ||
300 | static void iso_receive(struct hpsb_host *host, int channel, quadlet_t * data, | ||
301 | size_t length) | ||
302 | { | ||
303 | unsigned long flags; | ||
304 | struct host_info *hi; | ||
305 | struct file_info *fi; | ||
306 | struct pending_request *req, *req_next; | ||
307 | struct iso_block_store *ibs = NULL; | ||
308 | LIST_HEAD(reqs); | ||
309 | |||
310 | if ((atomic_read(&iso_buffer_size) + length) > iso_buffer_max) { | ||
311 | HPSB_INFO("dropped iso packet"); | ||
312 | return; | ||
313 | } | ||
314 | |||
315 | spin_lock_irqsave(&host_info_lock, flags); | ||
316 | hi = find_host_info(host); | ||
317 | |||
318 | if (hi != NULL) { | ||
319 | list_for_each_entry(fi, &hi->file_info_list, list) { | ||
320 | if (!(fi->listen_channels & (1ULL << channel))) | ||
321 | continue; | ||
322 | |||
323 | req = __alloc_pending_request(GFP_ATOMIC); | ||
324 | if (!req) | ||
325 | break; | ||
326 | |||
327 | if (!ibs) { | ||
328 | ibs = kmalloc(sizeof(*ibs) + length, | ||
329 | GFP_ATOMIC); | ||
330 | if (!ibs) { | ||
331 | kfree(req); | ||
332 | break; | ||
333 | } | ||
334 | |||
335 | atomic_add(length, &iso_buffer_size); | ||
336 | atomic_set(&ibs->refcount, 0); | ||
337 | ibs->data_size = length; | ||
338 | memcpy(ibs->data, data, length); | ||
339 | } | ||
340 | |||
341 | atomic_inc(&ibs->refcount); | ||
342 | |||
343 | req->file_info = fi; | ||
344 | req->ibs = ibs; | ||
345 | req->data = ibs->data; | ||
346 | req->req.type = RAW1394_REQ_ISO_RECEIVE; | ||
347 | req->req.generation = get_hpsb_generation(host); | ||
348 | req->req.misc = 0; | ||
349 | req->req.recvb = ptr2int(fi->iso_buffer); | ||
350 | req->req.length = min(length, fi->iso_buffer_length); | ||
351 | |||
352 | list_add_tail(&req->list, &reqs); | ||
353 | } | ||
354 | } | ||
355 | spin_unlock_irqrestore(&host_info_lock, flags); | ||
356 | |||
357 | list_for_each_entry_safe(req, req_next, &reqs, list) | ||
358 | queue_complete_req(req); | ||
359 | } | ||
360 | |||
361 | static void fcp_request(struct hpsb_host *host, int nodeid, int direction, | 285 | static void fcp_request(struct hpsb_host *host, int nodeid, int direction, |
362 | int cts, u8 * data, size_t length) | 286 | int cts, u8 * data, size_t length) |
363 | { | 287 | { |
@@ -680,43 +604,6 @@ out_set_card: | |||
680 | return 0; | 604 | return 0; |
681 | } | 605 | } |
682 | 606 | ||
683 | static void handle_iso_listen(struct file_info *fi, struct pending_request *req) | ||
684 | { | ||
685 | int channel = req->req.misc; | ||
686 | |||
687 | if ((channel > 63) || (channel < -64)) { | ||
688 | req->req.error = RAW1394_ERROR_INVALID_ARG; | ||
689 | } else if (channel >= 0) { | ||
690 | /* allocate channel req.misc */ | ||
691 | if (fi->listen_channels & (1ULL << channel)) { | ||
692 | req->req.error = RAW1394_ERROR_ALREADY; | ||
693 | } else { | ||
694 | if (hpsb_listen_channel | ||
695 | (&raw1394_highlevel, fi->host, channel)) { | ||
696 | req->req.error = RAW1394_ERROR_ALREADY; | ||
697 | } else { | ||
698 | fi->listen_channels |= 1ULL << channel; | ||
699 | fi->iso_buffer = int2ptr(req->req.recvb); | ||
700 | fi->iso_buffer_length = req->req.length; | ||
701 | } | ||
702 | } | ||
703 | } else { | ||
704 | /* deallocate channel (one's complement neg) req.misc */ | ||
705 | channel = ~channel; | ||
706 | |||
707 | if (fi->listen_channels & (1ULL << channel)) { | ||
708 | hpsb_unlisten_channel(&raw1394_highlevel, fi->host, | ||
709 | channel); | ||
710 | fi->listen_channels &= ~(1ULL << channel); | ||
711 | } else { | ||
712 | req->req.error = RAW1394_ERROR_INVALID_ARG; | ||
713 | } | ||
714 | } | ||
715 | |||
716 | req->req.length = 0; | ||
717 | queue_complete_req(req); | ||
718 | } | ||
719 | |||
720 | static void handle_fcp_listen(struct file_info *fi, struct pending_request *req) | 607 | static void handle_fcp_listen(struct file_info *fi, struct pending_request *req) |
721 | { | 608 | { |
722 | if (req->req.misc) { | 609 | if (req->req.misc) { |
@@ -890,50 +777,6 @@ static int handle_async_request(struct file_info *fi, | |||
890 | return 0; | 777 | return 0; |
891 | } | 778 | } |
892 | 779 | ||
893 | static int handle_iso_send(struct file_info *fi, struct pending_request *req, | ||
894 | int channel) | ||
895 | { | ||
896 | unsigned long flags; | ||
897 | struct hpsb_packet *packet; | ||
898 | |||
899 | packet = hpsb_make_isopacket(fi->host, req->req.length, channel & 0x3f, | ||
900 | (req->req.misc >> 16) & 0x3, | ||
901 | req->req.misc & 0xf); | ||
902 | if (!packet) | ||
903 | return -ENOMEM; | ||
904 | |||
905 | packet->speed_code = req->req.address & 0x3; | ||
906 | |||
907 | req->packet = packet; | ||
908 | |||
909 | if (copy_from_user(packet->data, int2ptr(req->req.sendb), | ||
910 | req->req.length)) { | ||
911 | req->req.error = RAW1394_ERROR_MEMFAULT; | ||
912 | req->req.length = 0; | ||
913 | queue_complete_req(req); | ||
914 | return 0; | ||
915 | } | ||
916 | |||
917 | req->req.length = 0; | ||
918 | hpsb_set_packet_complete_task(packet, | ||
919 | (void (*)(void *))queue_complete_req, | ||
920 | req); | ||
921 | |||
922 | spin_lock_irqsave(&fi->reqlists_lock, flags); | ||
923 | list_add_tail(&req->list, &fi->req_pending); | ||
924 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); | ||
925 | |||
926 | /* Update the generation of the packet just before sending. */ | ||
927 | packet->generation = req->req.generation; | ||
928 | |||
929 | if (hpsb_send_packet(packet) < 0) { | ||
930 | req->req.error = RAW1394_ERROR_SEND_ERROR; | ||
931 | queue_complete_req(req); | ||
932 | } | ||
933 | |||
934 | return 0; | ||
935 | } | ||
936 | |||
937 | static int handle_async_send(struct file_info *fi, struct pending_request *req) | 780 | static int handle_async_send(struct file_info *fi, struct pending_request *req) |
938 | { | 781 | { |
939 | unsigned long flags; | 782 | unsigned long flags; |
@@ -2317,10 +2160,6 @@ static int state_connected(struct file_info *fi, struct pending_request *req) | |||
2317 | queue_complete_req(req); | 2160 | queue_complete_req(req); |
2318 | return 0; | 2161 | return 0; |
2319 | 2162 | ||
2320 | case RAW1394_REQ_ISO_SEND: | ||
2321 | print_old_iso_deprecation(); | ||
2322 | return handle_iso_send(fi, req, node); | ||
2323 | |||
2324 | case RAW1394_REQ_ARM_REGISTER: | 2163 | case RAW1394_REQ_ARM_REGISTER: |
2325 | return arm_register(fi, req); | 2164 | return arm_register(fi, req); |
2326 | 2165 | ||
@@ -2336,9 +2175,12 @@ static int state_connected(struct file_info *fi, struct pending_request *req) | |||
2336 | case RAW1394_REQ_RESET_NOTIFY: | 2175 | case RAW1394_REQ_RESET_NOTIFY: |
2337 | return reset_notification(fi, req); | 2176 | return reset_notification(fi, req); |
2338 | 2177 | ||
2178 | case RAW1394_REQ_ISO_SEND: | ||
2339 | case RAW1394_REQ_ISO_LISTEN: | 2179 | case RAW1394_REQ_ISO_LISTEN: |
2340 | print_old_iso_deprecation(); | 2180 | printk(KERN_DEBUG "raw1394: old iso ABI has been removed\n"); |
2341 | handle_iso_listen(fi, req); | 2181 | req->req.error = RAW1394_ERROR_COMPAT; |
2182 | req->req.misc = RAW1394_KERNELAPI_VERSION; | ||
2183 | queue_complete_req(req); | ||
2342 | return 0; | 2184 | return 0; |
2343 | 2185 | ||
2344 | case RAW1394_REQ_FCP_LISTEN: | 2186 | case RAW1394_REQ_FCP_LISTEN: |
@@ -2965,14 +2807,7 @@ static int raw1394_release(struct inode *inode, struct file *file) | |||
2965 | if (fi->iso_state != RAW1394_ISO_INACTIVE) | 2807 | if (fi->iso_state != RAW1394_ISO_INACTIVE) |
2966 | raw1394_iso_shutdown(fi); | 2808 | raw1394_iso_shutdown(fi); |
2967 | 2809 | ||
2968 | for (i = 0; i < 64; i++) { | ||
2969 | if (fi->listen_channels & (1ULL << i)) { | ||
2970 | hpsb_unlisten_channel(&raw1394_highlevel, fi->host, i); | ||
2971 | } | ||
2972 | } | ||
2973 | |||
2974 | spin_lock_irqsave(&host_info_lock, flags); | 2810 | spin_lock_irqsave(&host_info_lock, flags); |
2975 | fi->listen_channels = 0; | ||
2976 | 2811 | ||
2977 | fail = 0; | 2812 | fail = 0; |
2978 | /* set address-entries invalid */ | 2813 | /* set address-entries invalid */ |
@@ -3134,7 +2969,6 @@ static struct hpsb_highlevel raw1394_highlevel = { | |||
3134 | .add_host = add_host, | 2969 | .add_host = add_host, |
3135 | .remove_host = remove_host, | 2970 | .remove_host = remove_host, |
3136 | .host_reset = host_reset, | 2971 | .host_reset = host_reset, |
3137 | .iso_receive = iso_receive, | ||
3138 | .fcp_request = fcp_request, | 2972 | .fcp_request = fcp_request, |
3139 | }; | 2973 | }; |
3140 | 2974 | ||