rpms/kernel/devel linux-2.6-lirc.patch,1.2,1.3

Jarod Wilson (jwilson) fedora-extras-commits at redhat.com
Thu Sep 13 18:17:46 UTC 2007


Author: jwilson

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18414

Modified Files:
	linux-2.6-lirc.patch 
Log Message:
Updated and massively cleaned up lirc patch, eliminates 99% of checkpatch.pl's complaints about the code (most of which is soon to be committed in upstream lirc as well)

linux-2.6-lirc.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.3 linux-2.6-lirc.patch
Index: linux-2.6-lirc.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-lirc.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-lirc.patch	27 Aug 2007 22:19:13 -0000	1.2
+++ linux-2.6-lirc.patch	13 Sep 2007 18:17:42 -0000	1.3
@@ -1,22 +1,3 @@
-This patch adds the lirc drivers for assorted infrared and RF receivers
-and transmitters, which when coupled with the lirc daemon and appropriate
-config files, lets you control your linux box via a remote control. Very
-useful stuff for media center boxes...
-
-Upstream
---------
-http://www.lirc.org/
-
-Work-in-progress for upstream
------------------------------
-http://git.wilsonet.com/linux-2.6-lirc.git/
-
-
--- 
-Jarod Wilson
-jwilson at redhat.com
-
-
 diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
 index 2d87357..61fd0ca 100644
 --- a/drivers/input/Kconfig
@@ -204,10 +185,10 @@
 +obj-$(CONFIG_LIRC_TTUSBIR)	+= lirc_ttusbir.o
 diff --git a/drivers/input/lirc/commandir.c b/drivers/input/lirc/commandir.c
 new file mode 100644
-index 0000000..8af8da6
+index 0000000..32f46aa
 --- /dev/null
 +++ b/drivers/input/lirc/commandir.c
-@@ -0,0 +1,986 @@
+@@ -0,0 +1,999 @@
 +
 +/*
 + *
@@ -233,7 +214,7 @@
 +#include "commandir.h"
 +
 +#include <linux/kref.h>
-+#include <asm/uaccess.h>
++#include <linux/uaccess.h>
 +
 +#define DRIVER_VERSION "v1.1.2"
 +#define DRIVER_AUTHOR "Evelyn Yeung, InnovationOne"
@@ -244,65 +225,69 @@
 +#define USB_CMDIR_MINOR_BASE	192
 +
 +/* table of devices that work with this driver */
-+static struct usb_device_id cmdir_table [] = 
++static struct usb_device_id cmdir_table [] =
 +{
 +	{ USB_DEVICE(USB_CMDIR_VENDOR_ID, USB_CMDIR_PRODUCT_ID) },
 +	{ }			/* Terminating entry */
 +};
-+MODULE_DEVICE_TABLE (usb, cmdir_table);
++MODULE_DEVICE_TABLE(usb, cmdir_table);
 +
-+static int cmdir_open (struct inode *inode, struct file *file);
-+static int cmdir_probe(struct usb_interface *interface, const struct usb_device_id *id);
++static int cmdir_open(struct inode *inode, struct file *file);
++static int cmdir_probe(struct usb_interface *interface,
++		       const struct usb_device_id *id);
 +static void cmdir_disconnect(struct usb_interface *interface);
-+static int cmdir_release (struct inode *inode, struct file *file);
-+static int cmdir_check (int device_num);
-+static void init_cmdir_var (int device_num);
-+static void reset_cmdir (int device_num);
-+static void update_cmdir_string (int device_num);
-+static void print_cmdir (int device_num);
-+static ssize_t cmdir_file_read (struct file *file, char *buffer, size_t count, loff_t *ppos);
-+ssize_t cmdir_read (unsigned char *buffer, int count);
-+static ssize_t cmdir_file_write (struct file *file, const char *buffer, size_t count, loff_t *ppos);
++static int cmdir_release(struct inode *inode, struct file *file);
++static int cmdir_check(int device_num);
++static void init_cmdir_var(int device_num);
++static void reset_cmdir(int device_num);
++static void update_cmdir_string(int device_num);
++static void print_cmdir(int device_num);
++static ssize_t cmdir_file_read(struct file *file, char *buffer,
++			       size_t count, loff_t *ppos);
++ssize_t cmdir_read(unsigned char *buffer, size_t count);
++static ssize_t cmdir_file_write(struct file *file, const char *buffer,
++				size_t count, loff_t *ppos);
 +int cmdir_write(unsigned char *buffer, int count, void *callback_fct, int u);
-+int write_core(unsigned char *buffer, int count, void *callback_fct, int device_num);
-+static void cmdir_write_bulk_callback(struct urb *urb);
-+int set_tx_channels (unsigned int next_tx);
++int write_core(unsigned char *buffer, int count,
++	       void *callback_fct, int device_num);
++static void cmdir_write_bulk_callback(struct urb *urb, struct pt_regs *regs);
++int set_tx_channels(unsigned int next_tx);
 +
