Allocating the pads array dynamically doesn't save much memory, if at
all, due to the extra data needed to track the devm allocation, compared
to embedding an array of two pads in the xscd_device structure. Replace
the dynamic allocation.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
{
struct xscd_chan *chan;
struct v4l2_subdev *subdev;
{
struct xscd_chan *chan;
struct v4l2_subdev *subdev;
chan = devm_kzalloc(xscd->dev, sizeof(*chan), GFP_KERNEL);
if (!chan)
chan = devm_kzalloc(xscd->dev, sizeof(*chan), GFP_KERNEL);
if (!chan)
/* Initialize media pads */
num_pads = xscd->memory_based ? 1 : 2;
/* Initialize media pads */
num_pads = xscd->memory_based ? 1 : 2;
- chan->pad = devm_kzalloc(chan->xscd->dev,
- sizeof(struct media_pad) * num_pads,
- GFP_KERNEL);
- if (!chan->pad)
- return -ENOMEM;
- chan->pad[XVIP_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+ chan->pads[XVIP_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
- chan->pad[XVIP_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
+ chan->pads[XVIP_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
- ret = media_entity_pads_init(&subdev->entity, num_pads, chan->pad);
+ ret = media_entity_pads_init(&subdev->entity, num_pads, chan->pads);
* @iomem: device I/O register space remapped to kernel virtual memory
* @xscd: SCD device
* @subdev: V4L2 subdevice
* @iomem: device I/O register space remapped to kernel virtual memory
* @xscd: SCD device
* @subdev: V4L2 subdevice
* @format: active V4L2 media bus format for the pad
* @event: scene change event
* @dmachan: dma channel part of the scenechange stream
* @format: active V4L2 media bus format for the pad
* @event: scene change event
* @dmachan: dma channel part of the scenechange stream
void __iomem *iomem;
struct xscd_device *xscd;
struct v4l2_subdev subdev;
void __iomem *iomem;
struct xscd_device *xscd;
struct v4l2_subdev subdev;
+ struct media_pad pads[2];
struct v4l2_mbus_framefmt format;
struct v4l2_event event;
struct xscd_dma_chan dmachan;
struct v4l2_mbus_framefmt format;
struct v4l2_event event;
struct xscd_dma_chan dmachan;