aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ir-kbd-i2c.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2012-10-11 18:11:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-27 09:49:51 -0400
commitc003ab1bedf028db15b0185b683d5c387204e8f5 (patch)
tree00f608e80e897589492eb2274c46ffb9fde769cf /drivers/media/i2c/ir-kbd-i2c.c
parent304ce75dd501d84d33dbca3c544e903f1d3377f7 (diff)
[media] rc-core: add separate defines for protocol bitmaps and numbers
The RC_TYPE_* defines are currently used both where a single protocol is expected and where a bitmap of protocols is expected. Functions like rc_keydown() and functions which add/remove entries to the keytable want a single protocol. Future userspace APIs would also benefit from numeric protocols (rather than bitmap ones). Keytables are smaller if they can use a small(ish) integer rather than a bitmap. Other functions or struct members (e.g. allowed_protos, enabled_protocols, etc) accept multiple protocols and need a bitmap. Using different types reduces the risk of programmer error. Using a protocol enum whereever possible also makes for a more future-proof user-space API as we don't need to worry about a sufficient number of bits being available (e.g. in structs used for ioctl() calls). The use of both a number and a corresponding bit is dalso one in e.g. the input subsystem as well (see all the references to set/clear bit when changing keytables for example). This patch separate the different usages in preparation for upcoming patches. Where a single protocol is expected, enum rc_type is used; where one or more protocol(s) are expected, something like u64 is used. The patch has been rewritten so that the format of the sysfs "protocols" file is no longer altered (at the loss of some detail). The file itself should probably be deprecated in the future though. Signed-off-by: David Härdeman <david@hardeman.nu> Cc: Andy Walls <awalls@md.metrocast.net> Cc: Maxim Levitsky <maximlevitsky@gmail.com> Cc: Antti Palosaari <crope@iki.fi> Cc: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/ir-kbd-i2c.c')
-rw-r--r--drivers/media/i2c/ir-kbd-i2c.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index 04f192a0398a..08ae067b2b6f 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -284,7 +284,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
284{ 284{
285 char *ir_codes = NULL; 285 char *ir_codes = NULL;
286 const char *name = NULL; 286 const char *name = NULL;
287 u64 rc_type = RC_TYPE_UNKNOWN; 287 u64 rc_type = RC_BIT_UNKNOWN;
288 struct IR_i2c *ir; 288 struct IR_i2c *ir;
289 struct rc_dev *rc = NULL; 289 struct rc_dev *rc = NULL;
290 struct i2c_adapter *adap = client->adapter; 290 struct i2c_adapter *adap = client->adapter;
@@ -303,7 +303,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
303 case 0x64: 303 case 0x64:
304 name = "Pixelview"; 304 name = "Pixelview";
305 ir->get_key = get_key_pixelview; 305 ir->get_key = get_key_pixelview;
306 rc_type = RC_TYPE_OTHER; 306 rc_type = RC_BIT_OTHER;
307 ir_codes = RC_MAP_EMPTY; 307 ir_codes = RC_MAP_EMPTY;
308 break; 308 break;
309 case 0x18: 309 case 0x18:
@@ -311,31 +311,31 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
311 case 0x1a: 311 case 0x1a:
312 name = "Hauppauge"; 312 name = "Hauppauge";
313 ir->get_key = get_key_haup; 313 ir->get_key = get_key_haup;
314 rc_type = RC_TYPE_RC5; 314 rc_type = RC_BIT_RC5;
315 ir_codes = RC_MAP_HAUPPAUGE; 315 ir_codes = RC_MAP_HAUPPAUGE;
316 break; 316 break;
317 case 0x30: 317 case 0x30:
318 name = "KNC One"; 318 name = "KNC One";
319 ir->get_key = get_key_knc1; 319 ir->get_key = get_key_knc1;
320 rc_type = RC_TYPE_OTHER; 320 rc_type = RC_BIT_OTHER;
321 ir_codes = RC_MAP_EMPTY; 321 ir_codes = RC_MAP_EMPTY;
322 break; 322 break;
323 case 0x6b: 323 case 0x6b:
324 name = "FusionHDTV"; 324 name = "FusionHDTV";
325 ir->get_key = get_key_fusionhdtv; 325 ir->get_key = get_key_fusionhdtv;
326 rc_type = RC_TYPE_RC5; 326 rc_type = RC_BIT_RC5;
327 ir_codes = RC_MAP_FUSIONHDTV_MCE; 327 ir_codes = RC_MAP_FUSIONHDTV_MCE;
328 break; 328 break;
329 case 0x40: 329 case 0x40:
330 name = "AVerMedia Cardbus remote"; 330 name = "AVerMedia Cardbus remote";
331 ir->get_key = get_key_avermedia_cardbus; 331 ir->get_key = get_key_avermedia_cardbus;
332 rc_type = RC_TYPE_OTHER; 332 rc_type = RC_BIT_OTHER;
333 ir_codes = RC_MAP_AVERMEDIA_CARDBUS; 333 ir_codes = RC_MAP_AVERMEDIA_CARDBUS;
334 break; 334 break;
335 case 0x71: 335 case 0x71:
336 name = "Hauppauge/Zilog Z8"; 336 name = "Hauppauge/Zilog Z8";
337 ir->get_key = get_key_haup_xvr; 337 ir->get_key = get_key_haup_xvr;
338 rc_type = RC_TYPE_RC5; 338 rc_type = RC_BIT_RC5;
339 ir_codes = RC_MAP_HAUPPAUGE; 339 ir_codes = RC_MAP_HAUPPAUGE;
340 break; 340 break;
341 } 341 }