media: drivers/staging/media: don't set description for ENUM_FMT
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 11 Jun 2019 14:02:43 +0000 (10:02 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 22 Jul 2019 18:41:32 +0000 (14:41 -0400)
The V4L2 core sets the format description and flags for the driver in order
to ensure consistent naming.

So drop the strscpy of the description in drivers. Also remove any
description strings in driver-internal structures since those are
no longer needed.

Note that bcm2835-camera.c: the formats array still stores the flags
field for compressed formats since that information is used elsewhere
in the driver. But enum_fmt doesn't use it anymore, since the core
will set the COMPRESSED flag correctly.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/omap4iss/iss_video.c
drivers/staging/media/omap4iss/iss_video.h
drivers/staging/media/soc_camera/soc_camera.c
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
drivers/staging/vc04_services/bcm2835-camera/mmal-common.h
include/media/drv-intf/soc_mediabus.h

index c307707..54144dc 100644 (file)
 static struct iss_format_info formats[] = {
        { MEDIA_BUS_FMT_Y8_1X8, MEDIA_BUS_FMT_Y8_1X8,
          MEDIA_BUS_FMT_Y8_1X8, MEDIA_BUS_FMT_Y8_1X8,
-         V4L2_PIX_FMT_GREY, 8, "Greyscale 8 bpp", },
+         V4L2_PIX_FMT_GREY, 8, },
        { MEDIA_BUS_FMT_Y10_1X10, MEDIA_BUS_FMT_Y10_1X10,
          MEDIA_BUS_FMT_Y10_1X10, MEDIA_BUS_FMT_Y8_1X8,
-         V4L2_PIX_FMT_Y10, 10, "Greyscale 10 bpp", },
+         V4L2_PIX_FMT_Y10, 10, },
        { MEDIA_BUS_FMT_Y12_1X12, MEDIA_BUS_FMT_Y10_1X10,
          MEDIA_BUS_FMT_Y12_1X12, MEDIA_BUS_FMT_Y8_1X8,
-         V4L2_PIX_FMT_Y12, 12, "Greyscale 12 bpp", },
+         V4L2_PIX_FMT_Y12, 12, },
        { MEDIA_BUS_FMT_SBGGR8_1X8, MEDIA_BUS_FMT_SBGGR8_1X8,
          MEDIA_BUS_FMT_SBGGR8_1X8, MEDIA_BUS_FMT_SBGGR8_1X8,
-         V4L2_PIX_FMT_SBGGR8, 8, "BGGR Bayer 8 bpp", },
+         V4L2_PIX_FMT_SBGGR8, 8, },
        { MEDIA_BUS_FMT_SGBRG8_1X8, MEDIA_BUS_FMT_SGBRG8_1X8,
          MEDIA_BUS_FMT_SGBRG8_1X8, MEDIA_BUS_FMT_SGBRG8_1X8,
-         V4L2_PIX_FMT_SGBRG8, 8, "GBRG Bayer 8 bpp", },
+         V4L2_PIX_FMT_SGBRG8, 8, },
        { MEDIA_BUS_FMT_SGRBG8_1X8, MEDIA_BUS_FMT_SGRBG8_1X8,
          MEDIA_BUS_FMT_SGRBG8_1X8, MEDIA_BUS_FMT_SGRBG8_1X8,
-         V4L2_PIX_FMT_SGRBG8, 8, "GRBG Bayer 8 bpp", },
+         V4L2_PIX_FMT_SGRBG8, 8, },
        { MEDIA_BUS_FMT_SRGGB8_1X8, MEDIA_BUS_FMT_SRGGB8_1X8,
          MEDIA_BUS_FMT_SRGGB8_1X8, MEDIA_BUS_FMT_SRGGB8_1X8,
-         V4L2_PIX_FMT_SRGGB8, 8, "RGGB Bayer 8 bpp", },
+         V4L2_PIX_FMT_SRGGB8, 8, },
        { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8,
          MEDIA_BUS_FMT_SGRBG10_1X10, 0,
-         V4L2_PIX_FMT_SGRBG10DPCM8, 8, "GRBG Bayer 10 bpp DPCM8",  },
+         V4L2_PIX_FMT_SGRBG10DPCM8, 8, },
        { MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_SBGGR10_1X10,
          MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_SBGGR8_1X8,
-         V4L2_PIX_FMT_SBGGR10, 10, "BGGR Bayer 10 bpp", },
+         V4L2_PIX_FMT_SBGGR10, 10, },
        { MEDIA_BUS_FMT_SGBRG10_1X10, MEDIA_BUS_FMT_SGBRG10_1X10,
          MEDIA_BUS_FMT_SGBRG10_1X10, MEDIA_BUS_FMT_SGBRG8_1X8,
-         V4L2_PIX_FMT_SGBRG10, 10, "GBRG Bayer 10 bpp", },
+         V4L2_PIX_FMT_SGBRG10, 10, },
        { MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGRBG10_1X10,
          MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGRBG8_1X8,
-         V4L2_PIX_FMT_SGRBG10, 10, "GRBG Bayer 10 bpp", },
+         V4L2_PIX_FMT_SGRBG10, 10, },
        { MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SRGGB10_1X10,
          MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SRGGB8_1X8,
-         V4L2_PIX_FMT_SRGGB10, 10, "RGGB Bayer 10 bpp", },
+         V4L2_PIX_FMT_SRGGB10, 10, },
        { MEDIA_BUS_FMT_SBGGR12_1X12, MEDIA_BUS_FMT_SBGGR10_1X10,
          MEDIA_BUS_FMT_SBGGR12_1X12, MEDIA_BUS_FMT_SBGGR8_1X8,
-         V4L2_PIX_FMT_SBGGR12, 12, "BGGR Bayer 12 bpp", },
+         V4L2_PIX_FMT_SBGGR12, 12, },
        { MEDIA_BUS_FMT_SGBRG12_1X12, MEDIA_BUS_FMT_SGBRG10_1X10,
          MEDIA_BUS_FMT_SGBRG12_1X12, MEDIA_BUS_FMT_SGBRG8_1X8,
-         V4L2_PIX_FMT_SGBRG12, 12, "GBRG Bayer 12 bpp", },
+         V4L2_PIX_FMT_SGBRG12, 12, },
        { MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SGRBG10_1X10,
          MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SGRBG8_1X8,
-         V4L2_PIX_FMT_SGRBG12, 12, "GRBG Bayer 12 bpp", },
+         V4L2_PIX_FMT_SGRBG12, 12, },
        { MEDIA_BUS_FMT_SRGGB12_1X12, MEDIA_BUS_FMT_SRGGB10_1X10,
          MEDIA_BUS_FMT_SRGGB12_1X12, MEDIA_BUS_FMT_SRGGB8_1X8,
-         V4L2_PIX_FMT_SRGGB12, 12, "RGGB Bayer 12 bpp", },
+         V4L2_PIX_FMT_SRGGB12, 12, },
        { MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_UYVY8_1X16,
          MEDIA_BUS_FMT_UYVY8_1X16, 0,
-         V4L2_PIX_FMT_UYVY, 16, "YUV 4:2:2 (UYVY)", },
+         V4L2_PIX_FMT_UYVY, 16, },
        { MEDIA_BUS_FMT_YUYV8_1X16, MEDIA_BUS_FMT_YUYV8_1X16,
          MEDIA_BUS_FMT_YUYV8_1X16, 0,
-         V4L2_PIX_FMT_YUYV, 16, "YUV 4:2:2 (YUYV)", },
+         V4L2_PIX_FMT_YUYV, 16, },
        { MEDIA_BUS_FMT_YUYV8_1_5X8, MEDIA_BUS_FMT_YUYV8_1_5X8,
          MEDIA_BUS_FMT_YUYV8_1_5X8, 0,
-         V4L2_PIX_FMT_NV12, 8, "YUV 4:2:0 (NV12)", },
+         V4L2_PIX_FMT_NV12, 8, },
 };
 
 const struct iss_format_info *
