Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f90580ca authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado Committed by Mauro Carvalho Chehab
Browse files

[media] videodev2: Set vb2_rect's width and height as unsigned



As discussed on the media summit 2013, there is no reason for the width
and height to be signed.

Therefore this patch is an attempt to convert those fields from __s32 to
__u32.

Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi> (documentation and smiapp)
Acked-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent da4a7339
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2523,6 +2523,18 @@ that used it. It was originally scheduled for removal in 2.6.35.
      </orderedlist>
    </section>

    <section>
      <title>V4L2 in Linux 3.14</title>
      <orderedlist>
        <listitem>
		<para> In struct <structname>v4l2_rect</structname>, the type
of <structfield>width</structfield> and <structfield>height</structfield>
fields changed from _s32 to _u32.
	  </para>
        </listitem>
      </orderedlist>
    </section>

    <section id="other">
      <title>Relation of V4L2 to other Linux multimedia APIs</title>

+3 −6
Original line number Diff line number Diff line
@@ -346,17 +346,14 @@ rectangle, in pixels.</entry>
rectangle, in pixels. Offsets increase to the right and down.</entry>
	  </row>
	  <row>
	    <entry>__s32</entry>
	    <entry>__u32</entry>
	    <entry><structfield>width</structfield></entry>
	    <entry>Width of the rectangle, in pixels.</entry>
	  </row>
	  <row>
	    <entry>__s32</entry>
	    <entry>__u32</entry>
	    <entry><structfield>height</structfield></entry>
	    <entry>Height of the rectangle, in pixels. Width and
height cannot be negative, the fields are signed for hysterical
reasons. <!-- video4linux-list@redhat.com on 22 Oct 2002 subject
"Re:[V4L][patches!] Re:v4l2/kernel-2.5" --></entry>
	    <entry>Height of the rectangle, in pixels.</entry>
	  </row>
	</tbody>
      </tgroup>
+9 −1
Original line number Diff line number Diff line
@@ -140,6 +140,14 @@ structs, ioctls) must be noted in more detail in the history chapter
(compat.xml), along with the possible impact on existing drivers and
applications. -->

      <revision>
	<revnumber>3.14</revnumber>
	<date>2013-11-25</date>
	<authorinitials>rr</authorinitials>
	<revremark>Set width and height as unsigned on v4l2_rect.
	</revremark>
      </revision>

      <revision>
	<revnumber>3.11</revnumber>
	<date>2013-05-26</date>
@@ -501,7 +509,7 @@ and discussions on the V4L mailing list.</revremark>
</partinfo>

<title>Video for Linux Two API Specification</title>
 <subtitle>Revision 3.11</subtitle>
 <subtitle>Revision 3.14</subtitle>

  <chapter id="common">
    &sub-common;
+3 −7
Original line number Diff line number Diff line
@@ -133,18 +133,14 @@ rectangle, in pixels.</entry>
rectangle, in pixels.</entry>
	  </row>
	  <row>
	    <entry>__s32</entry>
	    <entry>__u32</entry>
	    <entry><structfield>width</structfield></entry>
	    <entry>Width of the rectangle, in pixels.</entry>
	  </row>
	  <row>
	    <entry>__s32</entry>
	    <entry>__u32</entry>
	    <entry><structfield>height</structfield></entry>
	    <entry>Height of the rectangle, in pixels. Width
and height cannot be negative, the fields are signed for
hysterical reasons. <!-- video4linux-list@redhat.com
on 22 Oct 2002 subject "Re:[V4L][patches!] Re:v4l2/kernel-2.5" -->
</entry>
	    <entry>Height of the rectangle, in pixels.</entry>
	  </row>
	</tbody>
      </tgroup>
+9 −7
Original line number Diff line number Diff line
@@ -459,13 +459,15 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev,
			  MT9M032_COLUMN_START_MAX);
	rect.top = clamp(ALIGN(crop->rect.top, 2), MT9M032_ROW_START_MIN,
			 MT9M032_ROW_START_MAX);
	rect.width = clamp(ALIGN(crop->rect.width, 2), MT9M032_COLUMN_SIZE_MIN,
			   MT9M032_COLUMN_SIZE_MAX);
	rect.height = clamp(ALIGN(crop->rect.height, 2), MT9M032_ROW_SIZE_MIN,
			    MT9M032_ROW_SIZE_MAX);

	rect.width = min(rect.width, MT9M032_PIXEL_ARRAY_WIDTH - rect.left);
	rect.height = min(rect.height, MT9M032_PIXEL_ARRAY_HEIGHT - rect.top);
	rect.width = clamp_t(unsigned int, ALIGN(crop->rect.width, 2),
			     MT9M032_COLUMN_SIZE_MIN, MT9M032_COLUMN_SIZE_MAX);
	rect.height = clamp_t(unsigned int, ALIGN(crop->rect.height, 2),
			      MT9M032_ROW_SIZE_MIN, MT9M032_ROW_SIZE_MAX);

	rect.width = min_t(unsigned int, rect.width,
			   MT9M032_PIXEL_ARRAY_WIDTH - rect.left);
	rect.height = min_t(unsigned int, rect.height,
			    MT9M032_PIXEL_ARRAY_HEIGHT - rect.top);

	__crop = __mt9m032_get_pad_crop(sensor, fh, crop->which);

Loading