public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Piotr Chmura <chmooreck@poczta.onet.pl>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Devin Heitmueller <dheitmueller@kernellabs.com>,
	Stefan Richter <stefanr@s5r6.in-berlin.de>,
	Greg KH <gregkh@suse.de>, Patrick Dickey <pdickeybeta@gmail.com>,
	LMML <linux-media@vger.kernel.org>,
	devel@driverdev.osuosl.org
Subject: [RESEND PATCH 7/14] staging/media/as102: checkpatch fixes
Date: Tue, 18 Oct 2011 21:57:30 +0200	[thread overview]
Message-ID: <20111018215730.0442fe23@darkstar> (raw)
In-Reply-To: <20111018111213.0b4c0ec8.chmooreck@poczta.onet.pl>

Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller <dheitmueller@kernellabs.com>
# Date 1267318867 18000
# Node ID 152825226bec049f947a844bea2c530fc9269ae5
# Parent  5916edd6739e9b8e02ff8a1e93161c4d23b50b3e
as102: checkpatch fixes

From: Devin Heitmueller <dheitmueller@kernellabs.com>

Fix make checkpatch issues reported against as102_usb_drv.c.

Priority: normal

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl>

diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/media/dvb/as102/as102_usb_drv.c
--- linux/drivers/staging/media/as102/as102_usb_drv.c
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
+ * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -49,7 +50,7 @@
 	.id_table   =  as102_usb_id_table
 };
 