@@ -563,8 +563,6 @@ iss_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f)
 
                if (index == 0) {
                        f->pixelformat = info->pixelformat;
-                       strscpy(f->description, info->description,
-                               sizeof(f->description));
                        return 0;
                }
 
index f22489e..8b3dd92 100644 (file)
@@ -36,7 +36,6 @@ struct v4l2_pix_format;
  *     shifted to be 8 bits per pixel. =0 if format is not shiftable.
  * @pixelformat: V4L2 pixel format FCC identifier
  * @bpp: Bits per pixel
- * @description: Human-readable format description
  */
 struct iss_format_info {
        u32 code;
@@ -45,7 +44,6 @@ struct iss_format_info {
        u32 flavor;
        u32 pixelformat;
        unsigned int bpp;
-       const char *description;
 };
 
 enum iss_pipeline_stream_state {
index a6232dc..7b9448e 100644 (file)
@@ -869,8 +869,6 @@ static int soc_camera_enum_fmt_vid_cap(struct file *file, void  *priv,
 
        format = icd->user_formats[f->index].host_fmt;
 
-       if (format->name)
-               strscpy(f->description, format->name, sizeof(f->description));
        f->pixelformat = format->fourcc;
        return 0;
 }
index ea54cc2..d4d1e44 100644 (file)
@@ -75,34 +75,27 @@ static const struct v4l2_fract
 /* video formats */
 static struct mmal_fmt formats[] = {
        {
-               .name = "4:2:0, planar, YUV",
                .fourcc = V4L2_PIX_FMT_YUV420,
-               .flags = 0,
                .mmal = MMAL_ENCODING_I420,
                .depth = 12,
                .mmal_component = COMP_CAMERA,
                .ybbp = 1,
                .remove_padding = 1,
        }, {
-               .name = "4:2:2, packed, YUYV",
                .fourcc = V4L2_PIX_FMT_YUYV,
-               .flags = 0,
                .mmal = MMAL_ENCODING_YUYV,
                .depth = 16,
                .mmal_component = COMP_CAMERA,
                .ybbp = 2,
                .remove_padding = 0,
        }, {
-               .name = "RGB24 (LE)",
                .fourcc = V4L2_PIX_FMT_RGB24,
-               .flags = 0,
                .mmal = MMAL_ENCODING_RGB24,
                .depth = 24,
                .mmal_component = COMP_CAMERA,
                .ybbp = 3,
                .remove_padding = 0,
        }, {
-               .name = "JPEG",
                .fourcc = V4L2_PIX_FMT_JPEG,
                .flags = V4L2_FMT_FLAG_COMPRESSED,
                .mmal = MMAL_ENCODING_JPEG,
@@ -111,7 +104,6 @@ static struct mmal_fmt formats[] = {
                .ybbp = 0,
                .remove_padding = 0,
        }, {
-               .name = "H264",
                .fourcc = V4L2_PIX_FMT_H264,
                .flags = V4L2_FMT_FLAG_COMPRESSED,
                .mmal = MMAL_ENCODING_H264,
@@ -120,7 +112,6 @@ static struct mmal_fmt formats[] = {
                .ybbp = 0,
                .remove_padding = 0,
        }, {
-               .name = "MJPEG",
                .fourcc = V4L2_PIX_FMT_MJPEG,
                .flags = V4L2_FMT_FLAG_COMPRESSED,
                .mmal = MMAL_ENCODING_MJPEG,
@@ -129,72 +120,56 @@ static struct mmal_fmt formats[] = {
                .ybbp = 0,
                .remove_padding = 0,
        }, {
-               .name = "4:2:2, packed, YVYU",
                .fourcc = V4L2_PIX_FMT_YVYU,
-               .flags = 0,
                .mmal = MMAL_ENCODING_YVYU,
                .depth = 16,
                .mmal_component = COMP_CAMERA,
                .ybbp = 2,
                .remove_padding = 0,
        }, {
-               .name = "4:2:2, packed, VYUY",
                .fourcc = V4L2_PIX_FMT_VYUY,
-               .flags = 0,
                .mmal = MMAL_ENCODING_VYUY,
                .depth = 16,
                .mmal_component = COMP_CAMERA,
                .ybbp = 2,
                .remove_padding = 0,
        }, {
-               .name = "4:2:2, packed, UYVY",
                .fourcc = V4L2_PIX_FMT_UYVY,
-               .flags = 0,
                .mmal = MMAL_ENCODING_UYVY,
                .depth = 16,
                .mmal_component = COMP_CAMERA,
                .ybbp = 2,
                .remove_padding = 0,
        }, {
-               .name = "4:2:0, planar, NV12",
                .fourcc = V4L2_PIX_FMT_NV12,
-               .flags = 0,
                .mmal = MMAL_ENCODING_NV12,
                .depth = 12,
                .mmal_component = COMP_CAMERA,
                .ybbp = 1,
                .remove_padding = 1,
        }, {
-               .name = "RGB24 (BE)",
                .fourcc = V4L2_PIX_FMT_BGR24,
-               .flags = 0,
                .mmal = MMAL_ENCODING_BGR24,
                .depth = 24,
                .mmal_component = COMP_CAMERA,
                .ybbp = 3,
                .remove_padding = 0,
        }, {
-               .name = "4:2:0, planar, YVU",
                .fourcc = V4L2_PIX_FMT_YVU420,
-               .flags = 0,
                .mmal = MMAL_ENCODING_YV12,
                .depth = 12,
                .mmal_component = COMP_CAMERA,
                .ybbp = 1,
                .remove_padding = 1,
        }, {
-               .name = "4:2:0, planar, NV21",
                .fourcc = V4L2_PIX_FMT_NV21,
-               .flags = 0,
                .mmal = MMAL_ENCODING_NV21,
                .depth = 12,
                .mmal_component = COMP_CAMERA,
                .ybbp = 1,
                .remove_padding = 1,
        }, {
-               .name = "RGB32 (BE)",
                .fourcc = V4L2_PIX_FMT_BGR32,
-               .flags = 0,
                .mmal = MMAL_ENCODING_BGRA,
                .depth = 32,
                .mmal_component = COMP_CAMERA,
@@ -716,9 +691,7 @@ static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv,
 
        fmt = &formats[f->index];
 
-       strlcpy((char *)f->description, fmt->name, sizeof(f->description));
        f->pixelformat = fmt->fourcc;
-       f->flags = fmt->flags;
 
        return 0;
 }
@@ -919,9 +892,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
 
        fmt = &formats[f->index];
 
-       strlcpy((char *)f->description, fmt->name, sizeof(f->description));
        f->pixelformat = fmt->fourcc;
-       f->flags = fmt->flags;
 
        return 0;
 }
index 6f56c51..ff53987 100644 (file)
@@ -26,7 +26,6 @@ struct mmal_msg_context;
 
 /* mapping between v4l and mmal video modes */
 struct mmal_fmt {
-       char  *name;
        u32   fourcc;          /* v4l2 format id */
        int   flags;           /* v4l2 flags field */
        u32   mmal;
index 73de3bd..361f885 100644 (file)
@@ -66,7 +66,6 @@ enum soc_mbus_layout {
 
 /**
  * struct soc_mbus_pixelfmt - Data format on the media bus
- * @name:              Name of the format
  * @fourcc:            Fourcc code, that will be obtained if the data is
  *                     stored in memory in the following way:
  * @packing:           Type of sample-packing, that has to be used
@@ -74,7 +73,6 @@ enum soc_mbus_layout {
  * @bits_per_sample:   How many bits the bridge has to sample
  */
 struct soc_mbus_pixelfmt {
-       const char              *name;
        u32                     fourcc;
        enum soc_mbus_packing   packing;
        enum soc_mbus_order     order;