From patchwork Tue Feb 3 00:17:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian McMenamin X-Patchwork-Id: 5156 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n130LLw1028633 for ; Tue, 3 Feb 2009 00:21:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756063AbZBCAVY (ORCPT ); Mon, 2 Feb 2009 19:21:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755863AbZBCAVY (ORCPT ); Mon, 2 Feb 2009 19:21:24 -0500 Received: from mk-filter-2-a-1.mail.uk.tiscali.com ([212.74.100.53]:22341 "EHLO mk-filter-2-a-1.mail.uk.tiscali.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754573AbZBCAVW (ORCPT ); Mon, 2 Feb 2009 19:21:22 -0500 X-MUA: Evolution 2.24.3 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgMFALsch0lQLLDG/2dsb2JhbACBbssbhBQG X-IronPort-AV: E=Sophos;i="4.37,368,1231113600"; d="scan'208";a="141265869" Received: from 80-44-176-198.dynamic.dsl.as9105.com (HELO newgolddream.info) ([80.44.176.198]) by smtp.tiscali.co.uk with ESMTP; 03 Feb 2009 00:18:28 +0000 Received: from [192.168.62.105] (bossclass.local [192.168.62.105]) by newgolddream.info (8.14.3/8.14.3/Debian-4) with ESMTP id n130IOiZ029642; Tue, 3 Feb 2009 00:18:25 GMT Subject: Re: [PATCH] sh: maple: Add support for VMU devices (v2) [3/3] From: Adrian McMenamin To: greg KH , Dmitry Torokhov Cc: Paul Mundt , dwmw2 , LKML , MTD , linux-sh , linux-input In-Reply-To: <1233619569.13918.12.camel@localhost.localdomain> References: <1233619569.13918.12.camel@localhost.localdomain> Date: Tue, 03 Feb 2009 00:17:58 +0000 Message-Id: <1233620278.13918.33.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.24.3 X-Spam-Status: No, score=-4.3 required=4.5 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on dragoneye X-Virus-Scanned: ClamAV 0.94.1rc1/8942/Mon Feb 2 18:56:43 2009 on newgolddream.info X-Virus-Status: Clean Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org This patch updates the Maple keyboard driver to reflect changes in the maple bus code and also to tidy up some dubious legacy code. Signed-off-by: Adrian McMenamin --- -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c index 22f17a5..42ff911 100644 --- a/drivers/input/keyboard/maple_keyb.c +++ b/drivers/input/keyboard/maple_keyb.c @@ -1,8 +1,8 @@ /* * SEGA Dreamcast keyboard driver * Based on drivers/usb/usbkbd.c - * Copyright YAEGASHI Takeshi, 2001 - * Porting to 2.6 Copyright Adrian McMenamin, 2007, 2008 + * Copyright (c) YAEGASHI Takeshi, 2001 + * Porting to 2.6 Copyright (c) Adrian McMenamin, 2007 - 2009 * * 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 @@ -33,7 +33,7 @@ static DEFINE_MUTEX(maple_keyb_mutex); #define NR_SCANCODES 256 -MODULE_AUTHOR("YAEGASHI Takeshi, Adrian McMenamin"); +MODULE_AUTHOR("Adrian McMenamin dev, "Unknown key (scancode %#x) released.", code); } @@ -127,7 +127,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd) input_event(dev, EV_MSC, MSC_SCAN, code); input_report_key(dev, keycode, 1); } else - printk(KERN_DEBUG "maple_keyb: " + dev_dbg(&dev->dev, "Unknown key (scancode %#x) pressed.", code); } @@ -140,7 +140,7 @@ static void dc_kbd_callback(struct mapleq *mq) { struct maple_device *mapledev = mq->dev; struct dc_kbd *kbd = maple_get_drvdata(mapledev); - unsigned long *buf = mq->recvbuf; + unsigned long *buf = (unsigned long *)(mq->recvbuf->buf); /* * We should always get the lock because the only @@ -159,22 +159,30 @@ static void dc_kbd_callback(struct mapleq *mq) static int probe_maple_kbd(struct device *dev) { - struct maple_device *mdev = to_maple_dev(dev); - struct maple_driver *mdrv = to_maple_driver(dev->driver); + struct maple_device *mdev; + struct maple_driver *mdrv; int i, error; struct dc_kbd *kbd; struct input_dev *idev; - if (!(mdev->function & MAPLE_FUNC_KEYBOARD)) - return -EINVAL; + mdev = to_maple_dev(dev); + if (!mdev) { + error = -EINVAL; + goto fail; + } kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL); - idev = input_allocate_device(); - if (!kbd || !idev) { + if (!kbd) { error = -ENOMEM; goto fail; } + idev = input_allocate_device(); + if (!idev) { + error = -ENOMEM; + goto fail_idev_alloc; + } + kbd->dev = idev; memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); @@ -195,7 +203,7 @@ static int probe_maple_kbd(struct device *dev) error = input_register_device(idev); if (error) - goto fail; + goto fail_register; /* Maple polling is locked to VBLANK - which may be just 50/s */ maple_getcond_callback(mdev, dc_kbd_callback, HZ/50, @@ -207,10 +215,12 @@ static int probe_maple_kbd(struct device *dev) return error; -fail: +fail_register: + maple_set_drvdata(mdev, NULL); input_free_device(idev); +fail_idev_alloc: kfree(kbd); - maple_set_drvdata(mdev, NULL); +fail: return error; }