-struct file_operations as102_dev_fops = {
+static const struct file_operations as102_dev_fops = {
 	.owner   = THIS_MODULE,
 	.open    = as102_open,
 	.release = as102_release,
@@ -63,46 +64,48 @@
 
 static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap,
 			      unsigned char *send_buf, int send_buf_len,
-			      unsigned char *recv_buf, int recv_buf_len) {
-
+			      unsigned char *recv_buf, int recv_buf_len)
+{
 	int ret = 0;
 	ENTER();
 
-	if(send_buf != NULL) {
+	if (send_buf != NULL) {
 		ret = usb_control_msg(bus_adap->usb_dev,
 				      usb_sndctrlpipe(bus_adap->usb_dev, 0),
 				      AS102_USB_DEVICE_TX_CTRL_CMD,
-				      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+				      USB_DIR_OUT | USB_TYPE_VENDOR |
+				      USB_RECIP_DEVICE,
 				      bus_adap->cmd_xid, /* value */
 				      0, /* index */
 				      send_buf, send_buf_len,
 				      USB_CTRL_SET_TIMEOUT /* 200 */);
-		if(ret < 0) {
+		if (ret < 0) {
 			dprintk(debug, "usb_control_msg(send) failed, err %i\n",
 					ret);
 			return ret;
 		}
 
-		if(ret != send_buf_len) {
+		if (ret != send_buf_len) {
 			dprintk(debug, "only wrote %d of %d bytes\n",
 					ret, send_buf_len);
 			return -1;
 		}
 	}
 
-	if(recv_buf != NULL) {
+	if (recv_buf != NULL) {
 #ifdef TRACE
 		dprintk(debug, "want to read: %d bytes\n", recv_buf_len);
 #endif
 		ret = usb_control_msg(bus_adap->usb_dev,
 				      usb_rcvctrlpipe(bus_adap->usb_dev, 0),
 				      AS102_USB_DEVICE_RX_CTRL_CMD,
-				      USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+				      USB_DIR_IN | USB_TYPE_VENDOR |
+				      USB_RECIP_DEVICE,
 				      bus_adap->cmd_xid, /* value */
 				      0, /* index */
 				      recv_buf, recv_buf_len,
 				      USB_CTRL_GET_TIMEOUT /* 200 */);
-		if(ret < 0) {
+		if (ret < 0) {
 			dprintk(debug, "usb_control_msg(recv) failed, err %i\n",
 					ret);
 			return ret;
@@ -119,18 +122,19 @@
 static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap,
 			  unsigned char *send_buf,
 			  int send_buf_len,
-			  int swap32) {
-
+			  int swap32)
+{
 	int ret = 0, actual_len;
 
-	ret = usb_bulk_msg(bus_adap->usb_dev, usb_sndbulkpipe(bus_adap->usb_dev, 1),
+	ret = usb_bulk_msg(bus_adap->usb_dev,
+			   usb_sndbulkpipe(bus_adap->usb_dev, 1),
 			   send_buf, send_buf_len, &actual_len, 200);
-	if(ret) {
+	if (ret) {
 		dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret);
 		return ret;
 	}
 
-	if(actual_len != send_buf_len) {
+	if (actual_len != send_buf_len) {
 		dprintk(debug, "only wrote %d of %d bytes\n",
 				actual_len, send_buf_len);
 		return -1;
@@ -139,21 +143,22 @@
 }
 
 static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap,
-		   unsigned char *recv_buf, int recv_buf_len) {
-
+		   unsigned char *recv_buf, int recv_buf_len)
+{
 	int ret = 0, actual_len;
 
-	if(recv_buf == NULL)
+	if (recv_buf == NULL)
 		return -EINVAL;
 
-	ret = usb_bulk_msg(bus_adap->usb_dev, usb_rcvbulkpipe(bus_adap->usb_dev, 2),
+	ret = usb_bulk_msg(bus_adap->usb_dev,
+			   usb_rcvbulkpipe(bus_adap->usb_dev, 2),
 			   recv_buf, recv_buf_len, &actual_len, 200);
-	if(ret) {
+	if (ret) {
 		dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret);
 		return ret;
 	}
 
-	if(actual_len != recv_buf_len) {
+	if (actual_len != recv_buf_len) {
 		dprintk(debug, "only read %d of %d bytes\n",
 				actual_len, recv_buf_len);
 		return -1;
@@ -169,7 +174,8 @@
 	.stop_stream	= as102_usb_stop_stream,
 };
 
-static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) {
+static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb)
+{
 	int err;
 
 	usb_fill_bulk_urb(urb,
@@ -180,8 +186,9 @@
 			  as102_urb_stream_irq,
 			  dev);
 
-	if ((err = usb_submit_urb(urb, GFP_ATOMIC)))
-		dprintk(debug, "%s: usb_submit_urb failed\n", __FUNCTION__);
+	err = usb_submit_urb(urb, GFP_ATOMIC);
+	if (err)
+		dprintk(debug, "%s: usb_submit_urb failed\n", __func__);
 
 	return err;
 }
@@ -203,7 +210,7 @@
 		/* do nothing ? */
 #endif
 	} else {
-		if(urb->actual_length == 0)
+		if (urb->actual_length == 0)
 			memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE);
 	}
 
@@ -212,7 +219,8 @@
 		as102_submit_urb_stream(as102_dev, urb);
 }
 
-static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) {
+static void as102_free_usb_stream_buffer(struct as102_dev_t *dev)
+{
 	int i;
 
 	ENTER();
@@ -227,7 +235,8 @@
 	LEAVE();
 }
 
-static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) {
+static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev)
+{
 	int i, ret = 0;
 
 	ENTER();
@@ -237,7 +246,7 @@
 				       GFP_KERNEL,
 				       &dev->dma_addr);
 	if (!dev->stream) {
-		dprintk(debug, "%s: usb_buffer_alloc failed\n", __FUNCTION__);
+		dprintk(debug, "%s: usb_buffer_alloc failed\n", __func__);
 		return -ENOMEM;
 	}
 
@@ -247,8 +256,9 @@
 	for (i = 0; i < MAX_STREAM_URB; i++) {
 		struct urb *urb;
 
-		if (!(urb = usb_alloc_urb(0, GFP_ATOMIC))) {
-			dprintk(debug, "%s: usb_alloc_urb failed\n", __FUNCTION__);
+		urb = usb_alloc_urb(0, GFP_ATOMIC);
+		if (urb == NULL) {
+			dprintk(debug, "%s: usb_alloc_urb failed\n", __func__);
 			as102_free_usb_stream_buffer(dev);
 			return -ENOMEM;
 		}
@@ -262,18 +272,21 @@
 	return ret;
 }
 
-static void as102_usb_stop_stream(struct as102_dev_t *dev) {
+static void as102_usb_stop_stream(struct as102_dev_t *dev)
+{
 	int i;
 
 	for (i = 0; i < MAX_STREAM_URB; i++)
 		usb_kill_urb(dev->stream_urb[i]);
 }
 
-static int as102_usb_start_stream(struct as102_dev_t *dev) {
+static int as102_usb_start_stream(struct as102_dev_t *dev)
+{
 	int i, ret = 0;
 
 	for (i = 0; i < MAX_STREAM_URB; i++) {
-		if ((ret = as102_submit_urb_stream(dev, dev->stream_urb[i]))) {
+		ret = as102_submit_urb_stream(dev, dev->stream_urb[i]);
+		if (ret) {
 			as102_usb_stop_stream(dev);
 			return ret;
 		}
@@ -282,7 +295,8 @@
 	return 0;
 }
 
-static void as102_usb_release(struct kref *kref) {
+static void as102_usb_release(struct kref *kref)
+{
 	struct as102_dev_t *as102_dev;
 
 	ENTER();
@@ -296,7 +310,8 @@
 	LEAVE();
 }
 
-static void as102_usb_disconnect(struct usb_interface *intf) {
+static void as102_usb_disconnect(struct usb_interface *intf)
+{
 	struct as102_dev_t *as102_dev;
 
 	ENTER();
@@ -324,14 +339,16 @@
 }
 
 static int as102_usb_probe(struct usb_interface *intf,
-			   const struct usb_device_id *id) {
+			   const struct usb_device_id *id)
+{
 	int ret;
 	struct as102_dev_t *as102_dev;
 
 	ENTER();
 
-	if(!(as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL))) {
-		err("%s: kzalloc failed", __FUNCTION__);
+	as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL);
+	if (as102_dev == NULL) {
+		err("%s: kzalloc failed", __func__);
 		return -ENOMEM;
 	}
 
@@ -352,17 +369,19 @@
 	as102_dev->bus_adap.usb_dev = usb_get_dev(interface_to_usbdev(intf));
 
 	/* we can register the device now, as it is ready */
-	if((ret = usb_register_dev(intf, &as102_usb_class_driver)) < 0) {;
+	ret = usb_register_dev(intf, &as102_usb_class_driver);
+	if (ret < 0) {
 		/* something prevented us from registering this driver */
 		err("%s: usb_register_dev() failed (errno = %d)",
-		    __FUNCTION__, ret);
+		    __func__, ret);
 		goto failed;
 	}
 
 	printk(KERN_INFO "%s: device has been detected\n", DRIVER_NAME);
 
 	/* request buffer allocation for streaming */
-	if ((ret = as102_alloc_usb_stream_buffer(as102_dev)) != 0)
+	ret = as102_alloc_usb_stream_buffer(as102_dev);
+	if (ret != 0)
 		goto failed;
 
 	/* register dvb layer */
@@ -377,7 +396,8 @@
 	return ret;
 }
 
-static int as102_open(struct inode *inode, struct file *file) {
+static int as102_open(struct inode *inode, struct file *file)
+{
 	int ret = 0, minor = 0;
 	struct usb_interface *intf = NULL;
 	struct as102_dev_t *dev = NULL;
@@ -388,15 +408,17 @@
 	minor = iminor(inode);
 
 	/* fetch device from usb interface */
-	if((intf = usb_find_interface(&as102_usb_driver, minor)) == NULL) {
+	intf = usb_find_interface(&as102_usb_driver, minor);
+	if (intf == NULL) {
 		printk(KERN_ERR "%s: can't find device for minor %d\n",
-				__FUNCTION__, minor);
+				__func__, minor);
 		ret = -ENODEV;
 		goto exit;
 	}
 
 	/* get our device */
-	if((dev = usb_get_intfdata(intf)) == NULL) {
+	dev = usb_get_intfdata(intf);
+	if (dev == NULL) {
 		ret = -EFAULT;
 		goto exit;
 	}
@@ -412,13 +434,15 @@
 	return ret;
 }
 
-static int as102_release(struct inode *inode, struct file *file) {
+static int as102_release(struct inode *inode, struct file *file)
+{
 	int ret = 0;
 	struct as102_dev_t *dev = NULL;
 
 	ENTER();
 
-	if((dev = file->private_data) != NULL ) {
+	dev = file->private_data;
+	if (dev != NULL) {
 		/* decrement the count on our device */
 		kref_put(&dev->kref, as102_usb_release);
 	}
diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/media/dvb/as102/as102_usb_drv.h
--- linux/drivers/staging/media/as102/as102_usb_drv.h
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.h
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
+ * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,8 +36,6 @@
 #define PCTV_74E_USB_VID		0x2013
 #define PCTV_74E_USB_PID		0x0246
 
-extern struct file_operations as102_dev_fops;
-
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
 void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
 #else

  reply	other threads:[~2011-10-18 19:57 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-25 12:33 Problems cloning the git repostories Patrick Dickey
2011-09-25 13:55 ` Devin Heitmueller
2011-09-26  3:25   ` Mauro Carvalho Chehab
2011-09-27  2:20     ` Devin Heitmueller
2011-09-27  7:44       ` Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) Stefan Richter
2011-09-27 17:43         ` Greg KH
2011-09-27 19:33           ` Stefan Richter
2011-10-15 20:54             ` [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup (was: Staging submission: PCTV 80e and PCTV 74e drivers) Piotr Chmura
2011-10-17 22:31               ` Greg KH
2011-10-19 12:36                 ` Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup Patrick Dickey
2011-10-19 13:57                   ` Devin Heitmueller
2011-10-20  3:44                     ` Mauro Carvalho Chehab
2011-10-20 10:53                       ` Patrick Dickey
2011-10-20 11:22                         ` Mauro Carvalho Chehab
     [not found]             ` <4E999733.2010802@poczta.onet.pl>
2011-10-15 20:54               ` [PATCH 1/7] Staging submission: PCTV 74e driver (as102) Piotr Chmura
2011-10-16  8:57                 ` Stefan Richter
2011-10-16 11:45                   ` Devin Heitmueller
2011-10-16 13:44                     ` Mauro Carvalho Chehab
2011-10-18  9:10                       ` [PATCH 0/14] staging/media/as102: new driver submission (was " Piotr Chmura
2011-10-18 15:52                         ` Devin Heitmueller
2011-10-18 17:20                           ` Piotr Chmura
2011-10-19 11:41                             ` Javier Martinez Canillas
2011-10-19 11:44                               ` Mauro Carvalho Chehab
2011-10-19 13:07                                 ` Piotr Chmura
     [not found]                       ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl>
2011-10-18  9:11                         ` [PATCH 1/14] staging/media/as102: initial import from Abilis Piotr Chmura
2011-10-18 16:24                           ` Dan Carpenter
2011-10-18 16:38                             ` Mauro Carvalho Chehab
2011-10-18 22:33                               ` Dan Carpenter
2011-10-18 19:46                           ` [RESEND PATCH " Piotr Chmura
2011-10-30 21:03                             ` Piotr Chmura
2011-10-30 21:25                               ` Stefan Richter
2011-10-31 10:24                               ` Sylwester Nawrocki
2011-10-18  9:11                         ` [PATCH 2/14] staging/media/as102: checkpatch fixes Piotr Chmura
2011-10-18 19:48                           ` [RESEND PATCH " Piotr Chmura
2011-10-18  9:11                         ` [PATCH 3/14] " Piotr Chmura
2011-10-18 19:50                           ` [RESEND PATCH " Piotr Chmura
2011-10-18  9:11                         ` [PATCH 4/14] " Piotr Chmura
2011-10-18 19:51                           ` [RESEND PATCH " Piotr Chmura
2011-10-29 10:22                             ` Sylwester Nawrocki
2011-10-29 13:17                               ` Piotr Chmura
2011-10-29 16:14                                 ` Sylwester Nawrocki
2011-10-29 17:48                                   ` Piotr Chmura
2011-10-29 21:37                                     ` Sylwester Nawrocki
2011-10-30  7:11                                       ` [PATCH v3 " Piotr Chmura
2011-10-30 11:17                                         ` Stefan Richter
2011-10-31 10:48                                           ` Stefan Richter
2011-10-31 11:47                                             ` Mauro Carvalho Chehab
2011-10-29 16:25                                 ` [RESEND PATCH " Piotr Chmura
2011-10-29 16:39                                   ` Sylwester Nawrocki
2011-10-29 17:00                                     ` Dan Carpenter
2011-10-18  9:11                         ` [PATCH 5/14] " Piotr Chmura
2011-10-18 19:54                           ` [RESEND PATCH " Piotr Chmura
2011-10-30 13:53                             ` [PATCH v3 " Piotr Chmura
2011-10-18  9:12                         ` [PATCH 6/14] " Piotr Chmura
2011-10-18 19:56                           ` [RESEND PATCH " Piotr Chmura
2011-10-18  9:12                         ` [PATCH 7/14] " Piotr Chmura
2011-10-18 19:57                           ` Piotr Chmura [this message]
2011-10-18  9:12                         ` [PATCH 8/14] " Piotr Chmura
2011-10-18 19:58                           ` [RESEND PATCH " Piotr Chmura
2011-10-18  9:12                         ` [PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe Piotr Chmura
2011-10-18 19:59                           ` [RESEND PATCH " Piotr Chmura
2011-10-18  9:12                         ` [PATCH 10/14] staging/media/as102: properly handle multiple product names Piotr Chmura
2011-10-18 20:02                           ` [RESEND PATCH " Piotr Chmura
2011-10-18 20:28                             ` Joe Perches
2011-10-18 20:54                               ` Piotr Chmura
2011-10-18 20:56                                 ` Greg KH
2011-10-18 20:58                                 ` Joe Perches
2011-10-18  9:13                         ` [PATCH 11/14] staging/media/as102: fix compile warning about unused function Piotr Chmura
2011-10-18 20:03                           ` [RESEND PATCH " Piotr Chmura
2011-10-30 20:04                             ` Sylwester Nawrocki
2011-10-30 21:15                               ` Stefan Richter
2011-10-18  9:13                         ` [PATCH 12/14] staging/media/as102: fix licensing oversight Piotr Chmura
2011-10-18 20:05                           ` [RESEND PATCH " Piotr Chmura
2011-10-18  9:13                         ` [PATCH 13/14] staging/media/as102: fix compile Piotr Chmura
2011-10-18  9:13                         ` [PATCH 14/14] staging/media/as102: add nBox Tuner Dongle support Piotr Chmura
2011-10-15 20:55               ` [PATCH 6/7] staging/as102: cleanup - get rid of editor comments Piotr Chmura
2011-10-15 20:55               ` [PATCH 7/7] staging/as102: cleanup - get rid unnecessary LINUX and WIN32 defines Piotr Chmura
     [not found]             ` <4E9992F9.7000101@poczta.onet.pl>
2011-10-15 20:54               ` [PATCH 2/7] staging/as102: add new device nBox DVB-T Dongle Piotr Chmura
2011-10-15 20:54               ` [PATCH 3/7] staging/as102: cleanup - get rid of typedefs Piotr Chmura
2011-10-15 20:54               ` [PATCH 4/7] staging/as102: cleanup - formatting code Piotr Chmura
2011-10-16 12:23                 ` Julian Andres Klode
2011-10-16 12:40                   ` Devin Heitmueller
2011-10-16 21:53                     ` Dan Carpenter
2011-10-15 20:54               ` [PATCH 5/7] staging as102: cleanup - get rid of pragma(pack) Piotr Chmura
2011-10-30 21:09   ` Problems cloning the git repostories Marek Vasut
2011-09-25 14:53 ` Anca Emanuel
2011-09-25 18:03 ` Johannes Stezenbach
2011-09-26  2:56   ` Mauro Carvalho Chehab
2011-09-26 10:15     ` Scott Jiang
2011-09-26 19:24       ` Johannes Stezenbach
2011-09-26 11:27     ` Patrick Dickey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111018215730.0442fe23@darkstar \
    --to=chmooreck@poczta.onet.pl \
    --cc=devel@driverdev.osuosl.org \
    --cc=dheitmueller@kernellabs.com \
    --cc=gregkh@suse.de \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=pdickeybeta@gmail.com \
    --cc=stefanr@s5r6.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox