[media] rcar_vin: copy flags from pdata
authorBen Dooks <ben.dooks@codethink.co.uk>
Mon, 14 Apr 2014 10:36:40 +0000 (07:36 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 17 Jun 2014 15:04:52 +0000 (12:04 -0300)
The platform data is a single word, so simply copy
it into the device's private data structure than
keeping a copy of the pointer.

This will make changing to device-tree binding
easier as it is one allocation instead of two.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/soc_camera/rcar_vin.c

index e594230e84d3c903fc9ecc465926109a01bc3f51..7c4299d9a10009c81502199696bde915d1b3c0a4 100644 (file)
@@ -126,13 +126,13 @@ struct rcar_vin_priv {
        int                             sequence;
        /* State of the VIN module in capturing mode */
        enum rcar_vin_state             state;
-       struct rcar_vin_platform_data   *pdata;
        struct soc_camera_host          ici;
        struct list_head                capture;
 #define MAX_BUFFER_NUM                 3
        struct vb2_buffer               *queue_buf[MAX_BUFFER_NUM];
        struct vb2_alloc_ctx            *alloc_ctx;
        enum v4l2_field                 field;
+       unsigned int                    pdata_flags;
        unsigned int                    vb_count;
        unsigned int                    nr_hw_slots;
        bool                            request_to_stop;
@@ -275,12 +275,12 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
                break;
        case V4L2_MBUS_FMT_YUYV8_2X8:
                /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
-               vnmc |= priv->pdata->flags & RCAR_VIN_BT656 ?
+               vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ?
                        VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
                break;
        case V4L2_MBUS_FMT_YUYV10_2X10:
                /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
-               vnmc |= priv->pdata->flags & RCAR_VIN_BT656 ?
+               vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ?
                        VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601;
                break;
        default:
@@ -797,7 +797,7 @@ static int rcar_vin_set_bus_param(struct soc_camera_device *icd)
        /* Make choises, based on platform preferences */
        if ((common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) &&
            (common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) {
-               if (priv->pdata->flags & RCAR_VIN_HSYNC_ACTIVE_LOW)
+               if (priv->pdata_flags & RCAR_VIN_HSYNC_ACTIVE_LOW)
                        common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_HIGH;
                else
                        common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_LOW;
@@ -805,7 +805,7 @@ static int rcar_vin_set_bus_param(struct soc_camera_device *icd)
 
        if ((common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) &&
            (common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) {
-               if (priv->pdata->flags & RCAR_VIN_VSYNC_ACTIVE_LOW)
+               if (priv->pdata_flags & RCAR_VIN_VSYNC_ACTIVE_LOW)
                        common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH;
                else
                        common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW;
@@ -1445,7 +1445,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
        priv->ici.drv_name = dev_name(&pdev->dev);
        priv->ici.ops = &rcar_vin_host_ops;
 
-       priv->pdata = pdata;
+       priv->pdata_flags = pdata->flags;
        priv->chip = pdev->id_entry->driver_data;
        spin_lock_init(&priv->lock);
        INIT_LIST_HEAD(&priv->capture);