Commit 699b9a86 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: uvcvideo: Fix comment blocks style

The uvcvideo driver historically uses the

/* Comment
 * style
 */

for multi-line block comments, which is frowned upon. Patches for the
driver are required to use the more standard

/*
 * Comment
 * style
 */

style. This result in inconsistencies. Fix it by converting all
remaining instances of the old style.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: default avatarRicardo Ribalda <ribalda@chromium.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent edbb6e25
......@@ -749,7 +749,8 @@ static inline void uvc_clear_bit(u8 *data, int bit)
data[bit >> 3] &= ~(1 << (bit & 7));
}
/* Extract the bit string specified by mapping->offset and mapping->size
/*
* Extract the bit string specified by mapping->offset and mapping->size
* from the little-endian data stored at 'data' and return the result as
* a signed 32bit integer. Sign extension will be performed if the mapping
* references a signed data type.
......@@ -785,7 +786,8 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping,
return value;
}
/* Set the bit string specified by mapping->offset and mapping->size
/*
* Set the bit string specified by mapping->offset and mapping->size
* in the little-endian data stored at 'data' to the value 'value'.
*/
static void uvc_set_le_value(struct uvc_control_mapping *mapping,
......@@ -795,7 +797,8 @@ static void uvc_set_le_value(struct uvc_control_mapping *mapping,
int offset = mapping->offset;
u8 mask;
/* According to the v4l2 spec, writing any value to a button control
/*
* According to the v4l2 spec, writing any value to a button control
* should result in the action belonging to the button control being
* triggered. UVC devices however want to see a 1 written -> override
* value.
......@@ -927,7 +930,8 @@ static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain,
UVC_VC_EXTENSION_UNIT)
return ret;
/* GET_RES is mandatory for XU controls, but some
/*
* GET_RES is mandatory for XU controls, but some
* cameras still choke on it. Ignore errors and set the
* resolution value to zero.
*/
......@@ -1522,8 +1526,10 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)
uvc_ctrl_fill_event(handle->chain, &ev, ctrl, mapping, val,
changes);
/* Mark the queue as active, allowing this initial
event to be accepted. */
/*
* Mark the queue as active, allowing this initial event to be
* accepted.
*/
sev->elems = elems;
v4l2_event_queue_fh(sev->fh, &ev);
}
......@@ -1596,7 +1602,8 @@ static int uvc_ctrl_commit_entity(struct uvc_device *dev,
if (!ctrl->initialized)
continue;
/* Reset the loaded flag for auto-update controls that were
/*
* Reset the loaded flag for auto-update controls that were
* marked as loaded in uvc_ctrl_get/uvc_ctrl_set to prevent
* uvc_ctrl_get from using the cached value, and for write-only
* controls to prevent uvc_ctrl_set from setting bits not
......@@ -1755,7 +1762,8 @@ int uvc_ctrl_set(struct uvc_fh *handle,
return -ERANGE;
value = mapping->menu_info[xctrl->value].value;
/* Valid menu indices are reported by the GET_RES request for
/*
* Valid menu indices are reported by the GET_RES request for
* UVC controls that support it.
*/
if (mapping->data_type == UVC_CTRL_DATA_TYPE_BITMASK &&
......@@ -1779,7 +1787,8 @@ int uvc_ctrl_set(struct uvc_fh *handle,
break;
}
/* If the mapping doesn't span the whole UVC control, the current value
/*
* If the mapping doesn't span the whole UVC control, the current value
* needs to be loaded from the device to perform the read-modify-write
* operation.
*/
......@@ -2180,7 +2189,8 @@ static int __uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
unsigned int size;
unsigned int i;
/* Most mappings come from static kernel data and need to be duplicated.
/*
* Most mappings come from static kernel data and need to be duplicated.
* Mappings that come from userspace will be unnecessarily duplicated,
* this could be optimized.
*/
......@@ -2389,7 +2399,8 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
const struct uvc_control_mapping *mend =
mapping + ARRAY_SIZE(uvc_ctrl_mappings);
/* XU controls initialization requires querying the device for control
/*
* XU controls initialization requires querying the device for control
* information. As some buggy UVC devices will crash when queried
* repeatedly in a tight loop, delay XU controls initialization until
* first use.
......
......@@ -329,7 +329,8 @@ static enum v4l2_ycbcr_encoding uvc_ycbcr_enc(const u8 matrix_coefficients)
return V4L2_YCBCR_ENC_DEFAULT; /* Reserved */
}
/* Simplify a fraction using a simple continued fraction decomposition. The
/*
* Simplify a fraction using a simple continued fraction decomposition. The
* idea here is to convert fractions such as 333333/10000000 to 1/30 using
* 32 bit arithmetic only. The algorithm is not perfect and relies upon two
* arbitrary parameters to remove non-significative terms from the simple
......@@ -347,7 +348,8 @@ void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
if (an == NULL)
return;
/* Convert the fraction to a simple continued fraction. See
/*
* Convert the fraction to a simple continued fraction. See
* https://mathforum.org/dr.math/faq/faq.fractions.html
* Stop if the current term is bigger than or equal to the given
* threshold.
......@@ -383,7 +385,8 @@ void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
kfree(an);
}
/* Convert a fraction to a frame interval in 100ns multiples. The idea here is
/*
* Convert a fraction to a frame interval in 100ns multiples. The idea here is
* to compute numerator / denominator * 10000000 using 32 bit fixed point
* arithmetic only.
*/
......@@ -396,7 +399,8 @@ u32 uvc_fraction_to_interval(u32 numerator, u32 denominator)
numerator/denominator >= ((u32)-1)/10000000)
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
* algorithm please let me know.
*/
......@@ -548,7 +552,8 @@ static int uvc_parse_format(struct uvc_device *dev,
format->bpp = buffer[21];
/* Some devices report a format that doesn't match what they
/*
* Some devices report a format that doesn't match what they
* really send.
*/
if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
......@@ -663,7 +668,8 @@ static int uvc_parse_format(struct uvc_device *dev,
buflen -= buffer[0];
buffer += buffer[0];
/* Parse the frame descriptors. Only uncompressed, MJPEG and frame
/*
* Parse the frame descriptors. Only uncompressed, MJPEG and frame
* based formats have frame descriptors.
*/
while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
......@@ -705,7 +711,8 @@ static int uvc_parse_format(struct uvc_device *dev,
}
frame->dwFrameInterval = *intervals;
/* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
/*
* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
* completely. Observed behaviours range from setting the
* value to 1.1x the actual frame size to hardwiring the
* 16 low bits to 0. This results in a higher than necessary
......@@ -717,7 +724,8 @@ static int uvc_parse_format(struct uvc_device *dev,
frame->dwMaxVideoFrameBufferSize = format->bpp
* frame->wWidth * frame->wHeight / 8;
/* Some bogus devices report dwMinFrameInterval equal to
/*
* Some bogus devices report dwMinFrameInterval equal to
* dwMaxFrameInterval and have dwFrameIntervalStep set to
* zero. Setting all null intervals to 1 fixes the problem and
* some other divisions by zero that could happen.
......@@ -727,7 +735,8 @@ static int uvc_parse_format(struct uvc_device *dev,
*(*intervals)++ = interval ? interval : 1;
}
/* Make sure that the default frame interval stays between
/*
* Make sure that the default frame interval stays between
* the boundaries.
*/
n -= frame->bFrameIntervalType ? 1 : 2;
......@@ -819,7 +828,8 @@ static int uvc_parse_streaming(struct uvc_device *dev,
return -ENOMEM;
}
/* The Pico iMage webcam has its class-specific interface descriptors
/*
* The Pico iMage webcam has its class-specific interface descriptors
* after the endpoint descriptors.
*/
if (buflen == 0) {
......@@ -918,7 +928,8 @@ static int uvc_parse_streaming(struct uvc_device *dev,
break;
case UVC_VS_FORMAT_DV:
/* DV format has no frame descriptor. We will create a
/*
* DV format has no frame descriptor. We will create a
* dummy frame descriptor with a dummy frame interval.
*/
nformats++;
......@@ -1105,7 +1116,8 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
if (buffer[1] != 0x41 || buffer[2] != 0x01)
break;
/* Logitech implements several vendor specific functions
/*
* Logitech implements several vendor specific functions
* through vendor specific extension units (LXU).
*
* The LXU descriptors are similar to XU descriptors
......@@ -1303,7 +1315,8 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
return -EINVAL;
}
/* Make sure the terminal type MSB is not null, otherwise it
/*
* Make sure the terminal type MSB is not null, otherwise it
* could be confused with a unit.
*/
type = get_unaligned_le16(&buffer[4]);
......@@ -1437,7 +1450,8 @@ static int uvc_parse_control(struct uvc_device *dev)
int buflen = alts->extralen;
int ret;
/* Parse the default alternate setting only, as the UVC specification
/*
* Parse the default alternate setting only, as the UVC specification
* defines a single alternate setting, the default alternate setting
* zero.
*/
......@@ -1455,7 +1469,8 @@ static int uvc_parse_control(struct uvc_device *dev)
buffer += buffer[0];
}
/* Check if the optional status endpoint is present. Built-in iSight
/*
* Check if the optional status endpoint is present. Built-in iSight
* webcams have an interrupt endpoint but spit proprietary data that
* don't conform to the UVC status endpoint messages. Don't try to
* handle the interrupt endpoint for those cameras.
......@@ -2057,7 +2072,8 @@ static int uvc_scan_device(struct uvc_device *dev)
if (!UVC_ENTITY_IS_OTERM(term))
continue;
/* If the terminal is already included in a chain, skip it.
/*
* If the terminal is already included in a chain, skip it.
* This can happen for chains that have multiple output
* terminals, where all output terminals beside the first one
* will be inserted in the chain in forward scans.
......@@ -2309,7 +2325,8 @@ static int uvc_register_terms(struct uvc_device *dev,
if (ret < 0)
return ret;
/* Register a metadata node, but ignore a possible failure,
/*
* Register a metadata node, but ignore a possible failure,
* complete registration of video nodes anyway.
*/
uvc_meta_register(stream);
......@@ -2507,7 +2524,8 @@ static void uvc_disconnect(struct usb_interface *intf)
{
struct uvc_device *dev = usb_get_intfdata(intf);
/* Set the USB interface data to NULL. This can be done outside the
/*
* Set the USB interface data to NULL. This can be done outside the
* lock, as there's no other reader.
*/
usb_set_intfdata(intf, NULL);
......
......@@ -14,7 +14,8 @@
#include "uvcvideo.h"
/* Built-in iSight webcams implements most of UVC 1.0 except a
/*
* Built-in iSight webcams implements most of UVC 1.0 except a
* different packet format. Instead of sending a header at the
* beginning of each isochronous transfer payload, the webcam sends a
* single header per image (on its own in a packet), followed by
......@@ -65,7 +66,8 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,
buf->state = UVC_BUF_STATE_ACTIVE;
}
/* Mark the buffer as done if we're at the beginning of a new frame.
/*
* Mark the buffer as done if we're at the beginning of a new frame.
*
* Empty buffers (bytesused == 0) don't trigger end of frame detection
* as it doesn't make sense to return an empty buffer.
......@@ -75,7 +77,8 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,
return -EAGAIN;
}
/* Copy the video data to the buffer. Skip header packets, as they
/*
* Copy the video data to the buffer. Skip header packets, as they
* contain no data.
*/
if (!is_header) {
......@@ -109,7 +112,9 @@ void uvc_video_decode_isight(struct uvc_urb *uvc_urb, struct uvc_buffer *buf,
urb->iso_frame_desc[i].status);
}
/* Decode the payload packet.
/*
* Decode the payload packet.
*
* uvc_video_decode is entered twice when a frame transition
* has been detected because the end of frame can only be
* reliably detected when the first packet of the new frame
......
......@@ -135,7 +135,8 @@ static void uvc_buffer_queue(struct vb2_buffer *vb)
kref_init(&buf->ref);
list_add_tail(&buf->queue, &queue->irqqueue);
} else {
/* If the device is disconnected return the buffer to userspace
/*
* If the device is disconnected return the buffer to userspace
* directly. The next QBUF call will fail with -ENODEV.
*/
buf->state = UVC_BUF_STATE_ERROR;
......@@ -412,7 +413,8 @@ void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
spin_lock_irqsave(&queue->irqlock, flags);
uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR);
/* This must be protected by the irqlock spinlock to avoid race
/*
* This must be protected by the irqlock spinlock to avoid race
* conditions between uvc_buffer_queue and the disconnection event that
* could result in an interruptible wait in uvc_dequeue_buffer. Do not
* blindly replace this logic by checking for the UVC_QUEUE_DISCONNECTED
......
......@@ -202,8 +202,7 @@ static void uvc_status_complete(struct urb *urb)
case -ENOENT: /* usb_kill_urb() called. */
case -ECONNRESET: /* usb_unlink_urb() called. */
case -ESHUTDOWN: /* The endpoint is being disabled. */
case -EPROTO: /* Device is disconnected (reported by some
* host controller). */
case -EPROTO: /* Device is disconnected (reported by some host controllers). */
return;
default:
......@@ -272,7 +271,8 @@ int uvc_status_init(struct uvc_device *dev)
pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
/* For high-speed interrupt endpoints, the bInterval value is used as
/*
* For high-speed interrupt endpoints, the bInterval value is used as
* an exponent of two. Some developers forgot about it.
*/
interval = ep->desc.bInterval;
......
......@@ -63,7 +63,8 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain,
break;
case V4L2_CTRL_TYPE_MENU:
/* Prevent excessive memory consumption, as well as integer
/*
* Prevent excessive memory consumption, as well as integer
* overflows.
*/
if (xmap->menu_count == 0 ||
......@@ -177,7 +178,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
fcc[0], fcc[1], fcc[2], fcc[3],
fmt->fmt.pix.width, fmt->fmt.pix.height);
/* Check if the hardware supports the requested format, use the default
/*
* Check if the hardware supports the requested format, use the default
* format otherwise.
*/
for (i = 0; i < stream->nformats; ++i) {
......@@ -191,7 +193,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
fmt->fmt.pix.pixelformat = format->fcc;
}
/* Find the closest image size. The distance between image sizes is
/*
* Find the closest image size. The distance between image sizes is
* the size in pixels of the non-overlapping regions between the
* requested size and the frame-specified size.
*/
......@@ -233,7 +236,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
probe->bFormatIndex = format->index;
probe->bFrameIndex = frame->bFrameIndex;
probe->dwFrameInterval = uvc_try_frame_interval(frame, interval);
/* Some webcams stall the probe control set request when the
/*
* Some webcams stall the probe control set request when the
* dwMaxVideoFrameSize field is set to zero. The UVC specification
* clearly states that the field is read-only from the host, so this
* is a webcam bug. Set dwMaxVideoFrameSize to the value reported by
......@@ -256,7 +260,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
if (ret < 0)
goto done;
/* After the probe, update fmt with the values returned from
/*
* After the probe, update fmt with the values returned from
* negotiation with the device. Some devices return invalid bFormatIndex
* and bFrameIndex values, in which case we can only assume they have
* accepted the requested format as-is.
......
This diff is collapsed.
......@@ -225,7 +225,8 @@ struct gpio_desc;
struct sg_table;
struct uvc_device;
/* TODO: Put the most frequently accessed fields at the beginning of
/*
* TODO: Put the most frequently accessed fields at the beginning of
* structures to maximize cache efficiency.
*/
struct uvc_control_info {
......@@ -270,8 +271,7 @@ struct uvc_control {
struct uvc_entity *entity;
struct uvc_control_info info;
u8 index; /* Used to match the uvc_control entry with a
uvc_control_info. */
u8 index; /* Used to match the uvc_control entry with a uvc_control_info. */
u8 dirty:1,
loaded:1,
modified:1,
......@@ -289,7 +289,8 @@ struct uvc_format_desc {
u32 fcc;
};
/* The term 'entity' refers to both UVC units and UVC terminals.
/*
* The term 'entity' refers to both UVC units and UVC terminals.
*
* The type field is either the terminal type (wTerminalType in the terminal
* descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
......@@ -308,8 +309,7 @@ struct uvc_format_desc {
struct uvc_entity {
struct list_head list; /* Entity as part of a UVC device. */
struct list_head chain; /* Entity as part of a video device
* chain. */
struct list_head chain; /* Entity as part of a video device chain. */
unsigned int flags;
/*
......@@ -591,7 +591,8 @@ struct uvc_streaming {
struct uvc_format *cur_format;
struct uvc_frame *cur_frame;
/* Protect access to ctrl, cur_format, cur_frame and hardware video
/*
* Protect access to ctrl, cur_format, cur_frame and hardware video
* probe control.
*/
struct mutex mutex;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment