2 * Char device for device raw access
4 * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include <linux/module.h>
22 #include <linux/kernel.h>
23 #include <linux/wait.h>
24 #include <linux/errno.h>
25 #include <linux/device.h>
26 #include <linux/vmalloc.h>
27 #include <linux/poll.h>
28 #include <linux/preempt.h>
29 #include <linux/time.h>
30 #include <linux/delay.h>
32 #include <linux/idr.h>
33 #include <linux/compat.h>
34 #include <linux/firewire-cdev.h>
35 #include <asm/system.h>
36 #include <asm/uaccess.h>
37 #include "fw-transaction.h"
38 #include "fw-topology.h"
39 #include "fw-device.h"
42 struct client_resource {
43 struct list_head link;
44 void (*release)(struct client *client, struct client_resource *r);
49 * dequeue_event() just kfree()'s the event, so the event has to be
50 * the first field in the struct.
54 struct { void *data; size_t size; } v[2];
55 struct list_head link;
60 struct fw_cdev_event_bus_reset reset;
65 struct fw_transaction transaction;
66 struct client *client;
67 struct client_resource resource;
68 struct fw_cdev_event_response response;
71 struct iso_interrupt {
73 struct fw_cdev_event_iso_interrupt interrupt;
78 struct fw_device *device;
81 struct list_head resource_list;
82 struct list_head event_list;
83 wait_queue_head_t wait;
84 u64 bus_reset_closure;
86 struct fw_iso_context *iso_context;
88 struct fw_iso_buffer buffer;
89 unsigned long vm_start;
91 struct list_head link;
94 static inline void __user *
95 u64_to_uptr(__u64 value)
97 return (void __user *)(unsigned long)value;
101 uptr_to_u64(void __user *ptr)
103 return (__u64)(unsigned long)ptr;
106 static int fw_device_op_open(struct inode *inode, struct file *file)
108 struct fw_device *device;
109 struct client *client;
112 device = fw_device_get_by_devt(inode->i_rdev);
116 if (fw_device_is_shutdown(device)) {
117 fw_device_put(device);
121 client = kzalloc(sizeof(*client), GFP_KERNEL);
122 if (client == NULL) {
123 fw_device_put(device);
127 client->device = device;
128 INIT_LIST_HEAD(&client->event_list);
129 INIT_LIST_HEAD(&client->resource_list);
130 spin_lock_init(&client->lock);
131 init_waitqueue_head(&client->wait);
133 file->private_data = client;
135 spin_lock_irqsave(&device->card->lock, flags);
136 list_add_tail(&client->link, &device->client_list);
137 spin_unlock_irqrestore(&device->card->lock, flags);
142 static void queue_event(struct client *client, struct event *event,
143 void *data0, size_t size0, void *data1, size_t size1)
147 event->v[0].data = data0;
148 event->v[0].size = size0;
149 event->v[1].data = data1;
150 event->v[1].size = size1;
152 spin_lock_irqsave(&client->lock, flags);
153 list_add_tail(&event->link, &client->event_list);
154 spin_unlock_irqrestore(&client->lock, flags);
156 wake_up_interruptible(&client->wait);
160 dequeue_event(struct client *client, char __user *buffer, size_t count)
167 retval = wait_event_interruptible(client->wait,
168 !list_empty(&client->event_list) ||
169 fw_device_is_shutdown(client->device));
173 if (list_empty(&client->event_list) &&
174 fw_device_is_shutdown(client->device))
177 spin_lock_irqsave(&client->lock, flags);
178 event = container_of(client->event_list.next, struct event, link);
179 list_del(&event->link);
180 spin_unlock_irqrestore(&client->lock, flags);
183 for (i = 0; i < ARRAY_SIZE(event->v) && total < count; i++) {
184 size = min(event->v[i].size, count - total);
185 if (copy_to_user(buffer + total, event->v[i].data, size)) {
200 fw_device_op_read(struct file *file,
201 char __user *buffer, size_t count, loff_t *offset)
203 struct client *client = file->private_data;
205 return dequeue_event(client, buffer, count);
208 /* caller must hold card->lock so that node pointers can be dereferenced here */
210 fill_bus_reset_event(struct fw_cdev_event_bus_reset *event,
211 struct client *client)
213 struct fw_card *card = client->device->card;
215 event->closure = client->bus_reset_closure;
216 event->type = FW_CDEV_EVENT_BUS_RESET;
217 event->generation = client->device->generation;
218 event->node_id = client->device->node_id;
219 event->local_node_id = card->local_node->node_id;
220 event->bm_node_id = 0; /* FIXME: We don't track the BM. */
221 event->irm_node_id = card->irm_node->node_id;
222 event->root_node_id = card->root_node->node_id;
226 for_each_client(struct fw_device *device,
227 void (*callback)(struct client *client))
229 struct fw_card *card = device->card;
233 spin_lock_irqsave(&card->lock, flags);
235 list_for_each_entry(c, &device->client_list, link)
238 spin_unlock_irqrestore(&card->lock, flags);
242 queue_bus_reset_event(struct client *client)
244 struct bus_reset *bus_reset;
246 bus_reset = kzalloc(sizeof(*bus_reset), GFP_ATOMIC);
247 if (bus_reset == NULL) {
248 fw_notify("Out of memory when allocating bus reset event\n");
252 fill_bus_reset_event(&bus_reset->reset, client);
254 queue_event(client, &bus_reset->event,
255 &bus_reset->reset, sizeof(bus_reset->reset), NULL, 0);
258 void fw_device_cdev_update(struct fw_device *device)
260 for_each_client(device, queue_bus_reset_event);
263 static void wake_up_client(struct client *client)
265 wake_up_interruptible(&client->wait);
268 void fw_device_cdev_remove(struct fw_device *device)
270 for_each_client(device, wake_up_client);
273 static int ioctl_get_info(struct client *client, void *buffer)
275 struct fw_cdev_get_info *get_info = buffer;
276 struct fw_cdev_event_bus_reset bus_reset;
277 struct fw_card *card = client->device->card;
278 unsigned long ret = 0;
280 client->version = get_info->version;
281 get_info->version = FW_CDEV_VERSION;
283 down_read(&fw_device_rwsem);
285 if (get_info->rom != 0) {
286 void __user *uptr = u64_to_uptr(get_info->rom);
287 size_t want = get_info->rom_length;
288 size_t have = client->device->config_rom_length * 4;
290 ret = copy_to_user(uptr, client->device->config_rom,
293 get_info->rom_length = client->device->config_rom_length * 4;
295 up_read(&fw_device_rwsem);
300 client->bus_reset_closure = get_info->bus_reset_closure;
301 if (get_info->bus_reset != 0) {
302 void __user *uptr = u64_to_uptr(get_info->bus_reset);
305 spin_lock_irqsave(&card->lock, flags);
306 fill_bus_reset_event(&bus_reset, client);
307 spin_unlock_irqrestore(&card->lock, flags);
309 if (copy_to_user(uptr, &bus_reset, sizeof(bus_reset)))
313 get_info->card = card->index;
319 add_client_resource(struct client *client, struct client_resource *resource)
323 spin_lock_irqsave(&client->lock, flags);
324 list_add_tail(&resource->link, &client->resource_list);
325 resource->handle = client->resource_handle++;
326 spin_unlock_irqrestore(&client->lock, flags);
330 release_client_resource(struct client *client, u32 handle,
331 struct client_resource **resource)
333 struct client_resource *r;
336 spin_lock_irqsave(&client->lock, flags);
337 list_for_each_entry(r, &client->resource_list, link) {
338 if (r->handle == handle) {
343 spin_unlock_irqrestore(&client->lock, flags);
345 if (&r->link == &client->resource_list)
351 r->release(client, r);
357 release_transaction(struct client *client, struct client_resource *resource)
359 struct response *response =
360 container_of(resource, struct response, resource);
362 fw_cancel_transaction(client->device->card, &response->transaction);
366 complete_transaction(struct fw_card *card, int rcode,
367 void *payload, size_t length, void *data)
369 struct response *response = data;
370 struct client *client = response->client;
372 struct fw_cdev_event_response *r = &response->response;
374 if (length < r->length)
376 if (rcode == RCODE_COMPLETE)
377 memcpy(r->data, payload, r->length);
379 spin_lock_irqsave(&client->lock, flags);
380 list_del(&response->resource.link);
381 spin_unlock_irqrestore(&client->lock, flags);
383 r->type = FW_CDEV_EVENT_RESPONSE;
387 * In the case that sizeof(*r) doesn't align with the position of the
388 * data, and the read is short, preserve an extra copy of the data
389 * to stay compatible with a pre-2.6.27 bug. Since the bug is harmless
390 * for short reads and some apps depended on it, this is both safe
391 * and prudent for compatibility.
393 if (r->length <= sizeof(*r) - offsetof(typeof(*r), data))
394 queue_event(client, &response->event, r, sizeof(*r),
397 queue_event(client, &response->event, r, sizeof(*r) + r->length,
401 static int ioctl_send_request(struct client *client, void *buffer)
403 struct fw_device *device = client->device;
404 struct fw_cdev_send_request *request = buffer;
405 struct response *response;
407 /* What is the biggest size we'll accept, really? */
408 if (request->length > 4096)
411 response = kmalloc(sizeof(*response) + request->length, GFP_KERNEL);
412 if (response == NULL)
415 response->client = client;
416 response->response.length = request->length;
417 response->response.closure = request->closure;
420 copy_from_user(response->response.data,
421 u64_to_uptr(request->data), request->length)) {
426 response->resource.release = release_transaction;
427 add_client_resource(client, &response->resource);
429 fw_send_request(device->card, &response->transaction,
430 request->tcode & 0x1f,
431 device->node->node_id,
435 response->response.data, request->length,
436 complete_transaction, response);
439 return sizeof(request) + request->length;
441 return sizeof(request);
444 struct address_handler {
445 struct fw_address_handler handler;
447 struct client *client;
448 struct client_resource resource;
452 struct fw_request *request;
455 struct client_resource resource;
458 struct request_event {
460 struct fw_cdev_event_request request;
464 release_request(struct client *client, struct client_resource *resource)
466 struct request *request =
467 container_of(resource, struct request, resource);
469 fw_send_response(client->device->card, request->request,
470 RCODE_CONFLICT_ERROR);
475 handle_request(struct fw_card *card, struct fw_request *r,
476 int tcode, int destination, int source,
477 int generation, int speed,
478 unsigned long long offset,
479 void *payload, size_t length, void *callback_data)
481 struct address_handler *handler = callback_data;
482 struct request *request;
483 struct request_event *e;
484 struct client *client = handler->client;
486 request = kmalloc(sizeof(*request), GFP_ATOMIC);
487 e = kmalloc(sizeof(*e), GFP_ATOMIC);
488 if (request == NULL || e == NULL) {
491 fw_send_response(card, r, RCODE_CONFLICT_ERROR);
495 request->request = r;
496 request->data = payload;
497 request->length = length;
499 request->resource.release = release_request;
500 add_client_resource(client, &request->resource);
502 e->request.type = FW_CDEV_EVENT_REQUEST;
503 e->request.tcode = tcode;
504 e->request.offset = offset;
505 e->request.length = length;
506 e->request.handle = request->resource.handle;
507 e->request.closure = handler->closure;
509 queue_event(client, &e->event,
510 &e->request, sizeof(e->request), payload, length);
514 release_address_handler(struct client *client,
515 struct client_resource *resource)
517 struct address_handler *handler =
518 container_of(resource, struct address_handler, resource);
520 fw_core_remove_address_handler(&handler->handler);
524 static int ioctl_allocate(struct client *client, void *buffer)
526 struct fw_cdev_allocate *request = buffer;
527 struct address_handler *handler;
528 struct fw_address_region region;
530 handler = kmalloc(sizeof(*handler), GFP_KERNEL);
534 region.start = request->offset;
535 region.end = request->offset + request->length;
536 handler->handler.length = request->length;
537 handler->handler.address_callback = handle_request;
538 handler->handler.callback_data = handler;
539 handler->closure = request->closure;
540 handler->client = client;
542 if (fw_core_add_address_handler(&handler->handler, ®ion) < 0) {
547 handler->resource.release = release_address_handler;
548 add_client_resource(client, &handler->resource);
549 request->handle = handler->resource.handle;
554 static int ioctl_deallocate(struct client *client, void *buffer)
556 struct fw_cdev_deallocate *request = buffer;
558 return release_client_resource(client, request->handle, NULL);
561 static int ioctl_send_response(struct client *client, void *buffer)
563 struct fw_cdev_send_response *request = buffer;
564 struct client_resource *resource;
567 if (release_client_resource(client, request->handle, &resource) < 0)
569 r = container_of(resource, struct request, resource);
570 if (request->length < r->length)
571 r->length = request->length;
572 if (copy_from_user(r->data, u64_to_uptr(request->data), r->length))
575 fw_send_response(client->device->card, r->request, request->rcode);
581 static int ioctl_initiate_bus_reset(struct client *client, void *buffer)
583 struct fw_cdev_initiate_bus_reset *request = buffer;
586 short_reset = (request->type == FW_CDEV_SHORT_RESET);
588 return fw_core_initiate_bus_reset(client->device->card, short_reset);
592 struct fw_descriptor d;
593 struct client_resource resource;
597 static void release_descriptor(struct client *client,
598 struct client_resource *resource)
600 struct descriptor *descriptor =
601 container_of(resource, struct descriptor, resource);
603 fw_core_remove_descriptor(&descriptor->d);
607 static int ioctl_add_descriptor(struct client *client, void *buffer)
609 struct fw_cdev_add_descriptor *request = buffer;
610 struct descriptor *descriptor;
613 if (request->length > 256)
617 kmalloc(sizeof(*descriptor) + request->length * 4, GFP_KERNEL);
618 if (descriptor == NULL)
621 if (copy_from_user(descriptor->data,
622 u64_to_uptr(request->data), request->length * 4)) {
627 descriptor->d.length = request->length;
628 descriptor->d.immediate = request->immediate;
629 descriptor->d.key = request->key;
630 descriptor->d.data = descriptor->data;
632 retval = fw_core_add_descriptor(&descriptor->d);
638 descriptor->resource.release = release_descriptor;
639 add_client_resource(client, &descriptor->resource);
640 request->handle = descriptor->resource.handle;
645 static int ioctl_remove_descriptor(struct client *client, void *buffer)
647 struct fw_cdev_remove_descriptor *request = buffer;
649 return release_client_resource(client, request->handle, NULL);
653 iso_callback(struct fw_iso_context *context, u32 cycle,
654 size_t header_length, void *header, void *data)
656 struct client *client = data;
657 struct iso_interrupt *irq;
659 irq = kzalloc(sizeof(*irq) + header_length, GFP_ATOMIC);
663 irq->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT;
664 irq->interrupt.closure = client->iso_closure;
665 irq->interrupt.cycle = cycle;
666 irq->interrupt.header_length = header_length;
667 memcpy(irq->interrupt.header, header, header_length);
668 queue_event(client, &irq->event, &irq->interrupt,
669 sizeof(irq->interrupt) + header_length, NULL, 0);
672 static int ioctl_create_iso_context(struct client *client, void *buffer)
674 struct fw_cdev_create_iso_context *request = buffer;
675 struct fw_iso_context *context;
677 /* We only support one context at this time. */
678 if (client->iso_context != NULL)
681 if (request->channel > 63)
684 switch (request->type) {
685 case FW_ISO_CONTEXT_RECEIVE:
686 if (request->header_size < 4 || (request->header_size & 3))
691 case FW_ISO_CONTEXT_TRANSMIT:
692 if (request->speed > SCODE_3200)
701 context = fw_iso_context_create(client->device->card,
705 request->header_size,
706 iso_callback, client);
708 return PTR_ERR(context);
710 client->iso_closure = request->closure;
711 client->iso_context = context;
713 /* We only support one context at this time. */
719 /* Macros for decoding the iso packet control header. */
720 #define GET_PAYLOAD_LENGTH(v) ((v) & 0xffff)
721 #define GET_INTERRUPT(v) (((v) >> 16) & 0x01)
722 #define GET_SKIP(v) (((v) >> 17) & 0x01)
723 #define GET_TAG(v) (((v) >> 18) & 0x03)
724 #define GET_SY(v) (((v) >> 20) & 0x0f)
725 #define GET_HEADER_LENGTH(v) (((v) >> 24) & 0xff)
727 static int ioctl_queue_iso(struct client *client, void *buffer)
729 struct fw_cdev_queue_iso *request = buffer;
730 struct fw_cdev_iso_packet __user *p, *end, *next;
731 struct fw_iso_context *ctx = client->iso_context;
732 unsigned long payload, buffer_end, header_length;
736 struct fw_iso_packet packet;
740 if (ctx == NULL || request->handle != 0)
744 * If the user passes a non-NULL data pointer, has mmap()'ed
745 * the iso buffer, and the pointer points inside the buffer,
746 * we setup the payload pointers accordingly. Otherwise we
747 * set them both to 0, which will still let packets with
748 * payload_length == 0 through. In other words, if no packets
749 * use the indirect payload, the iso buffer need not be mapped
750 * and the request->data pointer is ignored.
753 payload = (unsigned long)request->data - client->vm_start;
754 buffer_end = client->buffer.page_count << PAGE_SHIFT;
755 if (request->data == 0 || client->buffer.pages == NULL ||
756 payload >= buffer_end) {
761 p = (struct fw_cdev_iso_packet __user *)u64_to_uptr(request->packets);
763 if (!access_ok(VERIFY_READ, p, request->size))
766 end = (void __user *)p + request->size;
769 if (get_user(control, &p->control))
771 u.packet.payload_length = GET_PAYLOAD_LENGTH(control);
772 u.packet.interrupt = GET_INTERRUPT(control);
773 u.packet.skip = GET_SKIP(control);
774 u.packet.tag = GET_TAG(control);
775 u.packet.sy = GET_SY(control);
776 u.packet.header_length = GET_HEADER_LENGTH(control);
778 if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) {
779 header_length = u.packet.header_length;
782 * We require that header_length is a multiple of
783 * the fixed header size, ctx->header_size.
785 if (ctx->header_size == 0) {
786 if (u.packet.header_length > 0)
788 } else if (u.packet.header_length % ctx->header_size != 0) {
794 next = (struct fw_cdev_iso_packet __user *)
795 &p->header[header_length / 4];
799 (u.packet.header, p->header, header_length))
801 if (u.packet.skip && ctx->type == FW_ISO_CONTEXT_TRANSMIT &&
802 u.packet.header_length + u.packet.payload_length > 0)
804 if (payload + u.packet.payload_length > buffer_end)
807 if (fw_iso_context_queue(ctx, &u.packet,
808 &client->buffer, payload))
812 payload += u.packet.payload_length;
816 request->size -= uptr_to_u64(p) - request->packets;
817 request->packets = uptr_to_u64(p);
818 request->data = client->vm_start + payload;
823 static int ioctl_start_iso(struct client *client, void *buffer)
825 struct fw_cdev_start_iso *request = buffer;
827 if (client->iso_context == NULL || request->handle != 0)
830 if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) {
831 if (request->tags == 0 || request->tags > 15)
834 if (request->sync > 15)
838 return fw_iso_context_start(client->iso_context, request->cycle,
839 request->sync, request->tags);
842 static int ioctl_stop_iso(struct client *client, void *buffer)
844 struct fw_cdev_stop_iso *request = buffer;
846 if (client->iso_context == NULL || request->handle != 0)
849 return fw_iso_context_stop(client->iso_context);
852 static int ioctl_get_cycle_timer(struct client *client, void *buffer)
854 struct fw_cdev_get_cycle_timer *request = buffer;
855 struct fw_card *card = client->device->card;
856 unsigned long long bus_time;
861 local_irq_save(flags);
863 bus_time = card->driver->get_bus_time(card);
864 do_gettimeofday(&tv);
866 local_irq_restore(flags);
869 request->local_time = tv.tv_sec * 1000000ULL + tv.tv_usec;
870 request->cycle_timer = bus_time & 0xffffffff;
874 static int (* const ioctl_handlers[])(struct client *client, void *buffer) = {
880 ioctl_initiate_bus_reset,
881 ioctl_add_descriptor,
882 ioctl_remove_descriptor,
883 ioctl_create_iso_context,
887 ioctl_get_cycle_timer,
891 dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
896 if (_IOC_TYPE(cmd) != '#' ||
897 _IOC_NR(cmd) >= ARRAY_SIZE(ioctl_handlers))
900 if (_IOC_DIR(cmd) & _IOC_WRITE) {
901 if (_IOC_SIZE(cmd) > sizeof(buffer) ||
902 copy_from_user(buffer, arg, _IOC_SIZE(cmd)))
906 retval = ioctl_handlers[_IOC_NR(cmd)](client, buffer);
910 if (_IOC_DIR(cmd) & _IOC_READ) {
911 if (_IOC_SIZE(cmd) > sizeof(buffer) ||
912 copy_to_user(arg, buffer, _IOC_SIZE(cmd)))
920 fw_device_op_ioctl(struct file *file,
921 unsigned int cmd, unsigned long arg)
923 struct client *client = file->private_data;
925 if (fw_device_is_shutdown(client->device))
928 return dispatch_ioctl(client, cmd, (void __user *) arg);
933 fw_device_op_compat_ioctl(struct file *file,
934 unsigned int cmd, unsigned long arg)
936 struct client *client = file->private_data;
938 if (fw_device_is_shutdown(client->device))
941 return dispatch_ioctl(client, cmd, compat_ptr(arg));
945 static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma)
947 struct client *client = file->private_data;
948 enum dma_data_direction direction;
950 int page_count, retval;
952 if (fw_device_is_shutdown(client->device))
955 /* FIXME: We could support multiple buffers, but we don't. */
956 if (client->buffer.pages != NULL)
959 if (!(vma->vm_flags & VM_SHARED))
962 if (vma->vm_start & ~PAGE_MASK)
965 client->vm_start = vma->vm_start;
966 size = vma->vm_end - vma->vm_start;
967 page_count = size >> PAGE_SHIFT;
968 if (size & ~PAGE_MASK)
971 if (vma->vm_flags & VM_WRITE)
972 direction = DMA_TO_DEVICE;
974 direction = DMA_FROM_DEVICE;
976 retval = fw_iso_buffer_init(&client->buffer, client->device->card,
977 page_count, direction);
981 retval = fw_iso_buffer_map(&client->buffer, vma);
983 fw_iso_buffer_destroy(&client->buffer, client->device->card);
988 static int fw_device_op_release(struct inode *inode, struct file *file)
990 struct client *client = file->private_data;
991 struct event *e, *next_e;
992 struct client_resource *r, *next_r;
995 if (client->buffer.pages)
996 fw_iso_buffer_destroy(&client->buffer, client->device->card);
998 if (client->iso_context)
999 fw_iso_context_destroy(client->iso_context);
1001 list_for_each_entry_safe(r, next_r, &client->resource_list, link)
1002 r->release(client, r);
1005 * FIXME: We should wait for the async tasklets to stop
1006 * running before freeing the memory.
1009 list_for_each_entry_safe(e, next_e, &client->event_list, link)
1012 spin_lock_irqsave(&client->device->card->lock, flags);
1013 list_del(&client->link);
1014 spin_unlock_irqrestore(&client->device->card->lock, flags);
1016 fw_device_put(client->device);
1022 static unsigned int fw_device_op_poll(struct file *file, poll_table * pt)
1024 struct client *client = file->private_data;
1025 unsigned int mask = 0;
1027 poll_wait(file, &client->wait, pt);
1029 if (fw_device_is_shutdown(client->device))
1030 mask |= POLLHUP | POLLERR;
1031 if (!list_empty(&client->event_list))
1032 mask |= POLLIN | POLLRDNORM;
1037 const struct file_operations fw_device_ops = {
1038 .owner = THIS_MODULE,
1039 .open = fw_device_op_open,
1040 .read = fw_device_op_read,
1041 .unlocked_ioctl = fw_device_op_ioctl,
1042 .poll = fw_device_op_poll,
1043 .release = fw_device_op_release,
1044 .mmap = fw_device_op_mmap,
1046 #ifdef CONFIG_COMPAT
1047 .compat_ioctl = fw_device_op_compat_ioctl,