Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 1 | /* -*- c-basic-offset: 8 -*- |
| 2 | * |
| 3 | * fw-device-cdev.c - Char device for device raw access |
| 4 | * |
| 5 | * Copyright (C) 2005-2006 Kristian Hoegsberg <krh@bitplanet.net> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software Foundation, |
| 19 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <linux/module.h> |
| 23 | #include <linux/kernel.h> |
| 24 | #include <linux/wait.h> |
| 25 | #include <linux/errno.h> |
| 26 | #include <linux/device.h> |
| 27 | #include <linux/vmalloc.h> |
| 28 | #include <linux/poll.h> |
| 29 | #include <linux/delay.h> |
| 30 | #include <linux/mm.h> |
Kristian Høgsberg | a3aca3d | 2007-03-07 12:12:44 -0500 | [diff] [blame] | 31 | #include <linux/idr.h> |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 32 | #include <linux/compat.h> |
| 33 | #include <asm/uaccess.h> |
| 34 | #include "fw-transaction.h" |
| 35 | #include "fw-topology.h" |
| 36 | #include "fw-device.h" |
| 37 | #include "fw-device-cdev.h" |
| 38 | |
| 39 | /* |
| 40 | * todo |
| 41 | * |
| 42 | * - bus resets sends a new packet with new generation and node id |
| 43 | * |
| 44 | */ |
| 45 | |
| 46 | /* dequeue_event() just kfree()'s the event, so the event has to be |
| 47 | * the first field in the struct. */ |
| 48 | |
| 49 | struct event { |
| 50 | struct { void *data; size_t size; } v[2]; |
| 51 | struct list_head link; |
| 52 | }; |
| 53 | |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 54 | struct bus_reset { |
| 55 | struct event event; |
| 56 | struct fw_cdev_event_bus_reset reset; |
| 57 | }; |
| 58 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 59 | struct response { |
| 60 | struct event event; |
| 61 | struct fw_transaction transaction; |
| 62 | struct client *client; |
| 63 | struct fw_cdev_event_response response; |
| 64 | }; |
| 65 | |
| 66 | struct iso_interrupt { |
| 67 | struct event event; |
| 68 | struct fw_cdev_event_iso_interrupt interrupt; |
| 69 | }; |
| 70 | |
| 71 | struct client { |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 72 | u32 version; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 73 | struct fw_device *device; |
| 74 | spinlock_t lock; |
| 75 | struct list_head handler_list; |
| 76 | struct list_head request_list; |
| 77 | u32 request_serial; |
| 78 | struct list_head event_list; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 79 | wait_queue_head_t wait; |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 80 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 81 | struct fw_iso_context *iso_context; |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 82 | struct fw_iso_buffer buffer; |
| 83 | unsigned long vm_start; |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 84 | |
| 85 | struct list_head link; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | static inline void __user * |
| 89 | u64_to_uptr(__u64 value) |
| 90 | { |
| 91 | return (void __user *)(unsigned long)value; |
| 92 | } |
| 93 | |
| 94 | static inline __u64 |
| 95 | uptr_to_u64(void __user *ptr) |
| 96 | { |
| 97 | return (__u64)(unsigned long)ptr; |
| 98 | } |
| 99 | |
| 100 | static int fw_device_op_open(struct inode *inode, struct file *file) |
| 101 | { |
| 102 | struct fw_device *device; |
| 103 | struct client *client; |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 104 | unsigned long flags; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 105 | |
Kristian Høgsberg | a3aca3d | 2007-03-07 12:12:44 -0500 | [diff] [blame] | 106 | device = fw_device_from_devt(inode->i_rdev); |
| 107 | if (device == NULL) |
| 108 | return -ENODEV; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 109 | |
| 110 | client = kzalloc(sizeof *client, GFP_KERNEL); |
| 111 | if (client == NULL) |
| 112 | return -ENOMEM; |
| 113 | |
| 114 | client->device = fw_device_get(device); |
| 115 | INIT_LIST_HEAD(&client->event_list); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 116 | INIT_LIST_HEAD(&client->handler_list); |
| 117 | INIT_LIST_HEAD(&client->request_list); |
| 118 | spin_lock_init(&client->lock); |
| 119 | init_waitqueue_head(&client->wait); |
| 120 | |
| 121 | file->private_data = client; |
| 122 | |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 123 | spin_lock_irqsave(&device->card->lock, flags); |
| 124 | list_add_tail(&client->link, &device->client_list); |
| 125 | spin_unlock_irqrestore(&device->card->lock, flags); |
| 126 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | static void queue_event(struct client *client, struct event *event, |
| 131 | void *data0, size_t size0, void *data1, size_t size1) |
| 132 | { |
| 133 | unsigned long flags; |
| 134 | |
| 135 | event->v[0].data = data0; |
| 136 | event->v[0].size = size0; |
| 137 | event->v[1].data = data1; |
| 138 | event->v[1].size = size1; |
| 139 | |
| 140 | spin_lock_irqsave(&client->lock, flags); |
| 141 | |
| 142 | list_add_tail(&event->link, &client->event_list); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 143 | wake_up_interruptible(&client->wait); |
| 144 | |
| 145 | spin_unlock_irqrestore(&client->lock, flags); |
| 146 | } |
| 147 | |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 148 | static int |
| 149 | dequeue_event(struct client *client, char __user *buffer, size_t count) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 150 | { |
| 151 | unsigned long flags; |
| 152 | struct event *event; |
| 153 | size_t size, total; |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 154 | int i, retval; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 155 | |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 156 | retval = wait_event_interruptible(client->wait, |
| 157 | !list_empty(&client->event_list) || |
| 158 | fw_device_is_shutdown(client->device)); |
| 159 | if (retval < 0) |
| 160 | return retval; |
| 161 | |
| 162 | if (list_empty(&client->event_list) && |
| 163 | fw_device_is_shutdown(client->device)) |
| 164 | return -ENODEV; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 165 | |
| 166 | spin_lock_irqsave(&client->lock, flags); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 167 | event = container_of(client->event_list.next, struct event, link); |
| 168 | list_del(&event->link); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 169 | spin_unlock_irqrestore(&client->lock, flags); |
| 170 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 171 | total = 0; |
| 172 | for (i = 0; i < ARRAY_SIZE(event->v) && total < count; i++) { |
| 173 | size = min(event->v[i].size, count - total); |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 174 | if (copy_to_user(buffer + total, event->v[i].data, size)) { |
| 175 | retval = -EFAULT; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 176 | goto out; |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 177 | } |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 178 | total += size; |
| 179 | } |
| 180 | retval = total; |
| 181 | |
| 182 | out: |
| 183 | kfree(event); |
| 184 | |
| 185 | return retval; |
| 186 | } |
| 187 | |
| 188 | static ssize_t |
| 189 | fw_device_op_read(struct file *file, |
| 190 | char __user *buffer, size_t count, loff_t *offset) |
| 191 | { |
| 192 | struct client *client = file->private_data; |
| 193 | |
| 194 | return dequeue_event(client, buffer, count); |
| 195 | } |
| 196 | |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 197 | static void |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 198 | fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, |
| 199 | struct fw_device *device) |
| 200 | { |
| 201 | struct fw_card *card = device->card; |
| 202 | |
| 203 | event->type = FW_CDEV_EVENT_BUS_RESET; |
| 204 | event->node_id = device->node_id; |
| 205 | event->local_node_id = card->local_node->node_id; |
| 206 | event->bm_node_id = 0; /* FIXME: We don't track the BM. */ |
| 207 | event->irm_node_id = card->irm_node->node_id; |
| 208 | event->root_node_id = card->root_node->node_id; |
| 209 | event->generation = card->generation; |
| 210 | } |
| 211 | |
| 212 | static void |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 213 | for_each_client(struct fw_device *device, |
| 214 | void (*callback)(struct client *client)) |
| 215 | { |
| 216 | struct fw_card *card = device->card; |
| 217 | struct client *c; |
| 218 | unsigned long flags; |
| 219 | |
| 220 | spin_lock_irqsave(&card->lock, flags); |
| 221 | |
| 222 | list_for_each_entry(c, &device->client_list, link) |
| 223 | callback(c); |
| 224 | |
| 225 | spin_unlock_irqrestore(&card->lock, flags); |
| 226 | } |
| 227 | |
| 228 | static void |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 229 | queue_bus_reset_event(struct client *client) |
| 230 | { |
| 231 | struct bus_reset *bus_reset; |
| 232 | struct fw_device *device = client->device; |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 233 | |
| 234 | bus_reset = kzalloc(sizeof *bus_reset, GFP_ATOMIC); |
| 235 | if (bus_reset == NULL) { |
| 236 | fw_notify("Out of memory when allocating bus reset event\n"); |
| 237 | return; |
| 238 | } |
| 239 | |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 240 | fill_bus_reset_event(&bus_reset->reset, device); |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 241 | |
| 242 | queue_event(client, &bus_reset->event, |
| 243 | &bus_reset->reset, sizeof bus_reset->reset, NULL, 0); |
| 244 | } |
| 245 | |
| 246 | void fw_device_cdev_update(struct fw_device *device) |
| 247 | { |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 248 | for_each_client(device, queue_bus_reset_event); |
| 249 | } |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 250 | |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 251 | static void wake_up_client(struct client *client) |
| 252 | { |
| 253 | wake_up_interruptible(&client->wait); |
| 254 | } |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 255 | |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 256 | void fw_device_cdev_remove(struct fw_device *device) |
| 257 | { |
| 258 | for_each_client(device, wake_up_client); |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 259 | } |
| 260 | |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 261 | static int ioctl_get_info(struct client *client, void __user *arg) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 262 | { |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 263 | struct fw_cdev_get_info get_info; |
| 264 | struct fw_cdev_event_bus_reset bus_reset; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 265 | |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 266 | if (copy_from_user(&get_info, arg, sizeof get_info)) |
| 267 | return -EFAULT; |
| 268 | |
| 269 | client->version = get_info.version; |
| 270 | get_info.version = FW_CDEV_VERSION; |
| 271 | |
| 272 | if (get_info.rom != 0) { |
| 273 | void __user *uptr = u64_to_uptr(get_info.rom); |
| 274 | size_t length = min(get_info.rom_length, |
| 275 | client->device->config_rom_length * 4); |
| 276 | |
| 277 | if (copy_to_user(uptr, client->device->config_rom, length)) |
| 278 | return -EFAULT; |
| 279 | } |
| 280 | get_info.rom_length = client->device->config_rom_length * 4; |
| 281 | |
| 282 | if (get_info.bus_reset != 0) { |
| 283 | void __user *uptr = u64_to_uptr(get_info.bus_reset); |
| 284 | |
| 285 | fill_bus_reset_event(&bus_reset, client->device); |
| 286 | if (copy_to_user(uptr, &bus_reset, sizeof bus_reset)) |
| 287 | return -EFAULT; |
| 288 | } |
| 289 | |
| 290 | if (copy_to_user(arg, &get_info, sizeof get_info)) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 291 | return -EFAULT; |
| 292 | |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | static void |
| 297 | complete_transaction(struct fw_card *card, int rcode, |
| 298 | void *payload, size_t length, void *data) |
| 299 | { |
| 300 | struct response *response = data; |
| 301 | struct client *client = response->client; |
| 302 | |
| 303 | if (length < response->response.length) |
| 304 | response->response.length = length; |
| 305 | if (rcode == RCODE_COMPLETE) |
| 306 | memcpy(response->response.data, payload, |
| 307 | response->response.length); |
| 308 | |
| 309 | response->response.type = FW_CDEV_EVENT_RESPONSE; |
| 310 | response->response.rcode = rcode; |
| 311 | queue_event(client, &response->event, |
| 312 | &response->response, sizeof response->response, |
| 313 | response->response.data, response->response.length); |
| 314 | } |
| 315 | |
| 316 | static ssize_t ioctl_send_request(struct client *client, void __user *arg) |
| 317 | { |
| 318 | struct fw_device *device = client->device; |
| 319 | struct fw_cdev_send_request request; |
| 320 | struct response *response; |
| 321 | |
| 322 | if (copy_from_user(&request, arg, sizeof request)) |
| 323 | return -EFAULT; |
| 324 | |
| 325 | /* What is the biggest size we'll accept, really? */ |
| 326 | if (request.length > 4096) |
| 327 | return -EINVAL; |
| 328 | |
| 329 | response = kmalloc(sizeof *response + request.length, GFP_KERNEL); |
| 330 | if (response == NULL) |
| 331 | return -ENOMEM; |
| 332 | |
| 333 | response->client = client; |
| 334 | response->response.length = request.length; |
| 335 | response->response.closure = request.closure; |
| 336 | |
| 337 | if (request.data && |
| 338 | copy_from_user(response->response.data, |
| 339 | u64_to_uptr(request.data), request.length)) { |
| 340 | kfree(response); |
| 341 | return -EFAULT; |
| 342 | } |
| 343 | |
| 344 | fw_send_request(device->card, &response->transaction, |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 345 | request.tcode & 0x1f, |
Stefan Richter | 907293d | 2007-01-23 21:11:43 +0100 | [diff] [blame] | 346 | device->node->node_id, |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 347 | device->card->generation, |
| 348 | device->node->max_speed, |
| 349 | request.offset, |
| 350 | response->response.data, request.length, |
| 351 | complete_transaction, response); |
| 352 | |
| 353 | if (request.data) |
| 354 | return sizeof request + request.length; |
| 355 | else |
| 356 | return sizeof request; |
| 357 | } |
| 358 | |
| 359 | struct address_handler { |
| 360 | struct fw_address_handler handler; |
| 361 | __u64 closure; |
| 362 | struct client *client; |
| 363 | struct list_head link; |
| 364 | }; |
| 365 | |
| 366 | struct request { |
| 367 | struct fw_request *request; |
| 368 | void *data; |
| 369 | size_t length; |
| 370 | u32 serial; |
| 371 | struct list_head link; |
| 372 | }; |
| 373 | |
| 374 | struct request_event { |
| 375 | struct event event; |
| 376 | struct fw_cdev_event_request request; |
| 377 | }; |
| 378 | |
| 379 | static void |
| 380 | handle_request(struct fw_card *card, struct fw_request *r, |
| 381 | int tcode, int destination, int source, |
| 382 | int generation, int speed, |
| 383 | unsigned long long offset, |
| 384 | void *payload, size_t length, void *callback_data) |
| 385 | { |
| 386 | struct address_handler *handler = callback_data; |
| 387 | struct request *request; |
| 388 | struct request_event *e; |
| 389 | unsigned long flags; |
| 390 | struct client *client = handler->client; |
| 391 | |
| 392 | request = kmalloc(sizeof *request, GFP_ATOMIC); |
| 393 | e = kmalloc(sizeof *e, GFP_ATOMIC); |
| 394 | if (request == NULL || e == NULL) { |
| 395 | kfree(request); |
| 396 | kfree(e); |
| 397 | fw_send_response(card, r, RCODE_CONFLICT_ERROR); |
| 398 | return; |
| 399 | } |
| 400 | |
| 401 | request->request = r; |
| 402 | request->data = payload; |
| 403 | request->length = length; |
| 404 | |
| 405 | spin_lock_irqsave(&client->lock, flags); |
| 406 | request->serial = client->request_serial++; |
| 407 | list_add_tail(&request->link, &client->request_list); |
| 408 | spin_unlock_irqrestore(&client->lock, flags); |
| 409 | |
| 410 | e->request.type = FW_CDEV_EVENT_REQUEST; |
| 411 | e->request.tcode = tcode; |
| 412 | e->request.offset = offset; |
| 413 | e->request.length = length; |
| 414 | e->request.serial = request->serial; |
| 415 | e->request.closure = handler->closure; |
| 416 | |
| 417 | queue_event(client, &e->event, |
| 418 | &e->request, sizeof e->request, payload, length); |
| 419 | } |
| 420 | |
| 421 | static int ioctl_allocate(struct client *client, void __user *arg) |
| 422 | { |
| 423 | struct fw_cdev_allocate request; |
| 424 | struct address_handler *handler; |
| 425 | unsigned long flags; |
| 426 | struct fw_address_region region; |
| 427 | |
| 428 | if (copy_from_user(&request, arg, sizeof request)) |
| 429 | return -EFAULT; |
| 430 | |
| 431 | handler = kmalloc(sizeof *handler, GFP_KERNEL); |
| 432 | if (handler == NULL) |
| 433 | return -ENOMEM; |
| 434 | |
| 435 | region.start = request.offset; |
| 436 | region.end = request.offset + request.length; |
| 437 | handler->handler.length = request.length; |
| 438 | handler->handler.address_callback = handle_request; |
| 439 | handler->handler.callback_data = handler; |
| 440 | handler->closure = request.closure; |
| 441 | handler->client = client; |
| 442 | |
| 443 | if (fw_core_add_address_handler(&handler->handler, ®ion) < 0) { |
| 444 | kfree(handler); |
| 445 | return -EBUSY; |
| 446 | } |
| 447 | |
| 448 | spin_lock_irqsave(&client->lock, flags); |
| 449 | list_add_tail(&handler->link, &client->handler_list); |
| 450 | spin_unlock_irqrestore(&client->lock, flags); |
| 451 | |
| 452 | return 0; |
| 453 | } |
| 454 | |
| 455 | static int ioctl_send_response(struct client *client, void __user *arg) |
| 456 | { |
| 457 | struct fw_cdev_send_response request; |
| 458 | struct request *r; |
| 459 | unsigned long flags; |
| 460 | |
| 461 | if (copy_from_user(&request, arg, sizeof request)) |
| 462 | return -EFAULT; |
| 463 | |
| 464 | spin_lock_irqsave(&client->lock, flags); |
| 465 | list_for_each_entry(r, &client->request_list, link) { |
| 466 | if (r->serial == request.serial) { |
| 467 | list_del(&r->link); |
| 468 | break; |
| 469 | } |
| 470 | } |
| 471 | spin_unlock_irqrestore(&client->lock, flags); |
| 472 | |
| 473 | if (&r->link == &client->request_list) |
| 474 | return -EINVAL; |
| 475 | |
| 476 | if (request.length < r->length) |
| 477 | r->length = request.length; |
| 478 | if (copy_from_user(r->data, u64_to_uptr(request.data), r->length)) |
| 479 | return -EFAULT; |
| 480 | |
| 481 | fw_send_response(client->device->card, r->request, request.rcode); |
| 482 | |
| 483 | kfree(r); |
| 484 | |
| 485 | return 0; |
| 486 | } |
| 487 | |
Kristian Høgsberg | 5371842 | 2007-03-07 12:12:42 -0500 | [diff] [blame] | 488 | static int ioctl_initiate_bus_reset(struct client *client, void __user *arg) |
| 489 | { |
| 490 | struct fw_cdev_initiate_bus_reset request; |
| 491 | int short_reset; |
| 492 | |
| 493 | if (copy_from_user(&request, arg, sizeof request)) |
| 494 | return -EFAULT; |
| 495 | |
| 496 | short_reset = (request.type == FW_CDEV_SHORT_RESET); |
| 497 | |
| 498 | return fw_core_initiate_bus_reset(client->device->card, short_reset); |
| 499 | } |
| 500 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 501 | static void |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 502 | iso_callback(struct fw_iso_context *context, u32 cycle, |
| 503 | size_t header_length, void *header, void *data) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 504 | { |
| 505 | struct client *client = data; |
| 506 | struct iso_interrupt *interrupt; |
| 507 | |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 508 | interrupt = kzalloc(sizeof *interrupt + header_length, GFP_ATOMIC); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 509 | if (interrupt == NULL) |
| 510 | return; |
| 511 | |
| 512 | interrupt->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT; |
| 513 | interrupt->interrupt.closure = 0; |
| 514 | interrupt->interrupt.cycle = cycle; |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 515 | interrupt->interrupt.header_length = header_length; |
| 516 | memcpy(interrupt->interrupt.header, header, header_length); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 517 | queue_event(client, &interrupt->event, |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 518 | &interrupt->interrupt, |
| 519 | sizeof interrupt->interrupt + header_length, NULL, 0); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 520 | } |
| 521 | |
| 522 | static int ioctl_create_iso_context(struct client *client, void __user *arg) |
| 523 | { |
| 524 | struct fw_cdev_create_iso_context request; |
| 525 | |
| 526 | if (copy_from_user(&request, arg, sizeof request)) |
| 527 | return -EFAULT; |
| 528 | |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 529 | if (request.type > FW_ISO_CONTEXT_RECEIVE) |
| 530 | return -EINVAL; |
| 531 | |
Kristian Høgsberg | 21efb3c | 2007-02-16 17:34:50 -0500 | [diff] [blame] | 532 | if (request.channel > 63) |
| 533 | return -EINVAL; |
| 534 | |
Kristian Høgsberg | 98b6cbe | 2007-02-16 17:34:51 -0500 | [diff] [blame] | 535 | if (request.sync > 15) |
| 536 | return -EINVAL; |
| 537 | |
| 538 | if (request.tags == 0 || request.tags > 15) |
| 539 | return -EINVAL; |
| 540 | |
Kristian Høgsberg | 21efb3c | 2007-02-16 17:34:50 -0500 | [diff] [blame] | 541 | if (request.speed > SCODE_3200) |
| 542 | return -EINVAL; |
| 543 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 544 | client->iso_context = fw_iso_context_create(client->device->card, |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 545 | request.type, |
Kristian Høgsberg | 21efb3c | 2007-02-16 17:34:50 -0500 | [diff] [blame] | 546 | request.channel, |
| 547 | request.speed, |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 548 | request.header_size, |
Kristian Høgsberg | 98b6cbe | 2007-02-16 17:34:51 -0500 | [diff] [blame] | 549 | request.sync, |
| 550 | request.tags, |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 551 | iso_callback, client); |
| 552 | if (IS_ERR(client->iso_context)) |
| 553 | return PTR_ERR(client->iso_context); |
| 554 | |
| 555 | return 0; |
| 556 | } |
| 557 | |
| 558 | static int ioctl_queue_iso(struct client *client, void __user *arg) |
| 559 | { |
| 560 | struct fw_cdev_queue_iso request; |
| 561 | struct fw_cdev_iso_packet __user *p, *end, *next; |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 562 | struct fw_iso_context *ctx = client->iso_context; |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 563 | unsigned long payload, payload_end, header_length; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 564 | int count; |
| 565 | struct { |
| 566 | struct fw_iso_packet packet; |
| 567 | u8 header[256]; |
| 568 | } u; |
| 569 | |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 570 | if (ctx == NULL) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 571 | return -EINVAL; |
| 572 | if (copy_from_user(&request, arg, sizeof request)) |
| 573 | return -EFAULT; |
| 574 | |
| 575 | /* If the user passes a non-NULL data pointer, has mmap()'ed |
| 576 | * the iso buffer, and the pointer points inside the buffer, |
| 577 | * we setup the payload pointers accordingly. Otherwise we |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 578 | * set them both to 0, which will still let packets with |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 579 | * payload_length == 0 through. In other words, if no packets |
| 580 | * use the indirect payload, the iso buffer need not be mapped |
| 581 | * and the request.data pointer is ignored.*/ |
| 582 | |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 583 | payload = (unsigned long)request.data - client->vm_start; |
| 584 | payload_end = payload + (client->buffer.page_count << PAGE_SHIFT); |
| 585 | if (request.data == 0 || client->buffer.pages == NULL || |
| 586 | payload >= payload_end) { |
| 587 | payload = 0; |
| 588 | payload_end = 0; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | if (!access_ok(VERIFY_READ, request.packets, request.size)) |
| 592 | return -EFAULT; |
| 593 | |
| 594 | p = (struct fw_cdev_iso_packet __user *)u64_to_uptr(request.packets); |
| 595 | end = (void __user *)p + request.size; |
| 596 | count = 0; |
| 597 | while (p < end) { |
| 598 | if (__copy_from_user(&u.packet, p, sizeof *p)) |
| 599 | return -EFAULT; |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 600 | |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 601 | if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) { |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 602 | header_length = u.packet.header_length; |
| 603 | } else { |
| 604 | /* We require that header_length is a multiple of |
| 605 | * the fixed header size, ctx->header_size */ |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 606 | if (ctx->header_size == 0) { |
| 607 | if (u.packet.header_length > 0) |
| 608 | return -EINVAL; |
| 609 | } else if (u.packet.header_length % ctx->header_size != 0) { |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 610 | return -EINVAL; |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 611 | } |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 612 | header_length = 0; |
| 613 | } |
| 614 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 615 | next = (struct fw_cdev_iso_packet __user *) |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 616 | &p->header[header_length / 4]; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 617 | if (next > end) |
| 618 | return -EINVAL; |
| 619 | if (__copy_from_user |
Kristian Høgsberg | 295e3fe | 2007-02-16 17:34:40 -0500 | [diff] [blame] | 620 | (u.packet.header, p->header, header_length)) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 621 | return -EFAULT; |
Kristian Høgsberg | 98b6cbe | 2007-02-16 17:34:51 -0500 | [diff] [blame] | 622 | if (u.packet.skip && ctx->type == FW_ISO_CONTEXT_TRANSMIT && |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 623 | u.packet.header_length + u.packet.payload_length > 0) |
| 624 | return -EINVAL; |
| 625 | if (payload + u.packet.payload_length > payload_end) |
| 626 | return -EINVAL; |
| 627 | |
Kristian Høgsberg | 9b32d5f | 2007-02-16 17:34:44 -0500 | [diff] [blame] | 628 | if (fw_iso_context_queue(ctx, &u.packet, |
| 629 | &client->buffer, payload)) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 630 | break; |
| 631 | |
| 632 | p = next; |
| 633 | payload += u.packet.payload_length; |
| 634 | count++; |
| 635 | } |
| 636 | |
| 637 | request.size -= uptr_to_u64(p) - request.packets; |
| 638 | request.packets = uptr_to_u64(p); |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 639 | request.data = client->vm_start + payload; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 640 | |
| 641 | if (copy_to_user(arg, &request, sizeof request)) |
| 642 | return -EFAULT; |
| 643 | |
| 644 | return count; |
| 645 | } |
| 646 | |
Kristian Høgsberg | 69cdb72 | 2007-02-16 17:34:41 -0500 | [diff] [blame] | 647 | static int ioctl_start_iso(struct client *client, void __user *arg) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 648 | { |
Kristian Høgsberg | 69cdb72 | 2007-02-16 17:34:41 -0500 | [diff] [blame] | 649 | struct fw_cdev_start_iso request; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 650 | |
| 651 | if (copy_from_user(&request, arg, sizeof request)) |
| 652 | return -EFAULT; |
| 653 | |
Kristian Høgsberg | 21efb3c | 2007-02-16 17:34:50 -0500 | [diff] [blame] | 654 | return fw_iso_context_start(client->iso_context, request.cycle); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 655 | } |
| 656 | |
Kristian Høgsberg | b829566 | 2007-02-16 17:34:42 -0500 | [diff] [blame] | 657 | static int ioctl_stop_iso(struct client *client, void __user *arg) |
| 658 | { |
| 659 | return fw_iso_context_stop(client->iso_context); |
| 660 | } |
| 661 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 662 | static int |
| 663 | dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg) |
| 664 | { |
| 665 | switch (cmd) { |
Kristian Høgsberg | 344bbc4 | 2007-03-07 12:12:43 -0500 | [diff] [blame] | 666 | case FW_CDEV_IOC_GET_INFO: |
| 667 | return ioctl_get_info(client, arg); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 668 | case FW_CDEV_IOC_SEND_REQUEST: |
| 669 | return ioctl_send_request(client, arg); |
| 670 | case FW_CDEV_IOC_ALLOCATE: |
| 671 | return ioctl_allocate(client, arg); |
| 672 | case FW_CDEV_IOC_SEND_RESPONSE: |
| 673 | return ioctl_send_response(client, arg); |
Kristian Høgsberg | 5371842 | 2007-03-07 12:12:42 -0500 | [diff] [blame] | 674 | case FW_CDEV_IOC_INITIATE_BUS_RESET: |
| 675 | return ioctl_initiate_bus_reset(client, arg); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 676 | case FW_CDEV_IOC_CREATE_ISO_CONTEXT: |
| 677 | return ioctl_create_iso_context(client, arg); |
| 678 | case FW_CDEV_IOC_QUEUE_ISO: |
| 679 | return ioctl_queue_iso(client, arg); |
Kristian Høgsberg | 69cdb72 | 2007-02-16 17:34:41 -0500 | [diff] [blame] | 680 | case FW_CDEV_IOC_START_ISO: |
| 681 | return ioctl_start_iso(client, arg); |
Kristian Høgsberg | b829566 | 2007-02-16 17:34:42 -0500 | [diff] [blame] | 682 | case FW_CDEV_IOC_STOP_ISO: |
| 683 | return ioctl_stop_iso(client, arg); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 684 | default: |
| 685 | return -EINVAL; |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | static long |
| 690 | fw_device_op_ioctl(struct file *file, |
| 691 | unsigned int cmd, unsigned long arg) |
| 692 | { |
| 693 | struct client *client = file->private_data; |
| 694 | |
| 695 | return dispatch_ioctl(client, cmd, (void __user *) arg); |
| 696 | } |
| 697 | |
| 698 | #ifdef CONFIG_COMPAT |
| 699 | static long |
| 700 | fw_device_op_compat_ioctl(struct file *file, |
| 701 | unsigned int cmd, unsigned long arg) |
| 702 | { |
| 703 | struct client *client = file->private_data; |
| 704 | |
| 705 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); |
| 706 | } |
| 707 | #endif |
| 708 | |
| 709 | static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) |
| 710 | { |
| 711 | struct client *client = file->private_data; |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 712 | enum dma_data_direction direction; |
| 713 | unsigned long size; |
| 714 | int page_count, retval; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 715 | |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 716 | /* FIXME: We could support multiple buffers, but we don't. */ |
| 717 | if (client->buffer.pages != NULL) |
| 718 | return -EBUSY; |
| 719 | |
| 720 | if (!(vma->vm_flags & VM_SHARED)) |
| 721 | return -EINVAL; |
| 722 | |
| 723 | if (vma->vm_start & ~PAGE_MASK) |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 724 | return -EINVAL; |
| 725 | |
| 726 | client->vm_start = vma->vm_start; |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 727 | size = vma->vm_end - vma->vm_start; |
| 728 | page_count = size >> PAGE_SHIFT; |
| 729 | if (size & ~PAGE_MASK) |
| 730 | return -EINVAL; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 731 | |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 732 | if (vma->vm_flags & VM_WRITE) |
| 733 | direction = DMA_TO_DEVICE; |
| 734 | else |
| 735 | direction = DMA_FROM_DEVICE; |
| 736 | |
| 737 | retval = fw_iso_buffer_init(&client->buffer, client->device->card, |
| 738 | page_count, direction); |
| 739 | if (retval < 0) |
| 740 | return retval; |
| 741 | |
| 742 | retval = fw_iso_buffer_map(&client->buffer, vma); |
| 743 | if (retval < 0) |
| 744 | fw_iso_buffer_destroy(&client->buffer, client->device->card); |
| 745 | |
| 746 | return retval; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 747 | } |
| 748 | |
| 749 | static int fw_device_op_release(struct inode *inode, struct file *file) |
| 750 | { |
| 751 | struct client *client = file->private_data; |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 752 | struct address_handler *h, *next_h; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 753 | struct request *r, *next_r; |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 754 | struct event *e, *next_e; |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 755 | unsigned long flags; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 756 | |
Kristian Høgsberg | 9aad812 | 2007-02-16 17:34:38 -0500 | [diff] [blame] | 757 | if (client->buffer.pages) |
| 758 | fw_iso_buffer_destroy(&client->buffer, client->device->card); |
| 759 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 760 | if (client->iso_context) |
| 761 | fw_iso_context_destroy(client->iso_context); |
| 762 | |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 763 | list_for_each_entry_safe(h, next_h, &client->handler_list, link) { |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 764 | fw_core_remove_address_handler(&h->handler); |
| 765 | kfree(h); |
| 766 | } |
| 767 | |
| 768 | list_for_each_entry_safe(r, next_r, &client->request_list, link) { |
| 769 | fw_send_response(client->device->card, r->request, |
| 770 | RCODE_CONFLICT_ERROR); |
| 771 | kfree(r); |
| 772 | } |
| 773 | |
| 774 | /* TODO: wait for all transactions to finish so |
| 775 | * complete_transaction doesn't try to queue up responses |
| 776 | * after we free client. */ |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 777 | list_for_each_entry_safe(e, next_e, &client->event_list, link) |
| 778 | kfree(e); |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 779 | |
Kristian Høgsberg | 97bd9ef | 2007-03-07 12:12:41 -0500 | [diff] [blame] | 780 | spin_lock_irqsave(&client->device->card->lock, flags); |
| 781 | list_del(&client->link); |
| 782 | spin_unlock_irqrestore(&client->device->card->lock, flags); |
| 783 | |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 784 | fw_device_put(client->device); |
| 785 | kfree(client); |
| 786 | |
| 787 | return 0; |
| 788 | } |
| 789 | |
| 790 | static unsigned int fw_device_op_poll(struct file *file, poll_table * pt) |
| 791 | { |
| 792 | struct client *client = file->private_data; |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 793 | unsigned int mask = 0; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 794 | |
| 795 | poll_wait(file, &client->wait, pt); |
| 796 | |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 797 | if (fw_device_is_shutdown(client->device)) |
| 798 | mask |= POLLHUP | POLLERR; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 799 | if (!list_empty(&client->event_list)) |
Kristian Høgsberg | 2603bf2 | 2007-03-07 12:12:48 -0500 | [diff] [blame^] | 800 | mask |= POLLIN | POLLRDNORM; |
| 801 | |
| 802 | return mask; |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 803 | } |
| 804 | |
Stefan Richter | 21ebcd1 | 2007-01-14 15:29:07 +0100 | [diff] [blame] | 805 | const struct file_operations fw_device_ops = { |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 806 | .owner = THIS_MODULE, |
| 807 | .open = fw_device_op_open, |
| 808 | .read = fw_device_op_read, |
| 809 | .unlocked_ioctl = fw_device_op_ioctl, |
| 810 | .poll = fw_device_op_poll, |
| 811 | .release = fw_device_op_release, |
| 812 | .mmap = fw_device_op_mmap, |
| 813 | |
| 814 | #ifdef CONFIG_COMPAT |
Stefan Richter | 5af4e5e | 2007-01-21 20:45:32 +0100 | [diff] [blame] | 815 | .compat_ioctl = fw_device_op_compat_ioctl, |
Kristian Høgsberg | 19a15b9 | 2006-12-19 19:58:31 -0500 | [diff] [blame] | 816 | #endif |
| 817 | }; |