-+int add_cmdir_queue(unsigned char *buffer, int count, void *callback_vct, int usecdelay);
++int add_cmdir_queue(unsigned char *buffer, int count,
++		    void *callback_vct, int usecdelay);
 +int cmdir_write_queue(unsigned char *buffer, int count, void *callback_vct);
 +int send_queue(void);
 +int wait_to_tx(int usecs);
 +
-+// circular packet queue
++/* circular packet queue */
 +unsigned char ourbuffers[QUEUELENGTH][64];
 +int waitusecs[QUEUELENGTH];
 +int ourbufferlengths[QUEUELENGTH];
-+int nexttosend = 0;
-+int nexttofill = 0;
++int nexttosend;
++int nexttofill;
 +int send_status = SEND_IDLE;
-+int last_tx_sec = 0;
-+int last_tx_usec = 0; 
++int last_tx_sec;
++int last_tx_usec;
 +
-+static int curTXFill = 0;
-+struct timeval tp; 
++static int curTXFill;
++struct timeval tp;
 +
-+int debug_commandir=0;
++int debug_commandir;
 +
 +/* Structure to hold all of our device specific stuff */
-+struct usb_skel 
++struct usb_skel
 +{
-+	struct usb_device *	udev;			/* the usb device for this device */
-+	struct usb_interface *	interface;		/* the interface for this device */
-+	unsigned char *		bulk_in_buffer;		/* the buffer to receive data */
-+	int			bulk_in_size;		/* the size of the receive buffer */
-+	__u8			bulk_in_endpointAddr;	/* the address of the bulk in endpoint */
-+	__u8			bulk_out_endpointAddr;	/* the address of the bulk out endpoint */
-+	struct kref		kref;
++	struct usb_device *udev; /* the usb device for this device */
++	struct usb_interface *interface; /* the interface for this device */
++	unsigned char *bulk_in_buffer; /* the buffer to receive data */
++	size_t bulk_in_size; /* the size of the receive buffer */
++	__u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */
++	__u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */
++	struct kref kref;
 +};
 +#define to_skel_dev(d) container_of(d, struct usb_skel, kref)
 +
