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

Commit 1e304c47 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

media: uvcvideo: Use kernel integer types



Replace the uint_{8,16,32} types with the corresponding native kernel
types u{8,16,32}.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent cb9cd6c5
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -267,11 +267,11 @@ static __u32 uvc_colorspace(const __u8 primaries)
 * continued fraction decomposition. Using 8 and 333 for n_terms and threshold
 * continued fraction decomposition. Using 8 and 333 for n_terms and threshold
 * respectively seems to give nice results.
 * respectively seems to give nice results.
 */
 */
void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
		unsigned int n_terms, unsigned int threshold)
		unsigned int n_terms, unsigned int threshold)
{
{
	uint32_t *an;
	u32 *an;
	uint32_t x, y, r;
	u32 x, y, r;
	unsigned int i, n;
	unsigned int i, n;


	an = kmalloc(n_terms * sizeof *an, GFP_KERNEL);
	an = kmalloc(n_terms * sizeof *an, GFP_KERNEL);
@@ -318,21 +318,21 @@ void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
 * to compute numerator / denominator * 10000000 using 32 bit fixed point
 * to compute numerator / denominator * 10000000 using 32 bit fixed point
 * arithmetic only.
 * arithmetic only.
 */
 */
uint32_t uvc_fraction_to_interval(uint32_t numerator, uint32_t denominator)
u32 uvc_fraction_to_interval(u32 numerator, u32 denominator)
{
{
	uint32_t multiplier;
	u32 multiplier;


	/* Saturate the result if the operation would overflow. */
	/* Saturate the result if the operation would overflow. */
	if (denominator == 0 ||
	if (denominator == 0 ||
	    numerator/denominator >= ((uint32_t)-1)/10000000)
	    numerator/denominator >= ((u32)-1)/10000000)
		return (uint32_t)-1;
		return (u32)-1;


	/* Divide both the denominator and the multiplier by two until
	/* Divide both the denominator and the multiplier by two until
	 * numerator * multiplier doesn't overflow. If anyone knows a better
	 * numerator * multiplier doesn't overflow. If anyone knows a better
	 * algorithm please let me know.
	 * algorithm please let me know.
	 */
	 */
	multiplier = 10000000;
	multiplier = 10000000;
	while (numerator > ((uint32_t)-1)/multiplier) {
	while (numerator > ((u32)-1)/multiplier) {
		multiplier /= 2;
		multiplier /= 2;
		denominator /= 2;
		denominator /= 2;
	}
	}
+1 −1
Original line number Original line Diff line number Diff line
@@ -336,7 +336,7 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream,
static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream,
static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream,
		struct v4l2_streamparm *parm)
		struct v4l2_streamparm *parm)
{
{
	uint32_t numerator, denominator;
	u32 numerator, denominator;


	if (parm->type != stream->type)
	if (parm->type != stream->type)
		return -EINVAL;
		return -EINVAL;
+2 −2
Original line number Original line Diff line number Diff line
@@ -776,9 +776,9 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
		      struct uvc_xu_control_query *xqry);
		      struct uvc_xu_control_query *xqry);


/* Utility functions */
/* Utility functions */
void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
			   unsigned int n_terms, unsigned int threshold);
			   unsigned int n_terms, unsigned int threshold);
uint32_t uvc_fraction_to_interval(uint32_t numerator, uint32_t denominator);
u32 uvc_fraction_to_interval(u32 numerator, u32 denominator);
struct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alts,
struct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alts,
					    __u8 epaddr);
					    __u8 epaddr);