Commit 9e56380a authored by Joe Perches's avatar Joe Perches Committed by Mauro Carvalho Chehab
Browse files

media: uvcvideo: Rename debug functions



trace isn't a good name as it's not a trace mechanism, it is a
typical debug mechanism.

Rename uvc_trace/uvc_trace_cont macros to uvc_dbg/uvc_dbg_cont.
Rename uvc_trace_param to uvc_dbg_param
Rename UVC_TRACE_<FOO> defines to UVC_DBG_<FOO>
Use ## concatenation in uvc_dbg macros to avoid overly long and
repetitive UVC_DBG uses

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent ed4c5fa4
Loading
Loading
Loading
Loading
+39 −42
Original line number Diff line number Diff line
@@ -906,8 +906,8 @@ static struct uvc_control *uvc_find_control(struct uvc_video_chain *chain,
	}

	if (ctrl == NULL && !next)
		uvc_trace(chain->dev, UVC_TRACE_CONTROL,
			  "Control 0x%08x not found.\n", v4l2_id);
		uvc_dbg(chain->dev, CONTROL, "Control 0x%08x not found\n",
			v4l2_id);

	return ctrl;
}
@@ -1800,8 +1800,8 @@ static int uvc_ctrl_fill_xu_info(struct uvc_device *dev,
	ret = uvc_query_ctrl(dev, UVC_GET_LEN, ctrl->entity->id, dev->intfnum,
			     info->selector, data, 2);
	if (ret < 0) {
		uvc_trace(dev, UVC_TRACE_CONTROL,
			  "GET_LEN failed on control %pUl/%u (%d).\n",
		uvc_dbg(dev, CONTROL,
			"GET_LEN failed on control %pUl/%u (%d)\n",
			info->entity, info->selector, ret);
		goto done;
	}
@@ -1813,16 +1813,16 @@ static int uvc_ctrl_fill_xu_info(struct uvc_device *dev,

	ret = uvc_ctrl_get_flags(dev, ctrl, info);
	if (ret < 0) {
		uvc_trace(dev, UVC_TRACE_CONTROL,
			  "Failed to get flags for control %pUl/%u (%d).\n",
		uvc_dbg(dev, CONTROL,
			"Failed to get flags for control %pUl/%u (%d)\n",
			info->entity, info->selector, ret);
		goto done;
	}

	uvc_ctrl_fixup_xu_info(dev, ctrl, info);

	uvc_trace(dev, UVC_TRACE_CONTROL,
		  "XU control %pUl/%u queried: len %u, flags { get %u set %u auto %u }.\n",
	uvc_dbg(dev, CONTROL,
		"XU control %pUl/%u queried: len %u, flags { get %u set %u auto %u }\n",
		info->entity, info->selector, info->size,
		(info->flags & UVC_CTRL_FLAG_GET_CUR) ? 1 : 0,
		(info->flags & UVC_CTRL_FLAG_SET_CUR) ? 1 : 0,
@@ -1851,7 +1851,7 @@ static int uvc_ctrl_init_xu_ctrl(struct uvc_device *dev,

	ret = uvc_ctrl_add_info(dev, ctrl, &info);
	if (ret < 0)
		uvc_trace(dev, UVC_TRACE_CONTROL,
		uvc_dbg(dev, CONTROL,
			"Failed to initialize control %pUl/%u on device %s entity %u\n",
			info.entity, info.selector, dev->udev->devpath,
			ctrl->entity->id);
@@ -1882,8 +1882,8 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
	}

	if (!found) {
		uvc_trace(chain->dev, UVC_TRACE_CONTROL,
			  "Extension unit %u not found.\n", xqry->unit);
		uvc_dbg(chain->dev, CONTROL, "Extension unit %u not found\n",
			xqry->unit);
		return -ENOENT;
	}

@@ -1898,9 +1898,8 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
	}

	if (!found) {
		uvc_trace(chain->dev, UVC_TRACE_CONTROL,
			  "Control %pUl/%u not found.\n", entity->guid,
			  xqry->selector);
		uvc_dbg(chain->dev, CONTROL, "Control %pUl/%u not found\n",
			entity->guid, xqry->selector);
		return -ENOENT;
	}

@@ -2048,8 +2047,7 @@ static int uvc_ctrl_add_info(struct uvc_device *dev, struct uvc_control *ctrl,

	ctrl->initialized = 1;

	uvc_trace(dev, UVC_TRACE_CONTROL,
		  "Added control %pUl/%u to device %s entity %u\n",
	uvc_dbg(dev, CONTROL, "Added control %pUl/%u to device %s entity %u\n",
		ctrl->info.entity, ctrl->info.selector, dev->udev->devpath,
		ctrl->entity->id);

@@ -2088,8 +2086,7 @@ static int __uvc_ctrl_add_mapping(struct uvc_device *dev,
		map->set = uvc_set_le_value;

	list_add_tail(&map->list, &ctrl->info.mappings);
	uvc_trace(dev, UVC_TRACE_CONTROL,
		  "Adding mapping '%s' to control %pUl/%u.\n",
	uvc_dbg(dev, CONTROL, "Adding mapping '%s' to control %pUl/%u\n",
		map->name, ctrl->info.entity, ctrl->info.selector);

	return 0;
@@ -2106,8 +2103,8 @@ int uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
	int ret;

	if (mapping->id & ~V4L2_CTRL_ID_MASK) {
		uvc_trace(dev, UVC_TRACE_CONTROL,
			  "Can't add mapping '%s', control id 0x%08x is invalid.\n",
		uvc_dbg(dev, CONTROL,
			"Can't add mapping '%s', control id 0x%08x is invalid\n",
			mapping->name, mapping->id);
		return -EINVAL;
	}
@@ -2153,8 +2150,8 @@ int uvc_ctrl_add_mapping(struct uvc_video_chain *chain,

	list_for_each_entry(map, &ctrl->info.mappings, list) {
		if (mapping->id == map->id) {
			uvc_trace(dev, UVC_TRACE_CONTROL,
				  "Can't add mapping '%s', control id 0x%08x already exists.\n",
			uvc_dbg(dev, CONTROL,
				"Can't add mapping '%s', control id 0x%08x already exists\n",
				mapping->name, mapping->id);
			ret = -EEXIST;
			goto done;
@@ -2164,8 +2161,8 @@ int uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
	/* Prevent excess memory consumption */
	if (atomic_inc_return(&dev->nmappings) > UVC_MAX_CONTROL_MAPPINGS) {
		atomic_dec(&dev->nmappings);
		uvc_trace(dev, UVC_TRACE_CONTROL,
			  "Can't add mapping '%s', maximum mappings count (%u) exceeded.\n",
		uvc_dbg(dev, CONTROL,
			"Can't add mapping '%s', maximum mappings count (%u) exceeded\n",
			mapping->name, UVC_MAX_CONTROL_MAPPINGS);
		ret = -ENOMEM;
		goto done;
@@ -2235,8 +2232,8 @@ static void uvc_ctrl_prune_entity(struct uvc_device *dev,
		    !uvc_test_bit(controls, blacklist[i].index))
			continue;

		uvc_trace(dev, UVC_TRACE_CONTROL,
			  "%u/%u control is black listed, removing it.\n",
		uvc_dbg(dev, CONTROL,
			"%u/%u control is black listed, removing it\n",
			entity->id, blacklist[i].index);

		uvc_clear_bit(controls, blacklist[i].index);
+169 −174

File changed.

Preview size limit exceeded, changes collapsed.

+8 −9
Original line number Diff line number Diff line
@@ -50,16 +50,15 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,

	if ((len >= 14 && memcmp(&data[2], hdr, 12) == 0) ||
	    (len >= 15 && memcmp(&data[3], hdr, 12) == 0)) {
		uvc_trace(stream->dev, UVC_TRACE_FRAME,
			  "iSight header found\n");
		uvc_dbg(stream->dev, FRAME, "iSight header found\n");
		is_header = 1;
	}

	/* Synchronize to the input stream by waiting for a header packet. */
	if (buf->state != UVC_BUF_STATE_ACTIVE) {
		if (!is_header) {
			uvc_trace(stream->dev, UVC_TRACE_FRAME,
				  "Dropping packet (out of sync).\n");
			uvc_dbg(stream->dev, FRAME,
				"Dropping packet (out of sync)\n");
			return 0;
		}

@@ -87,8 +86,8 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,
		buf->bytesused += nbytes;

		if (len > maxlen || buf->bytesused == buf->length) {
			uvc_trace(stream->dev, UVC_TRACE_FRAME,
				  "Frame complete (overflow).\n");
			uvc_dbg(stream->dev, FRAME,
				"Frame complete (overflow)\n");
			buf->state = UVC_BUF_STATE_DONE;
		}
	}
@@ -105,8 +104,8 @@ void uvc_video_decode_isight(struct uvc_urb *uvc_urb, struct uvc_buffer *buf,

	for (i = 0; i < urb->number_of_packets; ++i) {
		if (urb->iso_frame_desc[i].status < 0) {
			uvc_trace(stream->dev, UVC_TRACE_FRAME,
				  "USB isochronous frame lost (%d).\n",
			uvc_dbg(stream->dev, FRAME,
				"USB isochronous frame lost (%d)\n",
				urb->iso_frame_desc[i].status);
		}

+2 −2
Original line number Diff line number Diff line
@@ -103,8 +103,8 @@ static int uvc_buffer_prepare(struct vb2_buffer *vb)

	if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
	    vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) {
		uvc_trace(uvc_queue_to_stream(queue)->dev, UVC_TRACE_CAPTURE,
			  "[E] Bytes used out of bounds.\n");
		uvc_dbg(uvc_queue_to_stream(queue)->dev, CAPTURE,
			"[E] Bytes used out of bounds\n");
		return -EINVAL;
	}

+13 −16
Original line number Diff line number Diff line
@@ -93,21 +93,20 @@ static void uvc_event_streaming(struct uvc_device *dev,
				struct uvc_streaming_status *status, int len)
{
	if (len < 3) {
		uvc_trace(dev, UVC_TRACE_STATUS,
			  "Invalid streaming status event received.\n");
		uvc_dbg(dev, STATUS,
			"Invalid streaming status event received\n");
		return;
	}

	if (status->bEvent == 0) {
		if (len < 4)
			return;
		uvc_trace(dev, UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n",
		uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n",
			status->bOriginator,
			status->bValue[0] ? "pressed" : "released", len);
		uvc_input_report_key(dev, KEY_CAMERA, status->bValue[0]);
	} else {
		uvc_trace(dev, UVC_TRACE_STATUS,
			  "Stream %u error event %02x len %d.\n",
		uvc_dbg(dev, STATUS, "Stream %u error event %02x len %d\n",
			status->bOriginator, status->bEvent, len);
	}
}
@@ -163,12 +162,11 @@ static bool uvc_event_control(struct urb *urb,

	if (len < 6 || status->bEvent != 0 ||
	    status->bAttribute >= ARRAY_SIZE(attrs)) {
		uvc_trace(dev, UVC_TRACE_STATUS,
			  "Invalid control status event received.\n");
		uvc_dbg(dev, STATUS, "Invalid control status event received\n");
		return false;
	}

	uvc_trace(dev, UVC_TRACE_STATUS, "Control %u/%u %s change len %d.\n",
	uvc_dbg(dev, STATUS, "Control %u/%u %s change len %d\n",
		status->bOriginator, status->bSelector,
		attrs[status->bAttribute], len);

@@ -237,8 +235,7 @@ static void uvc_status_complete(struct urb *urb)
		}

		default:
			uvc_trace(dev, UVC_TRACE_STATUS,
				  "Unknown status event type %u.\n",
			uvc_dbg(dev, STATUS, "Unknown status event type %u\n",
				dev->status[0]);
			break;
		}
Loading