fthd: Code style fixes

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
This commit is contained in:
Patrik Jakobsson
2016-06-21 01:15:44 +02:00
parent 27d231e90c
commit 03b0c5cf7a
4 changed files with 13 additions and 11 deletions

View File

@@ -43,8 +43,8 @@ static int iommu_allocator_init(struct fthd_private *dev_priv)
return 0;
}
struct iommu_obj *iommu_allocate_sgtable(struct fthd_private *dev_priv,
struct sg_table *sgtable)
struct iommu_obj *fthd_iommu_alloc_sgtable(struct fthd_private *dev_priv,
struct sg_table *sgtable)
{
struct iommu_obj *obj;
struct resource *root = dev_priv->iommu;
@@ -66,14 +66,15 @@ struct iommu_obj *iommu_allocate_sgtable(struct fthd_private *dev_priv,
return NULL;
obj->base.name = "S2 IOMMU";
ret = allocate_resource(root, &obj->base, total_len, root->start, root->end,
1, NULL, NULL);
ret = allocate_resource(root, &obj->base, total_len, root->start,
root->end, 1, NULL, NULL);
if (ret) {
dev_err(&dev_priv->pdev->dev,
"Failed to allocate resource (size: %d, start: %Ld, end: %Ld)\n",
total_len, root->start, root->end);
kfree(obj);
obj = NULL;
return NULL;
}
@@ -84,6 +85,7 @@ struct iommu_obj *iommu_allocate_sgtable(struct fthd_private *dev_priv,
for (i = 0; i < sgtable->nents; i++) {
sg = sgtable->sgl + i;
WARN_ON(sg->offset);
dma_addr = sg_dma_address(sg);
WARN_ON(dma_addr & 0xfff);

View File

@@ -78,6 +78,6 @@ extern int fthd_buffer_init(struct fthd_private *dev_priv);
extern void fthd_buffer_exit(struct fthd_private *dev_priv);
extern void fthd_buffer_return_handler(struct fthd_private *dev_priv, u32 offset, int size);
extern void fthd_buffer_queued_handler(struct fthd_private *dev_priv, u32 offset);
extern struct iommu_obj *iommu_allocate_sgtable(struct fthd_private *dev_priv, struct sg_table *);
extern struct iommu_obj *fthd_iommu_alloc_sgtable(struct fthd_private *dev_priv, struct sg_table *);
extern void fthd_iommu_free(struct fthd_private *dev_priv, struct iommu_obj *obj);
#endif

View File

@@ -120,16 +120,17 @@ static void sharedmalloc_handler(struct fthd_private *dev_priv,
if (!obj)
return;
pr_debug("Firmware allocated %d bytes at %08lx (tag %c%c%c%c)\n", request_size, obj->offset,
pr_debug("Firmware allocated %d bytes at %08lx (tag %c%c%c%c)\n",
request_size, obj->offset,
response_size >> 24,response_size >> 16,
response_size >> 8, response_size);
FTHD_S2_MEMCPY_TOIO(obj->offset, &obj, sizeof(obj));
ret = fthd_channel_ringbuf_send(dev_priv, chan, obj->offset + 64, 0, 0, NULL);
ret = fthd_channel_ringbuf_send(dev_priv, chan,
obj->offset + 64, 0, 0, NULL);
if (ret)
pr_err("%s: fthd_channel_ringbuf_send: %d\n", __FUNCTION__, ret);
}
}

View File

@@ -151,8 +151,6 @@ static void fthd_buffer_queue(struct vb2_buffer *vb)
ctx->state = BUF_ALLOC;
}
}
return;
}
static int fthd_buffer_prepare(struct vb2_buffer *vb)
@@ -188,7 +186,8 @@ static int fthd_buffer_prepare(struct vb2_buffer *vb)
for (i = 0; i < dev_priv->fmt.planes; i++) {
sgtable = vb2_dma_sg_plane_desc(vb, i);
ctx->plane[i] = iommu_allocate_sgtable(dev_priv, sgtable);
ctx->plane[i] =
fthd_iommu_alloc_sgtable(dev_priv, sgtable);
if(!ctx->plane[i])
return -ENOMEM;