Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136009
b: refs/heads/master
c: acfe833
h: refs/heads/master
i:
  136007: df3422d
v: v3
  • Loading branch information
Jay Fenlason, Stefan Richter committed Mar 24, 2009
1 parent b2b2a0b commit 81e97a4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 33580a3ef5ba3bc0ee1b520df82a24bb37ce28f0
refs/heads/master: acfe8333572cad5dc70fce18ac966be0446548d7
74 changes: 47 additions & 27 deletions trunk/drivers/firewire/fw-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,10 @@ static void complete_transaction(struct fw_card *card, int rcode,
client_put(client);
}

static int ioctl_send_request(struct client *client, void *buffer)
static int init_request(struct client *client,
struct fw_cdev_send_request *request,
int destination_id, int speed)
{
struct fw_device *device = client->device;
struct fw_cdev_send_request *request = buffer;
struct outbound_transaction_event *e;
int ret;

Expand All @@ -544,24 +544,6 @@ static int ioctl_send_request(struct client *client, void *buffer)
goto failed;
}

switch (request->tcode) {
case TCODE_WRITE_QUADLET_REQUEST:
case TCODE_WRITE_BLOCK_REQUEST:
case TCODE_READ_QUADLET_REQUEST:
case TCODE_READ_BLOCK_REQUEST:
case TCODE_LOCK_MASK_SWAP:
case TCODE_LOCK_COMPARE_SWAP:
case TCODE_LOCK_FETCH_ADD:
case TCODE_LOCK_LITTLE_ADD:
case TCODE_LOCK_BOUNDED_ADD:
case TCODE_LOCK_WRAP_ADD:
case TCODE_LOCK_VENDOR_DEPENDENT:
break;
default:
ret = -EINVAL;
goto failed;
}

e->r.resource.release = release_transaction;
ret = add_client_resource(client, &e->r.resource, GFP_KERNEL);
if (ret < 0)
Expand All @@ -570,12 +552,9 @@ static int ioctl_send_request(struct client *client, void *buffer)
/* Get a reference for the transaction callback */
client_get(client);

fw_send_request(device->card, &e->r.transaction,
request->tcode & 0x1f,
device->node->node_id,
request->generation,
device->max_speed,
request->offset,
fw_send_request(client->device->card, &e->r.transaction,
request->tcode & 0x1f, destination_id,
request->generation, speed, request->offset,
e->response.data, request->length,
complete_transaction, e);

Expand All @@ -589,6 +568,31 @@ static int ioctl_send_request(struct client *client, void *buffer)
return ret;
}

static int ioctl_send_request(struct client *client, void *buffer)
{
struct fw_cdev_send_request *request = buffer;

switch (request->tcode) {
case TCODE_WRITE_QUADLET_REQUEST:
case TCODE_WRITE_BLOCK_REQUEST:
case TCODE_READ_QUADLET_REQUEST:
case TCODE_READ_BLOCK_REQUEST:
case TCODE_LOCK_MASK_SWAP:
case TCODE_LOCK_COMPARE_SWAP:
case TCODE_LOCK_FETCH_ADD:
case TCODE_LOCK_LITTLE_ADD:
case TCODE_LOCK_BOUNDED_ADD:
case TCODE_LOCK_WRAP_ADD:
case TCODE_LOCK_VENDOR_DEPENDENT:
break;
default:
return -EINVAL;
}

return init_request(client, request, client->device->node->node_id,
client->device->max_speed);
}

static void release_request(struct client *client,
struct client_resource *resource)
{
Expand Down Expand Up @@ -1229,6 +1233,21 @@ static int ioctl_get_speed(struct client *client, void *buffer)
return 0;
}

static int ioctl_send_broadcast_request(struct client *client, void *buffer)
{
struct fw_cdev_send_request *request = buffer;

switch (request->tcode) {
case TCODE_WRITE_QUADLET_REQUEST:
case TCODE_WRITE_BLOCK_REQUEST:
break;
default:
return -EINVAL;
}

return init_request(client, request, LOCAL_BUS | 0x3f, SCODE_100);
}

static int (* const ioctl_handlers[])(struct client *client, void *buffer) = {
ioctl_get_info,
ioctl_send_request,
Expand All @@ -1248,6 +1267,7 @@ static int (* const ioctl_handlers[])(struct client *client, void *buffer) = {
ioctl_allocate_iso_resource_once,
ioctl_deallocate_iso_resource_once,
ioctl_get_speed,
ioctl_send_broadcast_request,
};

static int dispatch_ioctl(struct client *client,
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/firewire-cdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ union fw_cdev_event {
#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
#define FW_CDEV_IOC_GET_SPEED _IOR('#', 0x11, struct fw_cdev_get_speed)
#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)

/* FW_CDEV_VERSION History
*
Expand Down

0 comments on commit 81e97a4

Please sign in to comment.