From: Maxim Levitsky <maximlevitsky@gmail.com>
To: lirc-list@lists.sourceforge.net
Cc: Jarod Wilson <jarod@wilsonet.com>,
linux-input@vger.kernel.org, linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH 6/9] IR: actually allow not to compile keymaps in..
Date: Wed, 28 Jul 2010 18:14:08 +0300 [thread overview]
Message-ID: <1280330051-27732-7-git-send-email-maximlevitsky@gmail.com> (raw)
In-Reply-To: <1280330051-27732-1-git-send-email-maximlevitsky@gmail.com>
Currntly, ir device registration fails if keymap requested by driver is not found...
Fix that by always compiling in the empty keymap, and using it as a failback
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-core-priv.h | 3 +-
drivers/media/IR/ir-sysfs.c | 2 +
drivers/media/IR/keymaps/Makefile | 1 -
drivers/media/IR/keymaps/rc-empty.c | 44 -----------------------------------
drivers/media/IR/rc-map.c | 23 ++++++++++++++++++
include/media/ir-core.h | 8 ++++-
6 files changed, 33 insertions(+), 48 deletions(-)
delete mode 100644 drivers/media/IR/keymaps/rc-empty.c
diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
index 4ed170d..9206b76 100644
--- a/drivers/media/IR/ir-core-priv.h
+++ b/drivers/media/IR/ir-core-priv.h
@@ -128,7 +128,8 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler);
void ir_raw_init(void);
-
+int ir_rcmap_init(void);
+void ir_rcmap_cleanup(void);
/*
* Decoder initialization code
*
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index a841e51..936dff8 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -341,6 +341,7 @@ static int __init ir_core_init(void)
/* Initialize/load the decoders/keymap code that will be used */
ir_raw_init();
+ ir_rcmap_init();
return 0;
}
@@ -348,6 +349,7 @@ static int __init ir_core_init(void)
static void __exit ir_core_exit(void)
{
class_unregister(&ir_input_class);
+ ir_rcmap_cleanup();
}
module_init(ir_core_init);
diff --git a/drivers/media/IR/keymaps/Makefile b/drivers/media/IR/keymaps/Makefile
index 86d3d1f..24992cd 100644
--- a/drivers/media/IR/keymaps/Makefile
+++ b/drivers/media/IR/keymaps/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-dm1105-nec.o \
rc-dntv-live-dvb-t.o \
rc-dntv-live-dvbt-pro.o \
- rc-empty.o \
rc-em-terratec.o \
rc-encore-enltv2.o \
rc-encore-enltv.o \
diff --git a/drivers/media/IR/keymaps/rc-empty.c b/drivers/media/IR/keymaps/rc-empty.c
deleted file mode 100644
index 3b338d8..0000000
--- a/drivers/media/IR/keymaps/rc-empty.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* empty.h - Keytable for empty Remote Controller
- *
- * keymap imported from ir-keymaps.c
- *
- * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include <media/rc-map.h>
-
-/* empty keytable, can be used as placeholder for not-yet created keytables */
-
-static struct ir_scancode empty[] = {
- { 0x2a, KEY_COFFEE },
-};
-
-static struct rc_keymap empty_map = {
- .map = {
- .scan = empty,
- .size = ARRAY_SIZE(empty),
- .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */
- .name = RC_MAP_EMPTY,
- }
-};
-
-static int __init init_rc_map_empty(void)
-{
- return ir_register_map(&empty_map);
-}
-
-static void __exit exit_rc_map_empty(void)
-{
- ir_unregister_map(&empty_map);
-}
-
-module_init(init_rc_map_empty)
-module_exit(exit_rc_map_empty)
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c
index 46a8f15..689143f 100644
--- a/drivers/media/IR/rc-map.c
+++ b/drivers/media/IR/rc-map.c
@@ -82,3 +82,26 @@ void ir_unregister_map(struct rc_keymap *map)
}
EXPORT_SYMBOL_GPL(ir_unregister_map);
+
+static struct ir_scancode empty[] = {
+ { 0x2a, KEY_COFFEE },
+};
+
+static struct rc_keymap empty_map = {
+ .map = {
+ .scan = empty,
+ .size = ARRAY_SIZE(empty),
+ .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */
+ .name = RC_MAP_EMPTY,
+ }
+};
+
+int ir_rcmap_init(void)
+{
+ return ir_register_map(&empty_map);
+}
+
+void ir_rcmap_cleanup(void)
+{
+ ir_unregister_map(&empty_map);
+}
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 46cc6c5..1e0abfd 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -134,8 +134,12 @@ static inline int ir_input_register(struct input_dev *dev,
return -EINVAL;
ir_codes = get_rc_map(map_name);
- if (!ir_codes)
- return -EINVAL;
+ if (!ir_codes) {
+ ir_codes = get_rc_map(RC_MAP_EMPTY);
+
+ if (!ir_codes)
+ return -EINVAL;
+ }
rc = __ir_input_register(dev, ir_codes, props, driver_name);
if (rc < 0)
--
1.7.0.4
next prev parent reply other threads:[~2010-07-28 15:14 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
2010-07-28 15:14 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
2010-07-28 17:36 ` Randy Dunlap
2010-07-28 20:31 ` Maxim Levitsky
2010-07-28 15:14 ` [PATCH 2/9] IR: minor fixes: Maxim Levitsky
2010-07-28 16:01 ` Mauro Carvalho Chehab
2010-07-28 16:38 ` Maxim Levitsky
2010-07-28 17:59 ` Mauro Carvalho Chehab
2010-07-28 17:23 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 3/9] IR: replace spinlock with mutex Maxim Levitsky
2010-07-28 16:03 ` Mauro Carvalho Chehab
2010-07-28 16:32 ` Maxim Levitsky
2010-07-28 17:43 ` Jarod Wilson
2010-07-28 18:37 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed Maxim Levitsky
2010-07-28 16:09 ` Mauro Carvalho Chehab
2010-07-28 16:29 ` Maxim Levitsky
2010-07-28 17:46 ` Jarod Wilson
2010-07-28 20:57 ` Jarod Wilson
2010-07-28 21:16 ` Maxim Levitsky
2010-07-28 15:14 ` [PATCH 5/9] IR: extend interfaces to support more device settings Maxim Levitsky
2010-07-28 17:00 ` Mauro Carvalho Chehab
2010-07-28 20:47 ` Jarod Wilson
2010-07-28 15:14 ` Maxim Levitsky [this message]
2010-07-28 17:58 ` [PATCH 6/9] IR: actually allow not to compile keymaps in Jarod Wilson
2010-07-28 15:14 ` [PATCH 7/9] IR: actualy report unknown scancodes the in-kernel decoders found Maxim Levitsky
2010-07-28 15:14 ` [PATCH 8/9] IR: Add ENE input driver Maxim Levitsky
2010-07-28 17:10 ` Mauro Carvalho Chehab
2010-07-28 17:13 ` Maxim Levitsky
2010-07-28 17:17 ` Jarod Wilson
2010-07-28 18:13 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 9/9] STAGING: remove ENE driver Maxim Levitsky
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=1280330051-27732-7-git-send-email-maximlevitsky@gmail.com \
--to=maximlevitsky@gmail.com \
--cc=jarod@wilsonet.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lirc-list@lists.sourceforge.net \
--cc=mchehab@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).