Message ID | 20200728143004.3228-1-dhiraj.sharma0024@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: usbvision: fixed coding style | expand |
On Tue, Jul 28, 2020 at 08:00:04PM +0530, Dhiraj Sharma wrote: > As per eudyptula challenge task 10 I had to fix coding styles. That is not needed in a changelog text. > Thus I > used checkpatch.pl script and fixed a chunk of warnings and few errors. Neither is this, please be specific about what you have fixed. My bot should kick in soon with more specifics... thanks, greg k-h
On Tue, Jul 28, 2020 at 08:00:04PM +0530, Dhiraj Sharma wrote: > As per eudyptula challenge task 10 I had to fix coding styles. Thus I > used checkpatch.pl script and fixed a chunk of warnings and few errors. > > Signed-off-by: Dhiraj Sharma <dhiraj.sharma0024@gmail.com> > --- > .../staging/media/usbvision/usbvision-video.c | 91 +++++++++++-------- > 1 file changed, 52 insertions(+), 39 deletions(-) > > diff --git a/drivers/staging/media/usbvision/usbvision-video.c b/drivers/staging/media/usbvision/usbvision-video.c > index 3ea25fdcf767..8b68e99a2813 100644 > --- a/drivers/staging/media/usbvision/usbvision-video.c > +++ b/drivers/staging/media/usbvision/usbvision-video.c > @@ -67,8 +67,8 @@ > #ifdef USBVISION_DEBUG > #define PDEBUG(level, fmt, args...) { \ > if (video_debug & (level)) \ > - printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ > - __func__, __LINE__ , ## args); \ > + pr_debug(KBUILD_MODNAME ":[%s:%d] " fmt, \ > + __func__, __LINE__, ## args); \ > } > #else > #define PDEBUG(level, fmt, args...) do {} while (0) > @@ -79,8 +79,8 @@ > #define DBG_MMAP (1 << 3) > > /* String operations */ > -#define rmspace(str) while (*str == ' ') str++; > -#define goto2next(str) while (*str != ' ') str++; while (*str == ' ') str++; > +#define rmspace(str) do { str++; } while (*str == ' ') > +#define goto2next(str) do { str++; } while (*str != ' ' || *str == ' ') > > > /* sequential number of usbvision device */ > @@ -145,27 +145,29 @@ MODULE_ALIAS(DRIVER_ALIAS); > static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) > { > struct video_device *vdev = to_video_device(cd); > + > return video_get_drvdata(vdev); > } > > -static ssize_t show_version(struct device *cd, > +static ssize_t version_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); > } > -static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); > +static DEVICE_ATTR_RO(version, 0444, version_show, NULL); > > -static ssize_t show_model(struct device *cd, > +static ssize_t model_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%s\n", > usbvision_device_data[usbvision->dev_model].model_string); > } > -static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); > +static DEVICE_ATTR_RO(model, 0444, model_show, NULL); > > -static ssize_t show_hue(struct device *cd, > +static ssize_t hue_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -175,9 +177,9 @@ static ssize_t show_hue(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); > +static DEVICE_ATTR_RO(hue, 0444, hue_show, NULL); > > -static ssize_t show_contrast(struct device *cd, > +static ssize_t contrast_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -187,9 +189,9 @@ static ssize_t show_contrast(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); > +static DEVICE_ATTR_RO(contrast, 0444, contrast_show, NULL); > > -static ssize_t show_brightness(struct device *cd, > +static ssize_t brightness_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -199,9 +201,9 @@ static ssize_t show_brightness(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); > +static DEVICE_ATTR_RO(brightness, 0444, brightness_show, NULL); > > -static ssize_t show_saturation(struct device *cd, > +static ssize_t saturation_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -211,36 +213,39 @@ static ssize_t show_saturation(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); > +static DEVICE_ATTR_RO(saturation, 0444, saturation_show, NULL); > > -static ssize_t show_streaming(struct device *cd, > +static ssize_t streaming_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%s\n", > YES_NO(usbvision->streaming == stream_on ? 1 : 0)); > } > -static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); > +static DEVICE_ATTR_RO(streaming, 0444, streaming_show, NULL); > > -static ssize_t show_compression(struct device *cd, > +static ssize_t compression_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%s\n", > YES_NO(usbvision->isoc_mode == ISOC_MODE_COMPRESS)); > } > -static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); > +static DEVICE_ATTR_RO(compression, 0444, compression_show, NULL); > > static ssize_t show_device_bridge(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%d\n", usbvision->bridge_type); > } > -static DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); > +static DEVICE_ATTR_RO(bridge, 0444, show_device_bridge, NULL); > > static void usbvision_create_sysfs(struct video_device *vdev) > { > @@ -329,7 +334,8 @@ static int usbvision_v4l2_open(struct file *file) > err_code = usbvision_scratch_alloc(usbvision); > if (isoc_mode == ISOC_MODE_COMPRESS) { > /* Allocate intermediate decompression buffers > - only if needed */ > + * only if needed > + */ > err_code = usbvision_decompress_alloc(usbvision); > } > if (err_code) { > @@ -344,6 +350,7 @@ static int usbvision_v4l2_open(struct file *file) > /* Send init sequence only once, it's large! */ > if (!usbvision->initialized) { > int setup_ok = 0; > + > setup_ok = usbvision_setup(usbvision, isoc_mode); > if (setup_ok) > usbvision->initialized = 1; > @@ -400,7 +407,7 @@ static int usbvision_v4l2_close(struct file *file) > mutex_unlock(&usbvision->v4l2_lock); > > if (r) { > - printk(KERN_INFO "%s: Final disconnect\n", __func__); > + pr_debug("%s: Final disconnect\n", __func__); > usbvision_release(usbvision); > return 0; > } > @@ -490,7 +497,8 @@ static int vidioc_enum_input(struct file *file, void *priv, > chan = vi->index + 1; /* skip Television string*/ > > /* Determine the requested input characteristics > - specific for each usbvision card model */ > + * specific for each usbvision card model > + */ > switch (chan) { > case 0: > if (usbvision_device_data[usbvision->dev_model].video_channels == 4) { > @@ -649,7 +657,8 @@ static int vidioc_reqbufs(struct file *file, > RESTRICT_TO_RANGE(vr->count, 1, USBVISION_NUMFRAMES); > > /* Check input validity: > - the user must do a VIDEO CAPTURE and MMAP method. */ > + * the user must do a VIDEO CAPTURE and MMAP method. > + */ > if (vr->memory != V4L2_MEMORY_MMAP) > return -EINVAL; > > @@ -675,7 +684,8 @@ static int vidioc_querybuf(struct file *file, > struct usbvision_frame *frame; > > /* FIXME : must control > - that buffers are mapped (VIDIOC_REQBUFS has been called) */ > + * that buffers are mapped (VIDIOC_REQBUFS has been called) > + */ > if (vb->index >= usbvision->num_frames) > return -EINVAL; > /* Updating the corresponding frame state */ > @@ -813,6 +823,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, > struct v4l2_format *vf) > { > struct usb_usbvision *usbvision = video_drvdata(file); > + > vf->fmt.pix.width = usbvision->curwidth; > vf->fmt.pix.height = usbvision->curheight; > vf->fmt.pix.pixelformat = usbvision->palette.format; > @@ -897,24 +908,27 @@ static ssize_t usbvision_read(struct file *file, char __user *buf, > return -EFAULT; > > /* This entry point is compatible with the mmap routines > - so that a user can do either VIDIOC_QBUF/VIDIOC_DQBUF > - to get frames or call read on the device. */ > + * so that a user can do either VIDIOC_QBUF/VIDIOC_DQBUF > + * to get frames or call read on the device. > + */ > if (!usbvision->num_frames) { > /* First, allocate some frames to work with > - if this has not been done with VIDIOC_REQBUF */ > + * if this has not been done with VIDIOC_REQBUF > + */ > usbvision_frames_free(usbvision); > usbvision_empty_framequeues(usbvision); > usbvision_frames_alloc(usbvision, USBVISION_NUMFRAMES); > } > > if (usbvision->streaming != stream_on) { > - /* no stream is running, make it running ! */ > + // no stream is running, make it running ! > usbvision->streaming = stream_on; > call_all(usbvision, video, s_stream, 1); > } > > /* Then, enqueue as many frames as possible > - (like a user of VIDIOC_QBUF would do) */ > + * (like a user of VIDIOC_QBUF would do) > + */ > for (i = 0; i < usbvision->num_frames; i++) { > frame = &usbvision->frame[i]; > if (frame->grabstate == frame_state_unused) { > @@ -1125,7 +1139,7 @@ static int usbvision_radio_close(struct file *file) > mutex_unlock(&usbvision->v4l2_lock); > > if (r) { > - printk(KERN_INFO "%s: Final disconnect\n", __func__); > + pr_debug("%s: Final disconnect\n", __func__); > v4l2_fh_release(file); > usbvision_release(usbvision); > return 0; > @@ -1273,7 +1287,7 @@ static int usbvision_register_video(struct usb_usbvision *usbvision) > > if (video_register_device(&usbvision->vdev, VFL_TYPE_VIDEO, video_nr) < 0) > goto err_exit; > - printk(KERN_INFO "USBVision[%d]: registered USBVision Video device %s [v4l2]\n", > + pr_debug("USBVision[%d]: registered USBVision Video device %s [v4l2]\n", > usbvision->nr, video_device_node_name(&usbvision->vdev)); > > /* Radio Device: */ > @@ -1284,7 +1298,7 @@ static int usbvision_register_video(struct usb_usbvision *usbvision) > usbvision->rdev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER; > if (video_register_device(&usbvision->rdev, VFL_TYPE_RADIO, radio_nr) < 0) > goto err_exit; > - printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", > + pr_debug("USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", > usbvision->nr, video_device_node_name(&usbvision->rdev)); > } > /* all done */ > @@ -1429,7 +1443,7 @@ static int usbvision_probe(struct usb_interface *intf, > ret = -ENODEV; > goto err_usb; > } > - printk(KERN_INFO "%s: %s found\n", __func__, > + pr_debug("%s: %s found\n", __func__, > usbvision_device_data[model].model_string); > > if (usbvision_device_data[model].interface >= 0) > @@ -1501,8 +1515,7 @@ static int usbvision_probe(struct usb_interface *intf, > goto err_pkt; > } > > - tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc. > - wMaxPacketSize); > + tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc.wMaxPacketSize); > usbvision->alt_max_pkt_size[i] = > (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); > PDEBUG(DBG_PROBE, "Alternate setting %i, max size= %i", i, > @@ -1581,7 +1594,7 @@ static void usbvision_disconnect(struct usb_interface *intf) > mutex_unlock(&usbvision->v4l2_lock); > > if (u) { > - printk(KERN_INFO "%s: In use, disconnect pending\n", > + pr_debug("%s: In use, disconnect pending\n", > __func__); > wake_up_interruptible(&usbvision->wait_frame); > wake_up_interruptible(&usbvision->wait_stream); > @@ -1625,7 +1638,7 @@ static int __init usbvision_init(void) > err_code = usb_register(&usbvision_driver); > > if (err_code == 0) { > - printk(KERN_INFO DRIVER_DESC " : " USBVISION_VERSION_STRING "\n"); > + pr_debug(DRIVER_DESC " : " USBVISION_VERSION_STRING "\n"); > PDEBUG(DBG_PROBE, "success"); > } > return err_code; > -- > 2.17.1 Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause. - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. - You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot
Hi Dhiraj, On 28/07/2020 16:30, Dhiraj Sharma wrote: > As per eudyptula challenge task 10 I had to fix coding styles. Thus I > used checkpatch.pl script and fixed a chunk of warnings and few errors. As both drivers/staging/media/usbvision/Kconfig and .../TODO say, this driver is deprecated and will be removed by the end of this year. So don't bother with this driver. Regards, Hans > > Signed-off-by: Dhiraj Sharma <dhiraj.sharma0024@gmail.com> > --- > .../staging/media/usbvision/usbvision-video.c | 91 +++++++++++-------- > 1 file changed, 52 insertions(+), 39 deletions(-) > > diff --git a/drivers/staging/media/usbvision/usbvision-video.c b/drivers/staging/media/usbvision/usbvision-video.c > index 3ea25fdcf767..8b68e99a2813 100644 > --- a/drivers/staging/media/usbvision/usbvision-video.c > +++ b/drivers/staging/media/usbvision/usbvision-video.c > @@ -67,8 +67,8 @@ > #ifdef USBVISION_DEBUG > #define PDEBUG(level, fmt, args...) { \ > if (video_debug & (level)) \ > - printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ > - __func__, __LINE__ , ## args); \ > + pr_debug(KBUILD_MODNAME ":[%s:%d] " fmt, \ > + __func__, __LINE__, ## args); \ > } > #else > #define PDEBUG(level, fmt, args...) do {} while (0) > @@ -79,8 +79,8 @@ > #define DBG_MMAP (1 << 3) > > /* String operations */ > -#define rmspace(str) while (*str == ' ') str++; > -#define goto2next(str) while (*str != ' ') str++; while (*str == ' ') str++; > +#define rmspace(str) do { str++; } while (*str == ' ') > +#define goto2next(str) do { str++; } while (*str != ' ' || *str == ' ') > > > /* sequential number of usbvision device */ > @@ -145,27 +145,29 @@ MODULE_ALIAS(DRIVER_ALIAS); > static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) > { > struct video_device *vdev = to_video_device(cd); > + > return video_get_drvdata(vdev); > } > > -static ssize_t show_version(struct device *cd, > +static ssize_t version_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); > } > -static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); > +static DEVICE_ATTR_RO(version, 0444, version_show, NULL); > > -static ssize_t show_model(struct device *cd, > +static ssize_t model_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%s\n", > usbvision_device_data[usbvision->dev_model].model_string); > } > -static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); > +static DEVICE_ATTR_RO(model, 0444, model_show, NULL); > > -static ssize_t show_hue(struct device *cd, > +static ssize_t hue_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -175,9 +177,9 @@ static ssize_t show_hue(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); > +static DEVICE_ATTR_RO(hue, 0444, hue_show, NULL); > > -static ssize_t show_contrast(struct device *cd, > +static ssize_t contrast_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -187,9 +189,9 @@ static ssize_t show_contrast(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); > +static DEVICE_ATTR_RO(contrast, 0444, contrast_show, NULL); > > -static ssize_t show_brightness(struct device *cd, > +static ssize_t brightness_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -199,9 +201,9 @@ static ssize_t show_brightness(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); > +static DEVICE_ATTR_RO(brightness, 0444, brightness_show, NULL); > > -static ssize_t show_saturation(struct device *cd, > +static ssize_t saturation_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > @@ -211,36 +213,39 @@ static ssize_t show_saturation(struct device *cd, > > return sprintf(buf, "%d\n", val); > } > -static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); > +static DEVICE_ATTR_RO(saturation, 0444, saturation_show, NULL); > > -static ssize_t show_streaming(struct device *cd, > +static ssize_t streaming_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%s\n", > YES_NO(usbvision->streaming == stream_on ? 1 : 0)); > } > -static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); > +static DEVICE_ATTR_RO(streaming, 0444, streaming_show, NULL); > > -static ssize_t show_compression(struct device *cd, > +static ssize_t compression_show(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%s\n", > YES_NO(usbvision->isoc_mode == ISOC_MODE_COMPRESS)); > } > -static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); > +static DEVICE_ATTR_RO(compression, 0444, compression_show, NULL); > > static ssize_t show_device_bridge(struct device *cd, > struct device_attribute *attr, char *buf) > { > struct video_device *vdev = to_video_device(cd); > struct usb_usbvision *usbvision = video_get_drvdata(vdev); > + > return sprintf(buf, "%d\n", usbvision->bridge_type); > } > -static DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); > +static DEVICE_ATTR_RO(bridge, 0444, show_device_bridge, NULL); > > static void usbvision_create_sysfs(struct video_device *vdev) > { > @@ -329,7 +334,8 @@ static int usbvision_v4l2_open(struct file *file) > err_code = usbvision_scratch_alloc(usbvision); > if (isoc_mode == ISOC_MODE_COMPRESS) { > /* Allocate intermediate decompression buffers > - only if needed */ > + * only if needed > + */ > err_code = usbvision_decompress_alloc(usbvision); > } > if (err_code) { > @@ -344,6 +350,7 @@ static int usbvision_v4l2_open(struct file *file) > /* Send init sequence only once, it's large! */ > if (!usbvision->initialized) { > int setup_ok = 0; > + > setup_ok = usbvision_setup(usbvision, isoc_mode); > if (setup_ok) > usbvision->initialized = 1; > @@ -400,7 +407,7 @@ static int usbvision_v4l2_close(struct file *file) > mutex_unlock(&usbvision->v4l2_lock); > > if (r) { > - printk(KERN_INFO "%s: Final disconnect\n", __func__); > + pr_debug("%s: Final disconnect\n", __func__); > usbvision_release(usbvision); > return 0; > } > @@ -490,7 +497,8 @@ static int vidioc_enum_input(struct file *file, void *priv, > chan = vi->index + 1; /* skip Television string*/ > > /* Determine the requested input characteristics > - specific for each usbvision card model */ > + * specific for each usbvision card model > + */ > switch (chan) { > case 0: > if (usbvision_device_data[usbvision->dev_model].video_channels == 4) { > @@ -649,7 +657,8 @@ static int vidioc_reqbufs(struct file *file, > RESTRICT_TO_RANGE(vr->count, 1, USBVISION_NUMFRAMES); > > /* Check input validity: > - the user must do a VIDEO CAPTURE and MMAP method. */ > + * the user must do a VIDEO CAPTURE and MMAP method. > + */ > if (vr->memory != V4L2_MEMORY_MMAP) > return -EINVAL; > > @@ -675,7 +684,8 @@ static int vidioc_querybuf(struct file *file, > struct usbvision_frame *frame; > > /* FIXME : must control > - that buffers are mapped (VIDIOC_REQBUFS has been called) */ > + * that buffers are mapped (VIDIOC_REQBUFS has been called) > + */ > if (vb->index >= usbvision->num_frames) > return -EINVAL; > /* Updating the corresponding frame state */ > @@ -813,6 +823,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, > struct v4l2_format *vf) > { > struct usb_usbvision *usbvision = video_drvdata(file); > + > vf->fmt.pix.width = usbvision->curwidth; > vf->fmt.pix.height = usbvision->curheight; > vf->fmt.pix.pixelformat = usbvision->palette.format; > @@ -897,24 +908,27 @@ static ssize_t usbvision_read(struct file *file, char __user *buf, > return -EFAULT; > > /* This entry point is compatible with the mmap routines > - so that a user can do either VIDIOC_QBUF/VIDIOC_DQBUF > - to get frames or call read on the device. */ > + * so that a user can do either VIDIOC_QBUF/VIDIOC_DQBUF > + * to get frames or call read on the device. > + */ > if (!usbvision->num_frames) { > /* First, allocate some frames to work with > - if this has not been done with VIDIOC_REQBUF */ > + * if this has not been done with VIDIOC_REQBUF > + */ > usbvision_frames_free(usbvision); > usbvision_empty_framequeues(usbvision); > usbvision_frames_alloc(usbvision, USBVISION_NUMFRAMES); > } > > if (usbvision->streaming != stream_on) { > - /* no stream is running, make it running ! */ > + // no stream is running, make it running ! > usbvision->streaming = stream_on; > call_all(usbvision, video, s_stream, 1); > } > > /* Then, enqueue as many frames as possible > - (like a user of VIDIOC_QBUF would do) */ > + * (like a user of VIDIOC_QBUF would do) > + */ > for (i = 0; i < usbvision->num_frames; i++) { > frame = &usbvision->frame[i]; > if (frame->grabstate == frame_state_unused) { > @@ -1125,7 +1139,7 @@ static int usbvision_radio_close(struct file *file) > mutex_unlock(&usbvision->v4l2_lock); > > if (r) { > - printk(KERN_INFO "%s: Final disconnect\n", __func__); > + pr_debug("%s: Final disconnect\n", __func__); > v4l2_fh_release(file); > usbvision_release(usbvision); > return 0; > @@ -1273,7 +1287,7 @@ static int usbvision_register_video(struct usb_usbvision *usbvision) > > if (video_register_device(&usbvision->vdev, VFL_TYPE_VIDEO, video_nr) < 0) > goto err_exit; > - printk(KERN_INFO "USBVision[%d]: registered USBVision Video device %s [v4l2]\n", > + pr_debug("USBVision[%d]: registered USBVision Video device %s [v4l2]\n", > usbvision->nr, video_device_node_name(&usbvision->vdev)); > > /* Radio Device: */ > @@ -1284,7 +1298,7 @@ static int usbvision_register_video(struct usb_usbvision *usbvision) > usbvision->rdev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER; > if (video_register_device(&usbvision->rdev, VFL_TYPE_RADIO, radio_nr) < 0) > goto err_exit; > - printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", > + pr_debug("USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", > usbvision->nr, video_device_node_name(&usbvision->rdev)); > } > /* all done */ > @@ -1429,7 +1443,7 @@ static int usbvision_probe(struct usb_interface *intf, > ret = -ENODEV; > goto err_usb; > } > - printk(KERN_INFO "%s: %s found\n", __func__, > + pr_debug("%s: %s found\n", __func__, > usbvision_device_data[model].model_string); > > if (usbvision_device_data[model].interface >= 0) > @@ -1501,8 +1515,7 @@ static int usbvision_probe(struct usb_interface *intf, > goto err_pkt; > } > > - tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc. > - wMaxPacketSize); > + tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc.wMaxPacketSize); > usbvision->alt_max_pkt_size[i] = > (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); > PDEBUG(DBG_PROBE, "Alternate setting %i, max size= %i", i, > @@ -1581,7 +1594,7 @@ static void usbvision_disconnect(struct usb_interface *intf) > mutex_unlock(&usbvision->v4l2_lock); > > if (u) { > - printk(KERN_INFO "%s: In use, disconnect pending\n", > + pr_debug("%s: In use, disconnect pending\n", > __func__); > wake_up_interruptible(&usbvision->wait_frame); > wake_up_interruptible(&usbvision->wait_stream); > @@ -1625,7 +1638,7 @@ static int __init usbvision_init(void) > err_code = usb_register(&usbvision_driver); > > if (err_code == 0) { > - printk(KERN_INFO DRIVER_DESC " : " USBVISION_VERSION_STRING "\n"); > + pr_debug(DRIVER_DESC " : " USBVISION_VERSION_STRING "\n"); > PDEBUG(DBG_PROBE, "success"); > } > return err_code; > -- > 2.17.1 >
Sorry, I didn't realize that I committed a mistake by not replying to all. It was an accidental mistake which will not be committed in future now. > > That is not needed in a changelog text. > Alright Sir. > Neither is this, please be specific about what you have fixed. My bot > should kick in soon with more specifics... Sir there were checkpatch.pl styling issues and I fixed them all together, so should I write a proper changelog as what all I fixed i.e errors and warnings thrown by checkpatch.pl On Tue, Jul 28, 2020 at 8:24 PM Greg KH <gregkh@linuxfoundation.org> wrote: > > On Tue, Jul 28, 2020 at 08:00:04PM +0530, Dhiraj Sharma wrote: > > As per eudyptula challenge task 10 I had to fix coding styles. > > That is not needed in a changelog text. > > > Thus I > > used checkpatch.pl script and fixed a chunk of warnings and few errors. > > Neither is this, please be specific about what you have fixed. My bot > should kick in soon with more specifics... > > thanks, > > greg k-h
Sorry I had committed a mistake by not replying to all. > Hi Dhiraj, > > On 28/07/2020 16:30, Dhiraj Sharma wrote: > > As per eudyptula challenge task 10 I had to fix coding styles. Thus I > > used checkpatch.pl script and fixed a chunk of warnings and few errors. > > As both drivers/staging/media/usbvision/Kconfig and .../TODO say, this > driver is deprecated and will be removed by the end of this year. > > So don't bother with this driver. > > Regards, > > Hans Alright Sir, I read that and thought that it can be merged this year though. Next if i see such sentences I will not do that
On Tue, Jul 28, 2020 at 09:14:24PM +0530, Dhiraj Sharma wrote: > Sorry, I didn't realize that I committed a mistake by not replying to > all. It was an accidental mistake which will not be committed in > future now. > > > > > That is not needed in a changelog text. > > > > Alright Sir. > > > Neither is this, please be specific about what you have fixed. My bot > > should kick in soon with more specifics... > > Sir there were checkpatch.pl styling issues and I fixed them all > together, so should I write a proper changelog as what all I fixed i.e > errors and warnings thrown by checkpatch.pl As the bot said, only do one type of thing per patch, and "fix all checkpatch errors/warnings" is not one type of thing.
> As the bot said, only do one type of thing per patch, and "fix all > checkpatch errors/warnings" is not one type of thing. So should I send a fresh patch with minimal fixes? instead of replying to this mail with [PATCH 01]
On Tue, Jul 28, 2020 at 10:13:22PM +0530, Dhiraj Sharma wrote: > > As the bot said, only do one type of thing per patch, and "fix all > > checkpatch errors/warnings" is not one type of thing. > > So should I send a fresh patch with minimal fixes? instead of replying > to this mail with [PATCH 01] Why are you ignoring what Hans said?
Alright sorry, I will ignore this patch and will commit the new patch in another file. On Tue, Jul 28, 2020 at 10:28 PM Greg KH <gregkh@linuxfoundation.org> wrote: > > On Tue, Jul 28, 2020 at 10:13:22PM +0530, Dhiraj Sharma wrote: > > > As the bot said, only do one type of thing per patch, and "fix all > > > checkpatch errors/warnings" is not one type of thing. > > > > So should I send a fresh patch with minimal fixes? instead of replying > > to this mail with [PATCH 01] > > Why are you ignoring what Hans said?
Hi Dhiraj, Thank you for the patch! Yet something to improve: [auto build test ERROR on linuxtv-media/master] [also build test ERROR on staging/staging-testing soc/for-next v5.8-rc7 next-20200728] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Dhiraj-Sharma/media-usbvision-fixed-coding-style/20200728-223404 base: git://linuxtv.org/media_tree.git master config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/staging/media/usbvision/usbvision-video.c:157:56: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 157 | static DEVICE_ATTR_RO(version, 0444, version_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | >> drivers/staging/media/usbvision/usbvision-video.c:157:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 157 | static DEVICE_ATTR_RO(version, 0444, version_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:168:52: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 168 | static DEVICE_ATTR_RO(model, 0444, model_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:168:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 168 | static DEVICE_ATTR_RO(model, 0444, model_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:180:48: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 180 | static DEVICE_ATTR_RO(hue, 0444, hue_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:180:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 180 | static DEVICE_ATTR_RO(hue, 0444, hue_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:192:58: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 192 | static DEVICE_ATTR_RO(contrast, 0444, contrast_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:192:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 192 | static DEVICE_ATTR_RO(contrast, 0444, contrast_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:204:62: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 204 | static DEVICE_ATTR_RO(brightness, 0444, brightness_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:204:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 204 | static DEVICE_ATTR_RO(brightness, 0444, brightness_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:216:62: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 216 | static DEVICE_ATTR_RO(saturation, 0444, saturation_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:216:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 216 | static DEVICE_ATTR_RO(saturation, 0444, saturation_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:227:60: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 227 | static DEVICE_ATTR_RO(streaming, 0444, streaming_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:227:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 227 | static DEVICE_ATTR_RO(streaming, 0444, streaming_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:238:64: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 238 | static DEVICE_ATTR_RO(compression, 0444, compression_show, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:238:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 238 | static DEVICE_ATTR_RO(compression, 0444, compression_show, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:248:61: error: macro "DEVICE_ATTR_RO" passed 4 arguments, but takes just 1 248 | static DEVICE_ATTR_RO(bridge, 0444, show_device_bridge, NULL); | ^ In file included from include/linux/acpi.h:15, from include/linux/i2c.h:13, from drivers/staging/media/usbvision/usbvision-video.c:43: include/linux/device.h:131: note: macro "DEVICE_ATTR_RO" defined here 131 | #define DEVICE_ATTR_RO(_name) \ | drivers/staging/media/usbvision/usbvision-video.c:248:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int] 248 | static DEVICE_ATTR_RO(bridge, 0444, show_device_bridge, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c: In function 'usbvision_create_sysfs': >> drivers/staging/media/usbvision/usbvision-video.c:257:41: error: 'dev_attr_version' undeclared (first use in this function) 257 | res = device_create_file(&vdev->dev, &dev_attr_version); | ^~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:257:41: note: each undeclared identifier is reported only once for each function it appears in >> drivers/staging/media/usbvision/usbvision-video.c:260:41: error: 'dev_attr_model' undeclared (first use in this function); did you mean 'dev_to_node'? 260 | res = device_create_file(&vdev->dev, &dev_attr_model); | ^~~~~~~~~~~~~~ | dev_to_node >> drivers/staging/media/usbvision/usbvision-video.c:263:41: error: 'dev_attr_hue' undeclared (first use in this function) 263 | res = device_create_file(&vdev->dev, &dev_attr_hue); | ^~~~~~~~~~~~ >> drivers/staging/media/usbvision/usbvision-video.c:266:41: error: 'dev_attr_contrast' undeclared (first use in this function) 266 | res = device_create_file(&vdev->dev, &dev_attr_contrast); | ^~~~~~~~~~~~~~~~~ >> drivers/staging/media/usbvision/usbvision-video.c:269:41: error: 'dev_attr_brightness' undeclared (first use in this function) 269 | res = device_create_file(&vdev->dev, &dev_attr_brightness); | ^~~~~~~~~~~~~~~~~~~ >> drivers/staging/media/usbvision/usbvision-video.c:272:41: error: 'dev_attr_saturation' undeclared (first use in this function) 272 | res = device_create_file(&vdev->dev, &dev_attr_saturation); | ^~~~~~~~~~~~~~~~~~~ >> drivers/staging/media/usbvision/usbvision-video.c:275:41: error: 'dev_attr_streaming' undeclared (first use in this function) 275 | res = device_create_file(&vdev->dev, &dev_attr_streaming); | ^~~~~~~~~~~~~~~~~~ >> drivers/staging/media/usbvision/usbvision-video.c:278:41: error: 'dev_attr_compression' undeclared (first use in this function) 278 | res = device_create_file(&vdev->dev, &dev_attr_compression); | ^~~~~~~~~~~~~~~~~~~~ >> drivers/staging/media/usbvision/usbvision-video.c:281:41: error: 'dev_attr_bridge' undeclared (first use in this function) 281 | res = device_create_file(&vdev->dev, &dev_attr_bridge); | ^~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c: In function 'usbvision_remove_sysfs': drivers/staging/media/usbvision/usbvision-video.c:292:35: error: 'dev_attr_version' undeclared (first use in this function) 292 | device_remove_file(&vdev->dev, &dev_attr_version); | ^~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:293:35: error: 'dev_attr_model' undeclared (first use in this function); did you mean 'dev_to_node'? 293 | device_remove_file(&vdev->dev, &dev_attr_model); | ^~~~~~~~~~~~~~ | dev_to_node drivers/staging/media/usbvision/usbvision-video.c:294:35: error: 'dev_attr_hue' undeclared (first use in this function) 294 | device_remove_file(&vdev->dev, &dev_attr_hue); | ^~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:295:35: error: 'dev_attr_contrast' undeclared (first use in this function) 295 | device_remove_file(&vdev->dev, &dev_attr_contrast); | ^~~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:296:35: error: 'dev_attr_brightness' undeclared (first use in this function) 296 | device_remove_file(&vdev->dev, &dev_attr_brightness); | ^~~~~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:297:35: error: 'dev_attr_saturation' undeclared (first use in this function) 297 | device_remove_file(&vdev->dev, &dev_attr_saturation); | ^~~~~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:298:35: error: 'dev_attr_streaming' undeclared (first use in this function) 298 | device_remove_file(&vdev->dev, &dev_attr_streaming); | ^~~~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:299:35: error: 'dev_attr_compression' undeclared (first use in this function) 299 | device_remove_file(&vdev->dev, &dev_attr_compression); | ^~~~~~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:300:35: error: 'dev_attr_bridge' undeclared (first use in this function) 300 | device_remove_file(&vdev->dev, &dev_attr_bridge); | ^~~~~~~~~~~~~~~ At top level: drivers/staging/media/usbvision/usbvision-video.c:240:16: warning: 'show_device_bridge' defined but not used [-Wunused-function] 240 | static ssize_t show_device_bridge(struct device *cd, | ^~~~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:229:16: warning: 'compression_show' defined but not used [-Wunused-function] 229 | static ssize_t compression_show(struct device *cd, | ^~~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:218:16: warning: 'streaming_show' defined but not used [-Wunused-function] 218 | static ssize_t streaming_show(struct device *cd, | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:206:16: warning: 'saturation_show' defined but not used [-Wunused-function] 206 | static ssize_t saturation_show(struct device *cd, | ^~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:194:16: warning: 'brightness_show' defined but not used [-Wunused-function] 194 | static ssize_t brightness_show(struct device *cd, | ^~~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:182:16: warning: 'contrast_show' defined but not used [-Wunused-function] 182 | static ssize_t contrast_show(struct device *cd, | ^~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:170:16: warning: 'hue_show' defined but not used [-Wunused-function] 170 | static ssize_t hue_show(struct device *cd, | ^~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:159:16: warning: 'model_show' defined but not used [-Wunused-function] 159 | static ssize_t model_show(struct device *cd, | ^~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:248:8: warning: 'DEVICE_ATTR_RO' defined but not used [-Wunused-variable] 248 | static DEVICE_ATTR_RO(bridge, 0444, show_device_bridge, NULL); | ^~~~~~~~~~~~~~ drivers/staging/media/usbvision/usbvision-video.c:152:16: warning: 'version_show' defined but not used [-Wunused-function] 152 | static ssize_t version_show(struct device *cd, | ^~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/DEVICE_ATTR_RO +157 drivers/staging/media/usbvision/usbvision-video.c 151 152 static ssize_t version_show(struct device *cd, 153 struct device_attribute *attr, char *buf) 154 { 155 return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); 156 } > 157 static DEVICE_ATTR_RO(version, 0444, version_show, NULL); 158 159 static ssize_t model_show(struct device *cd, 160 struct device_attribute *attr, char *buf) 161 { 162 struct video_device *vdev = to_video_device(cd); 163 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 164 165 return sprintf(buf, "%s\n", 166 usbvision_device_data[usbvision->dev_model].model_string); 167 } 168 static DEVICE_ATTR_RO(model, 0444, model_show, NULL); 169 170 static ssize_t hue_show(struct device *cd, 171 struct device_attribute *attr, char *buf) 172 { 173 struct video_device *vdev = to_video_device(cd); 174 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 175 s32 val = v4l2_ctrl_g_ctrl(v4l2_ctrl_find(&usbvision->hdl, 176 V4L2_CID_HUE)); 177 178 return sprintf(buf, "%d\n", val); 179 } 180 static DEVICE_ATTR_RO(hue, 0444, hue_show, NULL); 181 182 static ssize_t contrast_show(struct device *cd, 183 struct device_attribute *attr, char *buf) 184 { 185 struct video_device *vdev = to_video_device(cd); 186 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 187 s32 val = v4l2_ctrl_g_ctrl(v4l2_ctrl_find(&usbvision->hdl, 188 V4L2_CID_CONTRAST)); 189 190 return sprintf(buf, "%d\n", val); 191 } 192 static DEVICE_ATTR_RO(contrast, 0444, contrast_show, NULL); 193 194 static ssize_t brightness_show(struct device *cd, 195 struct device_attribute *attr, char *buf) 196 { 197 struct video_device *vdev = to_video_device(cd); 198 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 199 s32 val = v4l2_ctrl_g_ctrl(v4l2_ctrl_find(&usbvision->hdl, 200 V4L2_CID_BRIGHTNESS)); 201 202 return sprintf(buf, "%d\n", val); 203 } 204 static DEVICE_ATTR_RO(brightness, 0444, brightness_show, NULL); 205 206 static ssize_t saturation_show(struct device *cd, 207 struct device_attribute *attr, char *buf) 208 { 209 struct video_device *vdev = to_video_device(cd); 210 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 211 s32 val = v4l2_ctrl_g_ctrl(v4l2_ctrl_find(&usbvision->hdl, 212 V4L2_CID_SATURATION)); 213 214 return sprintf(buf, "%d\n", val); 215 } 216 static DEVICE_ATTR_RO(saturation, 0444, saturation_show, NULL); 217 218 static ssize_t streaming_show(struct device *cd, 219 struct device_attribute *attr, char *buf) 220 { 221 struct video_device *vdev = to_video_device(cd); 222 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 223 224 return sprintf(buf, "%s\n", 225 YES_NO(usbvision->streaming == stream_on ? 1 : 0)); 226 } 227 static DEVICE_ATTR_RO(streaming, 0444, streaming_show, NULL); 228 229 static ssize_t compression_show(struct device *cd, 230 struct device_attribute *attr, char *buf) 231 { 232 struct video_device *vdev = to_video_device(cd); 233 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 234 235 return sprintf(buf, "%s\n", 236 YES_NO(usbvision->isoc_mode == ISOC_MODE_COMPRESS)); 237 } 238 static DEVICE_ATTR_RO(compression, 0444, compression_show, NULL); 239 240 static ssize_t show_device_bridge(struct device *cd, 241 struct device_attribute *attr, char *buf) 242 { 243 struct video_device *vdev = to_video_device(cd); 244 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 245 246 return sprintf(buf, "%d\n", usbvision->bridge_type); 247 } 248 static DEVICE_ATTR_RO(bridge, 0444, show_device_bridge, NULL); 249 250 static void usbvision_create_sysfs(struct video_device *vdev) 251 { 252 int res; 253 254 if (!vdev) 255 return; 256 do { > 257 res = device_create_file(&vdev->dev, &dev_attr_version); 258 if (res < 0) 259 break; > 260 res = device_create_file(&vdev->dev, &dev_attr_model); 261 if (res < 0) 262 break; > 263 res = device_create_file(&vdev->dev, &dev_attr_hue); 264 if (res < 0) 265 break; > 266 res = device_create_file(&vdev->dev, &dev_attr_contrast); 267 if (res < 0) 268 break; > 269 res = device_create_file(&vdev->dev, &dev_attr_brightness); 270 if (res < 0) 271 break; > 272 res = device_create_file(&vdev->dev, &dev_attr_saturation); 273 if (res < 0) 274 break; > 275 res = device_create_file(&vdev->dev, &dev_attr_streaming); 276 if (res < 0) 277 break; > 278 res = device_create_file(&vdev->dev, &dev_attr_compression); 279 if (res < 0) 280 break; > 281 res = device_create_file(&vdev->dev, &dev_attr_bridge); 282 if (res >= 0) 283 return; 284 } while (0); 285 286 dev_err(&vdev->dev, "%s error: %d\n", __func__, res); 287 } 288 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/staging/media/usbvision/usbvision-video.c b/drivers/staging/media/usbvision/usbvision-video.c index 3ea25fdcf767..8b68e99a2813 100644 --- a/drivers/staging/media/usbvision/usbvision-video.c +++ b/drivers/staging/media/usbvision/usbvision-video.c @@ -67,8 +67,8 @@ #ifdef USBVISION_DEBUG #define PDEBUG(level, fmt, args...) { \ if (video_debug & (level)) \ - printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ - __func__, __LINE__ , ## args); \ + pr_debug(KBUILD_MODNAME ":[%s:%d] " fmt, \ + __func__, __LINE__, ## args); \ } #else #define PDEBUG(level, fmt, args...) do {} while (0) @@ -79,8 +79,8 @@ #define DBG_MMAP (1 << 3) /* String operations */ -#define rmspace(str) while (*str == ' ') str++; -#define goto2next(str) while (*str != ' ') str++; while (*str == ' ') str++; +#define rmspace(str) do { str++; } while (*str == ' ') +#define goto2next(str) do { str++; } while (*str != ' ' || *str == ' ') /* sequential number of usbvision device */ @@ -145,27 +145,29 @@ MODULE_ALIAS(DRIVER_ALIAS); static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) { struct video_device *vdev = to_video_device(cd); + return video_get_drvdata(vdev); } -static ssize_t show_version(struct device *cd, +static ssize_t version_show(struct device *cd, struct device_attribute *attr, char *buf) { return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); } -static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); +static DEVICE_ATTR_RO(version, 0444, version_show, NULL); -static ssize_t show_model(struct device *cd, +static ssize_t model_show(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); struct usb_usbvision *usbvision = video_get_drvdata(vdev); + return sprintf(buf, "%s\n", usbvision_device_data[usbvision->dev_model].model_string); } -static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); +static DEVICE_ATTR_RO(model, 0444, model_show, NULL); -static ssize_t show_hue(struct device *cd, +static ssize_t hue_show(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); @@ -175,9 +177,9 @@ static ssize_t show_hue(struct device *cd, return sprintf(buf, "%d\n", val); } -static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); +static DEVICE_ATTR_RO(hue, 0444, hue_show, NULL); -static ssize_t show_contrast(struct device *cd, +static ssize_t contrast_show(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); @@ -187,9 +189,9 @@ static ssize_t show_contrast(struct device *cd, return sprintf(buf, "%d\n", val); } -static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); +static DEVICE_ATTR_RO(contrast, 0444, contrast_show, NULL); -static ssize_t show_brightness(struct device *cd, +static ssize_t brightness_show(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); @@ -199,9 +201,9 @@ static ssize_t show_brightness(struct device *cd, return sprintf(buf, "%d\n", val); } -static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); +static DEVICE_ATTR_RO(brightness, 0444, brightness_show, NULL); -static ssize_t show_saturation(struct device *cd, +static ssize_t saturation_show(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); @@ -211,36 +213,39 @@ static ssize_t show_saturation(struct device *cd, return sprintf(buf, "%d\n", val); } -static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); +static DEVICE_ATTR_RO(saturation, 0444, saturation_show, NULL); -static ssize_t show_streaming(struct device *cd, +static ssize_t streaming_show(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); struct usb_usbvision *usbvision = video_get_drvdata(vdev); + return sprintf(buf, "%s\n", YES_NO(usbvision->streaming == stream_on ? 1 : 0)); } -static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); +static DEVICE_ATTR_RO(streaming, 0444, streaming_show, NULL); -static ssize_t show_compression(struct device *cd, +static ssize_t compression_show(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); struct usb_usbvision *usbvision = video_get_drvdata(vdev); + return sprintf(buf, "%s\n", YES_NO(usbvision->isoc_mode == ISOC_MODE_COMPRESS)); } -static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); +static DEVICE_ATTR_RO(compression, 0444, compression_show, NULL); static ssize_t show_device_bridge(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = to_video_device(cd); struct usb_usbvision *usbvision = video_get_drvdata(vdev); + return sprintf(buf, "%d\n", usbvision->bridge_type); } -static DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); +static DEVICE_ATTR_RO(bridge, 0444, show_device_bridge, NULL); static void usbvision_create_sysfs(struct video_device *vdev) { @@ -329,7 +334,8 @@ static int usbvision_v4l2_open(struct file *file) err_code = usbvision_scratch_alloc(usbvision); if (isoc_mode == ISOC_MODE_COMPRESS) { /* Allocate intermediate decompression buffers - only if needed */ + * only if needed + */ err_code = usbvision_decompress_alloc(usbvision); } if (err_code) { @@ -344,6 +350,7 @@ static int usbvision_v4l2_open(struct file *file) /* Send init sequence only once, it's large! */ if (!usbvision->initialized) { int setup_ok = 0; + setup_ok = usbvision_setup(usbvision, isoc_mode); if (setup_ok) usbvision->initialized = 1; @@ -400,7 +407,7 @@ static int usbvision_v4l2_close(struct file *file) mutex_unlock(&usbvision->v4l2_lock); if (r) { - printk(KERN_INFO "%s: Final disconnect\n", __func__); + pr_debug("%s: Final disconnect\n", __func__); usbvision_release(usbvision); return 0; } @@ -490,7 +497,8 @@ static int vidioc_enum_input(struct file *file, void *priv, chan = vi->index + 1; /* skip Television string*/ /* Determine the requested input characteristics - specific for each usbvision card model */ + * specific for each usbvision card model + */ switch (chan) { case 0: if (usbvision_device_data[usbvision->dev_model].video_channels == 4) { @@ -649,7 +657,8 @@ static int vidioc_reqbufs(struct file *file, RESTRICT_TO_RANGE(vr->count, 1, USBVISION_NUMFRAMES); /* Check input validity: - the user must do a VIDEO CAPTURE and MMAP method. */ + * the user must do a VIDEO CAPTURE and MMAP method. + */ if (vr->memory != V4L2_MEMORY_MMAP) return -EINVAL; @@ -675,7 +684,8 @@ static int vidioc_querybuf(struct file *file, struct usbvision_frame *frame; /* FIXME : must control - that buffers are mapped (VIDIOC_REQBUFS has been called) */ + * that buffers are mapped (VIDIOC_REQBUFS has been called) + */ if (vb->index >= usbvision->num_frames) return -EINVAL; /* Updating the corresponding frame state */ @@ -813,6 +823,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *vf) { struct usb_usbvision *usbvision = video_drvdata(file); + vf->fmt.pix.width = usbvision->curwidth; vf->fmt.pix.height = usbvision->curheight; vf->fmt.pix.pixelformat = usbvision->palette.format; @@ -897,24 +908,27 @@ static ssize_t usbvision_read(struct file *file, char __user *buf, return -EFAULT; /* This entry point is compatible with the mmap routines - so that a user can do either VIDIOC_QBUF/VIDIOC_DQBUF - to get frames or call read on the device. */ + * so that a user can do either VIDIOC_QBUF/VIDIOC_DQBUF + * to get frames or call read on the device. + */ if (!usbvision->num_frames) { /* First, allocate some frames to work with - if this has not been done with VIDIOC_REQBUF */ + * if this has not been done with VIDIOC_REQBUF + */ usbvision_frames_free(usbvision); usbvision_empty_framequeues(usbvision); usbvision_frames_alloc(usbvision, USBVISION_NUMFRAMES); } if (usbvision->streaming != stream_on) { - /* no stream is running, make it running ! */ + // no stream is running, make it running ! usbvision->streaming = stream_on; call_all(usbvision, video, s_stream, 1); } /* Then, enqueue as many frames as possible - (like a user of VIDIOC_QBUF would do) */ + * (like a user of VIDIOC_QBUF would do) + */ for (i = 0; i < usbvision->num_frames; i++) { frame = &usbvision->frame[i]; if (frame->grabstate == frame_state_unused) { @@ -1125,7 +1139,7 @@ static int usbvision_radio_close(struct file *file) mutex_unlock(&usbvision->v4l2_lock); if (r) { - printk(KERN_INFO "%s: Final disconnect\n", __func__); + pr_debug("%s: Final disconnect\n", __func__); v4l2_fh_release(file); usbvision_release(usbvision); return 0; @@ -1273,7 +1287,7 @@ static int usbvision_register_video(struct usb_usbvision *usbvision) if (video_register_device(&usbvision->vdev, VFL_TYPE_VIDEO, video_nr) < 0) goto err_exit; - printk(KERN_INFO "USBVision[%d]: registered USBVision Video device %s [v4l2]\n", + pr_debug("USBVision[%d]: registered USBVision Video device %s [v4l2]\n", usbvision->nr, video_device_node_name(&usbvision->vdev)); /* Radio Device: */ @@ -1284,7 +1298,7 @@ static int usbvision_register_video(struct usb_usbvision *usbvision) usbvision->rdev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER; if (video_register_device(&usbvision->rdev, VFL_TYPE_RADIO, radio_nr) < 0) goto err_exit; - printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", + pr_debug("USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", usbvision->nr, video_device_node_name(&usbvision->rdev)); } /* all done */ @@ -1429,7 +1443,7 @@ static int usbvision_probe(struct usb_interface *intf, ret = -ENODEV; goto err_usb; } - printk(KERN_INFO "%s: %s found\n", __func__, + pr_debug("%s: %s found\n", __func__, usbvision_device_data[model].model_string); if (usbvision_device_data[model].interface >= 0) @@ -1501,8 +1515,7 @@ static int usbvision_probe(struct usb_interface *intf, goto err_pkt; } - tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc. - wMaxPacketSize); + tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc.wMaxPacketSize); usbvision->alt_max_pkt_size[i] = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); PDEBUG(DBG_PROBE, "Alternate setting %i, max size= %i", i, @@ -1581,7 +1594,7 @@ static void usbvision_disconnect(struct usb_interface *intf) mutex_unlock(&usbvision->v4l2_lock); if (u) { - printk(KERN_INFO "%s: In use, disconnect pending\n", + pr_debug("%s: In use, disconnect pending\n", __func__); wake_up_interruptible(&usbvision->wait_frame); wake_up_interruptible(&usbvision->wait_stream); @@ -1625,7 +1638,7 @@ static int __init usbvision_init(void) err_code = usb_register(&usbvision_driver); if (err_code == 0) { - printk(KERN_INFO DRIVER_DESC " : " USBVISION_VERSION_STRING "\n"); + pr_debug(DRIVER_DESC " : " USBVISION_VERSION_STRING "\n"); PDEBUG(DBG_PROBE, "success"); } return err_code;
As per eudyptula challenge task 10 I had to fix coding styles. Thus I used checkpatch.pl script and fixed a chunk of warnings and few errors. Signed-off-by: Dhiraj Sharma <dhiraj.sharma0024@gmail.com> --- .../staging/media/usbvision/usbvision-video.c | 91 +++++++++++-------- 1 file changed, 52 insertions(+), 39 deletions(-) -- 2.17.1