From patchwork Mon Jul 2 06:58:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 1145751 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 20052DFFAD for ; Mon, 2 Jul 2012 06:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754272Ab2GBG62 (ORCPT ); Mon, 2 Jul 2012 02:58:28 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:41850 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750963Ab2GBG61 (ORCPT ); Mon, 2 Jul 2012 02:58:27 -0400 Received: by dady13 with SMTP id y13so6996954dad.19 for ; Sun, 01 Jul 2012 23:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding:x-mailer:thread-index:content-language; bh=8quOdbq6cYSsuKgo6Kbd0DFscD4vQTjH40WLdPN7MKg=; b=MGFkFsd+98tz9Xqk4X14MbRUNI+GFA2ksQLa5vdXtMQSkFgMBa7QmJuWbSXky8LdBL 2BS8DqRgjGUiiHNB5d827atiiXiz3A6EWlz0V+VuOnRVPWeM96watLdnVkmtkshJvyrI GmtpeAYFifyalCMeed9N0YPMQVKcYTVK+e7AdIfJUVT8bHh5g6bsN7Pg4ZjsRmn0k3hc ZM1Xw3W1fdfda48NxkP9GX2MoKOhl8vbL5YFN01JF3s1Q0aHfWw0LC6NGoBG9n07zeS7 yXF5YS0R0OUuoE4xV2OQB1KHtf8OWPxpdZxVhdH7hDSJ4t7EMOskV74C8inpX33B22nB XsyQ== Received: by 10.68.220.163 with SMTP id px3mr27626196pbc.167.1341212306827; Sun, 01 Jul 2012 23:58:26 -0700 (PDT) Received: from CHANGBIXMOBL (shzdmzpr01-ext.sh.intel.com. [192.102.204.36]) by mx.google.com with ESMTPS id rg10sm12297482pbc.54.2012.07.01.23.58.23 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Jul 2012 23:58:25 -0700 (PDT) From: "Du, Changbin" To: Cc: , , , Subject: [PATCH 1/1] media: rc: ati_remote.c: code style and compile warning fixing Date: Mon, 2 Jul 2012 14:58:18 +0800 Message-ID: <4ff14691.0ae1440a.54a9.3331@mx.google.com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AQHNWB3jxnUwkK7da0yfBKvOGpyYdpcVjbgQgAAA42A= Content-Language: zh-cn Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org changes: 1. break some lines that are longer than 80 characters. 2. remove local function prototype declarations which do not need. 3. replace TAB character with a space character in function comments. 4. change the types of array init1[] and init2[] to "unsigned char" to avoid compile warning. Signed-off-by: Du, Changbin --- drivers/media/rc/ati_remote.c | 139 +++++++++++++++++++++++++---------------- 1 file changed, 84 insertions(+), 55 deletions(-) * @@ -147,7 +149,8 @@ static bool mouse = true; module_param(mouse, bool, 0444); MODULE_PARM_DESC(mouse, "Enable mouse device, default = yes"); -#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) +#define dbginfo(dev, format, arg...) \ + do { if (debug) dev_info(dev , format , ## arg); } while (0) #undef err #define err(format, arg...) printk(KERN_ERR format , ## arg) @@ -191,17 +194,41 @@ static const char *get_medion_keymap(struct usb_interface *interface) return RC_MAP_MEDION_X10; } -static const struct ati_receiver_type type_ati = { .default_keymap = RC_MAP_ATI_X10 }; -static const struct ati_receiver_type type_medion = { .get_default_keymap = get_medion_keymap }; -static const struct ati_receiver_type type_firefly = { .default_keymap = RC_MAP_SNAPSTREAM_FIREFLY }; +static const struct ati_receiver_type type_ati = { + .default_keymap = RC_MAP_ATI_X10 +}; +static const struct ati_receiver_type type_medion = { + .get_default_keymap = get_medion_keymap +}; +static const struct ati_receiver_type type_firefly = { + .default_keymap = RC_MAP_SNAPSTREAM_FIREFLY +}; static struct usb_device_id ati_remote_table[] = { - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_medion }, - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_firefly }, + { + USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID), + .driver_info = (unsigned long)&type_ati + }, + { + USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID), + .driver_info = (unsigned long)&type_ati + }, + { + USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID), + .driver_info = (unsigned long)&type_ati + }, + { + USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID), + .driver_info = (unsigned long)&type_ati + }, + { + USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID), + .driver_info = (unsigned long)&type_medion + }, + { + USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID), + .driver_info = (unsigned long)&type_firefly + }, {} /* Terminating entry */ }; @@ -215,8 +242,8 @@ MODULE_DEVICE_TABLE(usb, ati_remote_table); #define SEND_FLAG_COMPLETE 2 /* Device initialization strings */ -static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; -static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; +static unsigned char init1[] = { 0x01, 0x00, 0x20, 0x14 }; +static unsigned char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; struct ati_remote { struct input_dev *idev; @@ -296,25 +323,8 @@ static const struct { {KIND_END, 0x00, EV_MAX + 1, 0, 0} }; -/* Local function prototypes */ -static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data); -static void ati_remote_irq_out (struct urb *urb); -static void ati_remote_irq_in (struct urb *urb); -static void ati_remote_input_report (struct urb *urb); -static int ati_remote_initialize (struct ati_remote *ati_remote); -static int ati_remote_probe (struct usb_interface *interface, const struct usb_device_id *id); -static void ati_remote_disconnect (struct usb_interface *interface); - -/* usb specific object to register with the usb subsystem */ -static struct usb_driver ati_remote_driver = { - .name = "ati_remote", - .probe = ati_remote_probe, - .disconnect = ati_remote_disconnect, - .id_table = ati_remote_table, -}; - /* - * ati_remote_dump_input + * ati_remote_dump_input */ static void ati_remote_dump(struct device *dev, unsigned char *data, unsigned int len) @@ -326,12 +336,14 @@ static void ati_remote_dump(struct device *dev, unsigned char *data, dev_warn(dev, "Weird key %02x %02x %02x %02x\n", data[0], data[1], data[2], data[3]); else - dev_warn(dev, "Weird data, len=%d %02x %02x %02x %02x %02x %02x ...\n", - len, data[0], data[1], data[2], data[3], data[4], data[5]); + dev_warn(dev, + "Weird data, len=%d %02x %02x %02x %02x %02x %02x ...\n", + len, data[0], data[1], data[2], data[3], data[4], + data[5]); } /* - * ati_remote_open + * ati_remote_open */ static int ati_remote_open(struct ati_remote *ati_remote) { @@ -355,7 +367,7 @@ out: mutex_unlock(&ati_remote->open_mutex); } /* - * ati_remote_close + * ati_remote_close */ static void ati_remote_close(struct ati_remote *ati_remote) { @@ -390,7 +402,7 @@ static void ati_remote_rc_close(struct rc_dev *rdev) } /* - * ati_remote_irq_out + * ati_remote_irq_out */ static void ati_remote_irq_out(struct urb *urb) { @@ -408,11 +420,12 @@ static void ati_remote_irq_out(struct urb *urb) } /* - * ati_remote_sendpacket + * ati_remote_sendpacket * - * Used to send device initialization strings + * Used to send device initialization strings */ -static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigned char *data) +static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, + unsigned char *data) { int retval = 0; @@ -441,7 +454,7 @@ static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigne } /* - * ati_remote_compute_accel + * ati_remote_compute_accel * * Implements acceleration curve for directional control pad * If elapsed time since last event is > 1/4 second, user "stopped", @@ -478,7 +491,7 @@ static int ati_remote_compute_accel(struct ati_remote *ati_remote) } /* - * ati_remote_report_input + * ati_remote_report_input */ static void ati_remote_input_report(struct urb *urb) { @@ -518,7 +531,8 @@ static void ati_remote_input_report(struct urb *urb) remote_num = (data[3] >> 4) & 0x0f; if (channel_mask & (1 << (remote_num + 1))) { dbginfo(&ati_remote->interface->dev, - "Masked input from channel 0x%02x: data %02x,%02x, mask= 0x%02lx\n", + "Masked input from channel 0x%02x: data %02x,%02x, " + "mask= 0x%02lx\n", remote_num, data[1], data[2], channel_mask); return; } @@ -546,7 +560,9 @@ static void ati_remote_input_report(struct urb *urb) if (wheel_keycode == KEY_RESERVED) { /* scrollwheel was not mapped, assume mouse */ - /* Look up event code index in the mouse translation table. */ + /* Look up event code index in the mouse translation + * table. + */ for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) { if (scancode == ati_remote_tbl[i].data) { index = i; @@ -630,9 +646,9 @@ static void ati_remote_input_report(struct urb *urb) } else { /* - * Other event kinds are from the directional control pad, and have an - * acceleration factor applied to them. Without this acceleration, the - * control pad is mostly unusable. + * Other event kinds are from the directional control pad, and + * have an acceleration factor applied to them. Without this + * acceleration, the control pad is mostly unusable. */ acc = ati_remote_compute_accel(ati_remote); @@ -659,7 +675,8 @@ static void ati_remote_input_report(struct urb *urb) input_report_rel(dev, REL_Y, acc); break; default: - dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", + dev_dbg(&ati_remote->interface->dev, + "ati_remote kind=%d\n", ati_remote_tbl[index].kind); } input_sync(dev); @@ -670,7 +687,7 @@ static void ati_remote_input_report(struct urb *urb) } /* - * ati_remote_irq_in + * ati_remote_irq_in */ static void ati_remote_irq_in(struct urb *urb) { @@ -684,22 +701,25 @@ static void ati_remote_irq_in(struct urb *urb) case -ECONNRESET: /* unlink */ case -ENOENT: case -ESHUTDOWN: - dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n", + dev_dbg(&ati_remote->interface->dev, + "%s: urb error status, unlink?\n", __func__); return; default: /* error */ - dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", + dev_dbg(&ati_remote->interface->dev, + "%s: Nonzero urb status %d\n", __func__, urb->status); } retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", + dev_err(&ati_remote->interface->dev, + "%s: usb_submit_urb()=%d\n", __func__, retval); } /* - * ati_remote_alloc_buffers + * ati_remote_alloc_buffers */ static int ati_remote_alloc_buffers(struct usb_device *udev, struct ati_remote *ati_remote) @@ -726,7 +746,7 @@ static int ati_remote_alloc_buffers(struct usb_device *udev, } /* - * ati_remote_free_buffers + * ati_remote_free_buffers */ static void ati_remote_free_buffers(struct ati_remote *ati_remote) { @@ -825,9 +845,10 @@ static int ati_remote_initialize(struct ati_remote *ati_remote) } /* - * ati_remote_probe + * ati_remote_probe */ -static int ati_remote_probe(struct usb_interface *interface, const struct usb_device_id *id) +static int ati_remote_probe(struct usb_interface *interface, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(interface); struct usb_host_interface *iface_host = interface->cur_altsetting; @@ -949,7 +970,7 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de } /* - * ati_remote_disconnect + * ati_remote_disconnect */ static void ati_remote_disconnect(struct usb_interface *interface) { @@ -971,6 +992,14 @@ static void ati_remote_disconnect(struct usb_interface *interface) kfree(ati_remote); } +/* usb specific object to register with the usb subsystem */ +static struct usb_driver ati_remote_driver = { + .name = "ati_remote", + .probe = ati_remote_probe, + .disconnect = ati_remote_disconnect, + .id_table = ati_remote_table, +}; + module_usb_driver(ati_remote_driver); MODULE_AUTHOR(DRIVER_AUTHOR); diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 7be377f..0df66ac 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -23,6 +23,8 @@ * Vincent Vanackere * Added support for the "Lola" remote contributed by: * Seth Cohn + * Jul 2012: Du, Changbin + * Code style and compile warning fixing * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *