Skip to content

Commit

Permalink
V4L/DVB: firedtv: do not DMA-map stack addresses
Browse files Browse the repository at this point in the history
This is a portability fix and reduces stack usage.

The DMA mapping API cannot map on-stack addresses, as explained in
Documentation/DMA-mapping.txt.  Convert the two cases of on-stack packet
payload buffers in firedtv (payload of write requests in avc_write and
of lock requests in cmp_lock) to slab-allocated memory.

We use the 512 bytes sized FCP frame buffer in struct firedtv for this
purpose.  Previously it held only incoming FCP responses, now it holds
pending FCP requests and is then overwriten by an FCP response from the
tuner subunit.  Ditto for CMP lock requests and responses.  Accesses to
the payload buffer are serialized by fdtv->avc_mutex.

As a welcome side effect, stack usage of the AV/C transaction functions
is reduced by 512 bytes.

Alas, avc_register_remote_control() is a special case:  It previously
did not wait for a response.  To fit better in with the other FCP
transactions, let it wait for an interim response.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Stefan Richter authored and Mauro Carvalho Chehab committed Feb 26, 2010
1 parent 9420048 commit 3fb80ef
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 191 deletions.
9 changes: 5 additions & 4 deletions drivers/media/dvb/firewire/firedtv-1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ static inline struct node_entry *node_of(struct firedtv *fdtv)
return container_of(fdtv->device, struct unit_directory, device)->ne;
}

static int node_lock(struct firedtv *fdtv, u64 addr, __be32 data[])
static int node_lock(struct firedtv *fdtv, u64 addr, void *data)
{
quadlet_t *d = data;
int ret;

ret = hpsb_node_lock(node_of(fdtv), addr, EXTCODE_COMPARE_SWAP,
(__force quadlet_t *)&data[1], (__force quadlet_t)data[0]);
data[0] = data[1];
ret = hpsb_node_lock(node_of(fdtv), addr,
EXTCODE_COMPARE_SWAP, &d[1], d[0]);
d[0] = d[1];

return ret;
}
Expand Down
Loading

0 comments on commit 3fb80ef

Please sign in to comment.