From patchwork Thu Jan 13 18:56:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 476511 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0DIvEZA015564 for ; Thu, 13 Jan 2011 18:57:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756691Ab1AMS5M (ORCPT ); Thu, 13 Jan 2011 13:57:12 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:59514 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751835Ab1AMS5L (ORCPT ); Thu, 13 Jan 2011 13:57:11 -0500 Received: by mail-ew0-f46.google.com with SMTP id 5so1078333ewy.19 for ; Thu, 13 Jan 2011 10:57:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=mMfd780U3Yx4odPF/AO+9Lu7dH6s+3uduKMy8lbSsZc=; b=NpIAD2zEC4GnyL5+2wMHqyXsIZc9GPimj7NOMvCXz3KwupVpi11dI+imhR8FoS9Qfd FIh6Tw1gYmGK5EgHhTq6e/fq10Fdzm13xc+e7Rjyc0wK3pjAMrvFF63+MTRLxJVXGX19 X5sjJlwshLLlz/EGPnR0jmqszuEU70KkfFwVM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=JIIoPyoffFRGkqj3QCSN9ekiX+6cl/LdWoYqXwB4TSzwDXxXwC/ZXhwpnYvTh5e6Fl 3075RPN87wQbIG4GPOPvmSi72H64sIL9a0CpSbouT60gwK99ykfBtEQInjJxVX1NNemC HYMynJR9JtknprcRigdAvM5G8E9jLP1m/MBhI= Received: by 10.213.114.82 with SMTP id d18mr840858ebq.29.1294945030808; Thu, 13 Jan 2011 10:57:10 -0800 (PST) Received: from pippin.ponomarevs.spb.ru ([93.100.118.145]) by mx.google.com with ESMTPS id v59sm271013eeh.21.2011.01.13.10.57.09 (version=SSLv3 cipher=RC4-MD5); Thu, 13 Jan 2011 10:57:10 -0800 (PST) From: Nikolai Kondrashov To: Dmitry Torokhov Cc: linux-input , Vladislav Naumov , Nikolai Kondrashov Subject: [PATCH 1/3] Input: split hid-drff into general and ff parts Date: Thu, 13 Jan 2011 21:56:41 +0300 Message-Id: <1294945003-7687-2-git-send-email-spbnick@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1294945003-7687-1-git-send-email-spbnick@gmail.com> References: <1294945003-7687-1-git-send-email-spbnick@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 13 Jan 2011 18:57:16 +0000 (UTC) diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index c335605..3e18fdd 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -25,6 +25,11 @@ ifdef CONFIG_LOGIWII_FF hid-logitech-objs += hid-lg4ff.o endif +hid-dragonrise-objs := hid-dr.o +ifdef CONFIG_DRAGONRISE_FF + hid-dragonrise-objs += hid-drff.o +endif + obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o obj-$(CONFIG_HID_ACRUX_FF) += hid-axff.o @@ -34,7 +39,7 @@ obj-$(CONFIG_HID_CANDO) += hid-cando.o obj-$(CONFIG_HID_CHERRY) += hid-cherry.o obj-$(CONFIG_HID_CHICONY) += hid-chicony.o obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o -obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o +obj-$(CONFIG_HID_DRAGONRISE) += hid-dragonrise.o obj-$(CONFIG_HID_EGALAX) += hid-egalax.o obj-$(CONFIG_HID_ELECOM) += hid-elecom.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o diff --git a/drivers/hid/hid-dr.c b/drivers/hid/hid-dr.c new file mode 100644 index 0000000..bafd530 --- /dev/null +++ b/drivers/hid/hid-dr.c @@ -0,0 +1,71 @@ +/* + * HID driver for DragonRise Inc. devices not fully compliant with HID standard + * + * Copyright (c) 2010 Nikolai Kondrashov + * Copyright (c) 2009 Richard Walmsley + */ + +/* + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include + +#include "hid-ids.h" +#include "hid-dr.h" + +static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id) +{ + int ret; + + dev_dbg(&hdev->dev, "DragonRise Inc. HID hardware probe..."); + + ret = hid_parse(hdev); + if (ret) { + dev_err(&hdev->dev, "parse failed\n"); + goto err; + } + + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); + if (ret) { + dev_err(&hdev->dev, "hw start failed\n"); + goto err; + } + + drff_init(hdev); + + return 0; +err: + return ret; +} + +static const struct hid_device_id dr_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006), }, + { } +}; +MODULE_DEVICE_TABLE(hid, dr_devices); + +static struct hid_driver dr_driver = { + .name = "dragonrise", + .id_table = dr_devices, + .probe = dr_probe, +}; + +static int __init dr_init(void) +{ + return hid_register_driver(&dr_driver); +} + +static void __exit dr_exit(void) +{ + hid_unregister_driver(&dr_driver); +} + +module_init(dr_init); +module_exit(dr_exit); +MODULE_LICENSE("GPL"); diff --git a/drivers/hid/hid-dr.h b/drivers/hid/hid-dr.h new file mode 100644 index 0000000..43eb631 --- /dev/null +++ b/drivers/hid/hid-dr.h @@ -0,0 +1,13 @@ +#ifndef __HID_DR_H +#define __HID_DR_H + +#ifdef CONFIG_DRAGONRISE_FF +extern int drff_init(struct hid_device *hid); +#else +static inline int drff_init(struct hid_device *hid) +{ + return 0; +} +#endif + +#endif diff --git a/drivers/hid/hid-drff.c b/drivers/hid/hid-drff.c index 968b04f..89adafe 100644 --- a/drivers/hid/hid-drff.c +++ b/drivers/hid/hid-drff.c @@ -32,10 +32,8 @@ #include #include -#include "hid-ids.h" - -#ifdef CONFIG_DRAGONRISE_FF #include "usbhid/usbhid.h" +#include "hid-dr.h" struct drff_device { struct hid_report *report; @@ -84,7 +82,7 @@ static int drff_play(struct input_dev *dev, void *data, return 0; } -static int drff_init(struct hid_device *hid) +int drff_init(struct hid_device *hid) { struct drff_device *drff; struct hid_report *report; @@ -138,60 +136,3 @@ static int drff_init(struct hid_device *hid) return 0; } -#else -static inline int drff_init(struct hid_device *hid) -{ - return 0; -} -#endif - -static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id) -{ - int ret; - - dev_dbg(&hdev->dev, "DragonRise Inc. HID hardware probe..."); - - ret = hid_parse(hdev); - if (ret) { - dev_err(&hdev->dev, "parse failed\n"); - goto err; - } - - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); - if (ret) { - dev_err(&hdev->dev, "hw start failed\n"); - goto err; - } - - drff_init(hdev); - - return 0; -err: - return ret; -} - -static const struct hid_device_id dr_devices[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006), }, - { } -}; -MODULE_DEVICE_TABLE(hid, dr_devices); - -static struct hid_driver dr_driver = { - .name = "dragonrise", - .id_table = dr_devices, - .probe = dr_probe, -}; - -static int __init dr_init(void) -{ - return hid_register_driver(&dr_driver); -} - -static void __exit dr_exit(void) -{ - hid_unregister_driver(&dr_driver); -} - -module_init(dr_init); -module_exit(dr_exit); -MODULE_LICENSE("GPL");