diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-03-10 16:01:54 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-03-24 15:56:50 -0400 |
commit | 664d8010b170ae8b3ce9268b4f4da934d27b0491 (patch) | |
tree | 2e7f8e304267d0a925402dd0abf6f6a319c9a163 /drivers/firewire | |
parent | 207fbefb18de9bc6f871e4008da29879c90cb67e (diff) |
firewire: cdev: simplify FW_CDEV_IOC_SEND_REQUEST return value
This changes the ioctl() return value of FW_CDEV_IOC_SEND_REQUEST and of
the as yet unreleased FW_CDEV_IOC_SEND_BROADCAST_REQUEST. They used to
return
sizeof(struct fw_cdev_send_request *) + data_length
which is obviously a failed attempt to emulate the return value of
raw1394's respective interface which uses write() instead of ioctl().
However, the first summand, as size of a kernel pointer, is entirely
meaningless to clients and the second summand is already known to
clients. And the result does not resemble raw1394's write() return
code anyway.
So simplify it to a constant non-negative value, i.e. 0. The only
dangers here would be that future client implementations check for error
by ret != 0 instead of ret < 0 when running on top of an old kernel; or
that current clients interpret ret = 0 or more as failure. But both are
hypothetical cases which don't justify to return irritating values.
While we touch this code, also remove "& 0x1f" from tcode in the call of
fw_send_request. The tcode cannot be bigger than 0x1f at this point.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/fw-cdev.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index c54e019c9586..95a207545eb3 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -549,15 +549,11 @@ static int init_request(struct client *client, | |||
549 | client_get(client); | 549 | client_get(client); |
550 | 550 | ||
551 | fw_send_request(client->device->card, &e->r.transaction, | 551 | fw_send_request(client->device->card, &e->r.transaction, |
552 | request->tcode & 0x1f, destination_id, | 552 | request->tcode, destination_id, request->generation, |
553 | request->generation, speed, request->offset, | 553 | speed, request->offset, e->response.data, |
554 | e->response.data, request->length, | 554 | request->length, complete_transaction, e); |
555 | complete_transaction, e); | 555 | return 0; |
556 | 556 | ||
557 | if (request->data) | ||
558 | return sizeof(request) + request->length; | ||
559 | else | ||
560 | return sizeof(request); | ||
561 | failed: | 557 | failed: |
562 | kfree(e); | 558 | kfree(e); |
563 | 559 | ||