-+static struct file_operations cmdir_fops = 
-+{
++static struct file_operations cmdir_fops = {
 +	.read =		cmdir_file_read,
 +	.write =	cmdir_file_write,
 +	.open =		cmdir_open,
@@ -311,42 +296,42 @@
 +
 +/* usb class driver info in order to get a minor number from the usb core,
 + * and to have the device registered with devfs and the driver core */
-+static struct usb_class_driver cmdir_class = 
-+{
++static struct usb_class_driver cmdir_class = {
 +	.name =		"usb/commandir%d",
 +	.fops =		&cmdir_fops,
-+	//.mode =		S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
++	/* .mode =	S_IFCHR | S_IRUSR | S_IWUSR |
++	 *		S_IRGRP | S_IWGRP | S_IROTH, */
 +	.minor_base =	USB_CMDIR_MINOR_BASE,
 +};
 +
-+static struct usb_driver cmdir_driver = 
-+{
++static struct usb_driver cmdir_driver = {
 +	.name =		"commandir",
 +	.probe =	cmdir_probe,
 +	.disconnect =	cmdir_disconnect,
 +	.id_table =	cmdir_table,
 +};
 +
-+static int lcd_device=0;
-+static int rx_device=0;
-+static int def_device=0;
++
++static int lcd_device;
++static int rx_device;
++static int def_device;
 +
 +#define DEFAULT_TRANSMITTERS 0x0F
-+static unsigned int transmitters=DEFAULT_TRANSMITTERS;
-+static unsigned int next_transmitters=DEFAULT_TRANSMITTERS;
++static unsigned int transmitters = DEFAULT_TRANSMITTERS;
++static unsigned int next_transmitters = DEFAULT_TRANSMITTERS;
 +
 +#define CMDIR_VAR_LEN 68
-+static char cmdir_var[] = 
-+"COMMANDIRx:\n TX Enabled: 1, 2, 3, 4\n RX: commandirx\n LCD: commandirx"; 
++static char cmdir_var[] =
[...15104 lines suppressed...]
 +	/*
 +	 * unregister from the LIRC sub-system
 +	 */
 +
-+        if (( errnum = lirc_unregister_plugin( sz->plugin.minor )) != 0) {
-+
-+                dprintk("error in lirc_unregister: (returned %d)",
-+			sz->plugin.minor, errnum );
-+        }
++	errnum = lirc_unregister_plugin(sz->plugin.minor);
++	if (errnum != 0)
++		dprintk("error in lirc_unregister: (returned %d)",
++			sz->plugin.minor, errnum);
 +
 +	lirc_buffer_free(&sz->delay_buf);
 +	lirc_buffer_free(&sz->lirc_buf);
@@ -17680,31 +17621,29 @@
 +	 * unregister from the USB sub-system
 +	 */
 +
-+	usb_free_urb( sz->urb_in );
++	usb_free_urb(sz->urb_in);
 +
-+        usb_buffer_free( sz->udev , sz->buf_in_len, sz->buf_in, sz->dma_in );
++	usb_buffer_free(sz->udev, sz->buf_in_len, sz->buf_in, sz->dma_in);
 +
 +	minor = sz->plugin.minor;
-+	kfree( sz );
++	kfree(sz);
 +
-+        printk(KERN_INFO DRIVER_NAME "[%d]: disconnected\n", minor);
++	printk(KERN_INFO DRIVER_NAME "[%d]: disconnected\n", minor);
 +}
 +
 +static int streamzap_suspend(struct usb_interface *intf, pm_message_t message)
 +{
 +	struct usb_streamzap *sz = usb_get_intfdata(intf);
-+	
++
 +	printk(DRIVER_NAME "[%d]: suspend\n", sz->plugin.minor);
-+	if(sz->in_use)
-+	{
-+		if(sz->flush)
-+		{
++	if (sz->in_use) {
++		if (sz->flush) {
 +			sz->flush = 0;
 +			del_timer_sync(&sz->flush_timer);
 +		}
-+		
++
 +		stop_timer(sz);
-+		
++
 +		usb_kill_urb(sz->urb_in);
 +	}
 +	return 0;
@@ -17713,21 +17652,19 @@
 +static int streamzap_resume(struct usb_interface *intf)
 +{
 +	struct usb_streamzap *sz = usb_get_intfdata(intf);
-+	
-+	while(!lirc_buffer_empty(&sz->lirc_buf))
++
++	while (!lirc_buffer_empty(&sz->lirc_buf))
 +		lirc_buffer_remove_1(&sz->lirc_buf);
-+	while(!lirc_buffer_empty(&sz->delay_buf))
++	while (!lirc_buffer_empty(&sz->delay_buf))
 +		lirc_buffer_remove_1(&sz->delay_buf);
-+		
-+	if(sz->in_use)
-+	{
++
++	if (sz->in_use) {
 +		sz->flush_timer.expires = jiffies + HZ;
 +		sz->flush = 1;
 +		add_timer(&sz->flush_timer);
 +
 +		sz->urb_in->dev = sz->udev;
-+		if (usb_submit_urb(sz->urb_in, GFP_ATOMIC))
-+		{
++		if (usb_submit_urb(sz->urb_in, GFP_ATOMIC)) {
 +			dprintk("open result = -EIO error submitting urb",
 +				sz->plugin.minor);
 +			MOD_DEC_USE_COUNT;
@@ -17748,7 +17685,7 @@
 +
 +	/* register this driver with the USB subsystem */
 +
-+	result = usb_register( &streamzap_driver );
++	result = usb_register(&streamzap_driver);
 +
 +	if (result) {
 +		err("usb_register failed. Error number %d",
@@ -17770,8 +17707,8 @@
 +}
 +
 +
-+module_init (usb_streamzap_init);
-+module_exit (usb_streamzap_exit);
++module_init(usb_streamzap_init);
++module_exit(usb_streamzap_exit);
 +
 +MODULE_AUTHOR("Christoph Bartelmus, Greg Wickham, Adrian Dewhurst");
 +MODULE_DESCRIPTION(DRIVER_DESC);
@@ -17785,10 +17722,10 @@
 +#endif /* MODULE */
 diff --git a/drivers/input/lirc/lirc_ttusbir.c b/drivers/input/lirc/lirc_ttusbir.c
 new file mode 100644
-index 0000000..b4fbde3
+index 0000000..b80dbf8
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_ttusbir.c
-@@ -0,0 +1,343 @@
+@@ -0,0 +1,361 @@
 +/****************************************************************************
 + ** lirc_ttusbir.c ***********************************************************
 + ****************************************************************************
@@ -17812,6 +17749,7 @@
 + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 + *
 + */
++#include <linux/version.h>
 +#include <linux/kernel.h>
 +#include <linux/init.h>
 +#include <linux/module.h>
@@ -17830,7 +17768,7 @@
 +/* @TODO Is it enough to have only two, I guess yes */
 +#define NUM_URBS 4 /* Number of URBs used in the queue */
 +
-+#undef DEBUG
++/* #define DEBUG */
 +#ifdef DEBUG
 +#define DPRINTK printk
 +#else
@@ -17917,22 +17855,38 @@
 + */
 +const unsigned char map_table[] =
 +{
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-+	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-+	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
++	0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
++	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
++	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
++	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
 +};
 +
 +static void urb_complete(struct urb *urb)
@@ -17986,7 +17940,8 @@
 +
 +	DPRINTK("Module ttusbir probe\n");
 +
-+	ttusbir = (struct ttusbir_device *)kzalloc(sizeof(struct ttusbir_device), GFP_KERNEL);
++	ttusbir = (struct ttusbir_device *)
++		  kzalloc(sizeof(struct ttusbir_device), GFP_KERNEL);
 +	if (!ttusbir)
 +		return -ENOMEM;
 +	ttusbir->driver = &driver;




More information about the fedora-extras-commits mailing list