rc-core: various cleanups
Subsystems (2)
cover rc-core: various cleanups
Here's a set of smaller patches which performs various cleanups, mostly to the saa7134 and bttv driver. They are based on the media_tree.git repo (2.6.38 branch) on top of Mauro's recent renaming patches.
---
David Härdeman (10):
saa7134: remove unused module parameter
saa7134: use full keycode for BeholdTV
saa7134: some minor cleanups
saa7134: merge saa7134_card_ir->timer and saa7134_card_ir->timer_end
saa7134: protect the ir user count
saa7134: make module parameters boolean
bttv: rename struct card_ir to bttv_ir
bttv: merge ir decoding timers
mceusb: int to bool conversion
rc-core: fix some leftovers from the renaming patches
drivers/media/rc/ir-raw.c | 2 drivers/media/rc/keymaps/rc-behold.c | 70 +++++++------- drivers/media/rc/mceusb.c | 62 +++++-------- drivers/media/rc/rc-core-priv.h | 6 + drivers/media/rc/rc-main.c | 2 drivers/media/video/bt8xx/bttv-input.c | 31 +++--- drivers/media/video/bt8xx/bttvp.h | 32 ++---- drivers/media/video/saa7134/saa7134-input.c | 133 +++++++++++---------------- drivers/media/video/saa7134/saa7134.h | 6 + include/media/rc-core.h | 12 +- 10 files changed, 154 insertions(+), 202 deletions(-)
Signature · 1 line
David Härdeman
PATCH 1/10 saa7134: remove unused module parameter
ir_rc5_remote_gap is a leftover from ir-common, remove it.
--- drivers/media/video/saa7134/saa7134-input.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/media/video/saa7134/saa7134-input.c +0 -3
@@ -41,9 +41,6 @@ static int pinnacle_remote;module_param (pinnacle_remote, int,0644 );/* Choose Pinnacle PCTV remote */ MODULE_PARM_DESC (pinnacle_remote,"Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)" ); -static int ir_rc5_remote_gap =885 ; -module_param (ir_rc5_remote_gap, int,0644 ); -static unsigned int disable_other_ir;module_param (disable_other_ir, int,0644 ); MODULE_PARM_DESC(disable_other_ir, "disable full codes of "
PATCH 2/10 saa7134: use full keycode for BeholdTV
In reply to David HärdemanUsing the full keycode for BeholdTV hardware makes another module parameter unnecessary.
--- drivers/media/rc/keymaps/rc-behold.c | 70 ++++++++++++++------------- drivers/media/video/saa7134/saa7134-input.c | 19 +------ 2 files changed, 37 insertions(+), 52 deletions(-)
drivers/media/rc/keymaps/rc-behold.c +35 -35
@@ -29,8 +29,8 @@ static struct rc_map_table behold[] = {/* 0x1c 0x12 * * TV/FM POWER * * */ - { 0x1c, KEY_TUNER }, /* XXX KEY_TV / KEY_RADIO */ - { 0x12, KEY_POWER }, + { 0x6b861c, KEY_TUNER }, /* XXX KEY_TV / KEY_RADIO */ + { 0x6b8612, KEY_POWER },/* 0x01 0x02 0x03 * * 1 2 3 *
@@ -41,28 +41,28 @@ static struct rc_map_table behold[] = {* 0x07 0x08 0x09 * * 7 8 9 * * */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, + { 0x6b8601, KEY_1 }, + { 0x6b8602, KEY_2 }, + { 0x6b8603, KEY_3 }, + { 0x6b8604, KEY_4 }, + { 0x6b8605, KEY_5 }, + { 0x6b8606, KEY_6 }, + { 0x6b8607, KEY_7 }, + { 0x6b8608, KEY_8 }, + { 0x6b8609, KEY_9 },/* 0x0a 0x00 0x17 * * RECALL 0 MODE * * */ - { 0x0a, KEY_AGAIN }, - { 0x00, KEY_0 }, - { 0x17, KEY_MODE }, + { 0x6b860a, KEY_AGAIN }, + { 0x6b8600, KEY_0 }, + { 0x6b8617, KEY_MODE },/* 0x14 0x10 * * ASPECT FULLSCREEN * * */ - { 0x14, KEY_SCREEN }, - { 0x10, KEY_ZOOM }, + { 0x6b8614, KEY_SCREEN }, + { 0x6b8610, KEY_ZOOM },/* 0x0b * * Up *
@@ -73,17 +73,17 @@ static struct rc_map_table behold[] = {* 0x015 * * Down * * */ - { 0x0b, KEY_CHANNELUP }, - { 0x18, KEY_VOLUMEDOWN }, - { 0x16, KEY_OK }, /* XXX KEY_ENTER */ - { 0x0c, KEY_VOLUMEUP }, - { 0x15, KEY_CHANNELDOWN }, + { 0x6b860b, KEY_CHANNELUP }, + { 0x6b8618, KEY_VOLUMEDOWN }, + { 0x6b8616, KEY_OK }, /* XXX KEY_ENTER */ + { 0x6b860c, KEY_VOLUMEUP }, + { 0x6b8615, KEY_CHANNELDOWN },/* 0x11 0x0d * * MUTE INFO * * */ - { 0x11, KEY_MUTE }, - { 0x0d, KEY_INFO }, + { 0x6b8611, KEY_MUTE }, + { 0x6b860d, KEY_INFO },/* 0x0f 0x1b 0x1a * * RECORD PLAY/PAUSE STOP *
@@ -92,26 +92,26 @@ static struct rc_map_table behold[] = {*TELETEXT AUDIO SOURCE * * RED YELLOW * * */ - { 0x0f, KEY_RECORD }, - { 0x1b, KEY_PLAYPAUSE }, - { 0x1a, KEY_STOP }, - { 0x0e, KEY_TEXT }, - { 0x1f, KEY_RED }, /*XXX KEY_AUDIO */ - { 0x1e, KEY_YELLOW }, /*XXX KEY_SOURCE */ + { 0x6b860f, KEY_RECORD }, + { 0x6b861b, KEY_PLAYPAUSE }, + { 0x6b861a, KEY_STOP }, + { 0x6b860e, KEY_TEXT }, + { 0x6b861f, KEY_RED }, /*XXX KEY_AUDIO */ + { 0x6b861e, KEY_YELLOW }, /*XXX KEY_SOURCE *//* 0x1d 0x13 0x19 * * SLEEP PREVIEW DVB * * GREEN BLUE * * */ - { 0x1d, KEY_SLEEP }, - { 0x13, KEY_GREEN }, - { 0x19, KEY_BLUE }, /* XXX KEY_SAT */ + { 0x6b861d, KEY_SLEEP }, + { 0x6b8613, KEY_GREEN }, + { 0x6b8619, KEY_BLUE }, /* XXX KEY_SAT *//* 0x58 0x5c * * FREEZE SNAPSHOT * * */ - { 0x58, KEY_SLOW }, - { 0x5c, KEY_CAMERA }, + { 0x6b8658, KEY_SLOW }, + { 0x6b865c, KEY_CAMERA }, };
@@ -119,7 +119,7 @@ static struct rc_map_list behold_map = { .map = { .scan = behold, .size = ARRAY_SIZE(behold), - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .ir_type = IR_TYPE_NEC, .name = RC_MAP_BEHOLD, } };
drivers/media/video/saa7134/saa7134-input.c +2 -17
@@ -41,11 +41,6 @@ static int pinnacle_remote;module_param (pinnacle_remote, int,0644 );/* Choose Pinnacle PCTV remote */ MODULE_PARM_DESC (pinnacle_remote,"Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)" ); -static unsigned int disable_other_ir; -module_param (disable_other_ir, int,0644 ); -MODULE_PARM_DESC (disable_other_ir,"disable full codes of " -"alternative remotes from other manufacturers" ); - #define dprintk(fmt, arg...) if (ir_debug) \ printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) #define i2cdprintk(fmt, arg...) if (ir_debug) \
@@ -282,22 +277,12 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)i2cdprintk ("read error\n" );return -EIO ; } -/* IR of this card normally decode signals NEC-standard from -* - Sven IHOO MT 5.1R remote. xxyye718 -* - Sven DVD HD-10xx remote. xxyyf708 -* - BBK ... -* - mayby others -* So, skip not our, if disable full codes mode. -*/ -if (data[10 ] !=0x6b && data[11 ] !=0x86 && disable_other_ir) -return 0 ; -/* Wrong data decode fix */ if (data[9 ] != (unsigned char )(~data[8 ]))return 0 ; - *ir_key = data[9 ]; - *ir_raw = data[9 ]; + *ir_raw = ((data[10 ] <<16 ) | (data[11 ] <<8 ) | (data[9 ] <<0 )); + *ir_key = *ir_raw;return 1 ; }
PATCH 3/10 saa7134: some minor cleanups
In reply to David HärdemanMostly using appropriate data types and constants (e.g. int -> bool).
--- drivers/media/video/saa7134/saa7134-input.c | 49 ++++++++++----------------- drivers/media/video/saa7134/saa7134.h | 4 +- 2 files changed, 21 insertions(+), 32 deletions(-)
drivers/media/video/saa7134/saa7134-input.c +19 -30
@@ -407,17 +407,16 @@ static int __saa7134_ir_start(void *priv)struct saa7134_dev *dev = priv;struct saa7134_card_ir *ir; -if (!dev) +if (!dev || !dev->remote)return -EINVAL ; ir = dev->remote; -if (!ir) -return -EINVAL ; -if (ir->running)return 0 ; ir->running = true; + ir->active = false; +if (ir->polling) {setup_timer (&ir->timer, saa7134_input_timer, (unsigned long )dev);
@@ -425,10 +424,8 @@ static int __saa7134_ir_start(void *priv)add_timer (&ir->timer); }else if (ir->raw_decode) {/* set timer_end for code completion */ -init_timer (&ir->timer_end); - ir->timer_end.function = ir_raw_decode_timer_end; - ir->timer_end.data = (unsigned long )dev; - ir->active = false; +setup_timer (&ir->timer_end, ir_raw_decode_timer_end, + (unsigned long )dev); }return 0 ;
@@ -439,22 +436,19 @@ static void __saa7134_ir_stop(void *priv)struct saa7134_dev *dev = priv;struct saa7134_card_ir *ir; -if (!dev) +if (!dev || !dev->remote)return ; ir = dev->remote; -if (!ir) -return ; -if (!ir->running)return ; -if (dev->remote->polling) -del_timer_sync (&dev->remote->timer); -else if (ir->raw_decode) { + +if (ir->polling) +del_timer_sync (&ir->timer); +else if (ir->raw_decode)del_timer_sync (&ir->timer_end); - ir->active = false; - } + ir->active = false; ir->running = false;return ;
@@ -499,8 +493,8 @@ int saa7134_input_init1(struct saa7134_dev *dev)u32 mask_keycode =0 ;u32 mask_keydown =0 ;u32 mask_keyup =0 ; -int polling =0 ; -int raw_decode =0 ; +unsigned polling =0 ; +bool raw_decode = false;int err;if (dev->has_remote !=SAA7134_REMOTE_GPIO )
@@ -565,14 +559,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keydown =0x0040000 ;/* Enable GPIO18 line on both edges */ mask_keyup =0x0040000 ; mask_keycode =0xffff ; - raw_decode =1 ; + raw_decode = true;break ;case SAA7134_BOARD_AVERMEDIA_M733A : ir_codes =RC_MAP_AVERMEDIA_M733A_RM_K6 ; mask_keydown =0x0040000 ; mask_keyup =0x0040000 ; mask_keycode =0xffff ; - raw_decode =1 ; + raw_decode = true;break ;case SAA7134_BOARD_AVERMEDIA_777 :case SAA7134_BOARD_AVERMEDIA_A16AR :
@@ -679,7 +673,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keydown =0x0040000 ;/* Enable GPIO18 line on both edges */ mask_keyup =0x0040000 ; mask_keycode =0xffff ; - raw_decode =1 ; + raw_decode = true;break ;case SAA7134_BOARD_ENCORE_ENLTV :case SAA7134_BOARD_ENCORE_ENLTV_FM :
@@ -693,7 +687,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keydown =0x0040000 ;/* Enable GPIO18 line on both edges */ mask_keyup =0x0040000 ; mask_keycode =0xffff ; - raw_decode =1 ; + raw_decode = true;break ;case SAA7134_BOARD_10MOONSTVMASTER3 : ir_codes =RC_MAP_ENCORE_ENLTV ;
@@ -746,8 +740,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->dev = rc; dev->remote = ir; - ir->running = false; -/* init hardware-specific stuff */ ir->mask_keycode = mask_keycode; ir->mask_keydown = mask_keydown;
@@ -809,14 +801,12 @@ void saa7134_input_fini(struct saa7134_dev *dev)void saa7134_probe_i2c_ir (struct saa7134_dev *dev) {struct i2c_board_info info; -struct i2c_msg msg_msi = { .addr =0x50 , .flags =I2C_M_RD , .len =0 , .buf =NULL , }; -int rc;if (disable_ir) {
@@ -916,8 +906,8 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)static int saa7134_raw_decode_irq (struct saa7134_dev *dev) { -struct saa7134_card_ir *ir = dev->remote; -unsigned long timeout; +struct saa7134_card_ir *ir = dev->remote; +unsigned long timeout;int space;/* Generate initial event */
@@ -926,7 +916,6 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) space =saa_readl (SAA7134_GPIO_GPSTATUS0 >>2 ) & ir->mask_keydown;ir_raw_event_store_edge (dev->remote->dev, space ?IR_SPACE :IR_PULSE ); -/* * Wait 15 ms from the start of the first IR event before processing * the event. This time is enough for NEC protocol. May need adjustments
drivers/media/video/saa7134/saa7134.h +2 -2
@@ -124,7 +124,7 @@ struct saa7134_card_ir {char name[32 ];char phys[32 ]; -int users; +unsigned users;u32 polling;u32 last_gpio;
@@ -551,7 +551,7 @@ struct saa7134_dev {/* infrared remote */ int has_remote; -struct saa7134_card_ir *remote; +struct saa7134_card_ir *remote;/* pci i/o */ char name[32 ];
PATCH 4/10 saa7134: merge saa7134_card_ir->timer and saa7134_card_ir->timer_end
In reply to David HärdemanBoth timers are used for a similar purpose. Merging them allows for some minor simplifications.
--- drivers/media/video/saa7134/saa7134-input.c | 10 ++++------ drivers/media/video/saa7134/saa7134.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/media/video/saa7134/saa7134-input.c +4 -6
@@ -420,11 +420,11 @@ static int __saa7134_ir_start(void *priv)if (ir->polling) {setup_timer (&ir->timer, saa7134_input_timer, (unsigned long )dev); - ir->timer.expires = jiffies +HZ ; + ir->timer.expires = jiffies +HZ ;add_timer (&ir->timer); }else if (ir->raw_decode) {/* set timer_end for code completion */ -setup_timer (&ir->timer_end, ir_raw_decode_timer_end, +setup_timer (&ir->timer, ir_raw_decode_timer_end, (unsigned long )dev); }
@@ -443,10 +443,8 @@ static void __saa7134_ir_stop(void *priv)if (!ir->running)return ; -if (ir->polling) +if (ir->polling || ir->raw_decode)del_timer_sync (&ir->timer); -else if (ir->raw_decode) -del_timer_sync (&ir->timer_end); ir->active = false; ir->running = false;
@@ -923,7 +921,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev)*/ if (!ir->active) { timeout = jiffies +jiffies_to_msecs (15 ); -mod_timer (&ir->timer_end, timeout); +mod_timer (&ir->timer, timeout); ir->active = true; }
drivers/media/video/saa7134/saa7134.h +0 -1
@@ -134,7 +134,6 @@ struct saa7134_card_ir {bool active;struct timer_list timer; -struct timer_list timer_end;/* timer_end for code completion */ /* IR core raw decoding */ u32 raw_decode;
PATCH 5/10 saa7134: protect the ir user count
In reply to David HärdemanThe use of the saa7134_card_ir->users seems racy, so protect the count with a spinlock. Also use proper data types as arguments to __saa7134_ir_start() and __saa7134_ir_stop() to remove some unnecessary casts.
--- drivers/media/video/saa7134/saa7134-input.c | 54 ++++++++++++++++----------- drivers/media/video/saa7134/saa7134.h | 1 + 2 files changed, 33 insertions(+), 22 deletions(-)
drivers/media/video/saa7134/saa7134-input.c +32 -22
@@ -402,17 +402,12 @@ static void ir_raw_decode_timer_end(unsigned long data) ir->active = false; } -static int __saa7134_ir_start (void *priv) +static void __saa7134_ir_start (struct saa7134_dev *dev) { -struct saa7134_dev *dev = priv; -struct saa7134_card_ir *ir; - -if (!dev || !dev->remote) -return -EINVAL ; +struct saa7134_card_ir *ir = dev->remote; - ir = dev->remote;if (ir->running) -return 0 ; +return ; ir->running = true; ir->active = false;
@@ -427,19 +422,12 @@ static int __saa7134_ir_start(void *priv)setup_timer (&ir->timer, ir_raw_decode_timer_end, (unsigned long )dev); } - -return 0 ; } -static void __saa7134_ir_stop (void *priv) +static void __saa7134_ir_stop (struct saa7134_dev *dev) { -struct saa7134_dev *dev = priv; -struct saa7134_card_ir *ir; - -if (!dev || !dev->remote) -return ; +struct saa7134_card_ir *ir = dev->remote; - ir = dev->remote;if (!ir->running)return ;
@@ -448,39 +436,60 @@ static void __saa7134_ir_stop(void *priv) ir->active = false; ir->running = false; - -return ; }int saa7134_ir_start (struct saa7134_dev *dev) { +if (!dev || !dev->remote) +return -EINVAL ; + +spin_lock (&dev->remote->lock);if (dev->remote->users) -return __saa7134_ir_start (dev); +__saa7134_ir_start (dev); +spin_unlock (&dev->remote->lock);return 0 ; }void saa7134_ir_stop (struct saa7134_dev *dev) { +if (!dev || !dev->remote) +return ; + +spin_lock (&dev->remote->lock);if (dev->remote->users)__saa7134_ir_stop (dev); +spin_unlock (&dev->remote->lock); }static int saa7134_ir_open (struct rc_dev *rc) {struct saa7134_dev *dev = rc->priv; +if (!dev || !dev->remote) +return -EINVAL ; + +spin_lock (&dev->remote->lock); +if (dev->remote->users ==0 ) +__saa7134_ir_start (dev); dev->remote->users++; -return __saa7134_ir_start (dev); +spin_unlock (&dev->remote->lock); + +return 0 ; }static void saa7134_ir_close (struct rc_dev *rc) {struct saa7134_dev *dev = rc->priv; +if (!dev || !dev->remote) +return ; + +spin_lock (&dev->remote->lock); dev->remote->users--; -if (!dev->remote->users) +if (dev->remote->users ==0 )__saa7134_ir_stop (dev); +spin_unlock (&dev->remote->lock); }int saa7134_input_init1 (struct saa7134_dev *dev)
@@ -744,6 +753,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->mask_keyup = mask_keyup; ir->polling = polling; ir->raw_decode = raw_decode; +spin_lock_init (&ir->lock);/* init input device */ snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)",
drivers/media/video/saa7134/saa7134.h +1 -0
@@ -125,6 +125,7 @@ struct saa7134_card_ir {char name[32 ];char phys[32 ];unsigned users; +spinlock_t lock;u32 polling;u32 last_gpio;
PATCH 6/10 saa7134: make module parameters boolean
In reply to David Härdemanint to bool conversion for module parameters which are truely boolean.
--- drivers/media/video/saa7134/saa7134-input.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/video/saa7134/saa7134-input.c +4 -4
@@ -29,12 +29,12 @@#define MODULE_NAME "saa7134" -static unsigned int disable_ir; -module_param (disable_ir, int,0444 ); +static bool disable_ir; +module_param (disable_ir, bool,0444 );MODULE_PARM_DESC (disable_ir,"disable infrared remote support" ); -static unsigned int ir_debug; -module_param (ir_debug, int,0644 ); +static bool ir_debug; +module_param (ir_debug, bool,0644 );MODULE_PARM_DESC (ir_debug,"enable debug messages [IR]" );static int pinnacle_remote;
Re: [PATCH 06/10] saa7134: make module parameters boolean
Am Samstag, den 20.11.2010, 00:43 +0100 schrieb David Härdeman:
Quoted 19 lines
int to bool conversion for module parameters which are truely boolean.
Signed-off-by David Härdeman <[email protected]>--- drivers/media/video/saa7134/saa7134-input.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)drivers/media/video/saa7134/saa7134-input.c +1
-2@@ -29,12 +29,12 @@#define MODULE_NAME "saa7134" -static unsigned int disable_ir; -module_param (disable_ir, int,0444 ); +static bool disable_ir;
drivers/media/video/saa7134/saa7134-input.c line 40
Quoted 10 lines
drivers/media/video/saa7134/saa7134-input.c +3
-2+module_param (disable_ir, bool,0444 );MODULE_PARM_DESC (disable_ir,"disable infrared remote support" ); -static unsigned int ir_debug; -module_param (ir_debug, int,0644 ); +static bool ir_debug; +module_param (ir_debug, bool,0644 );MODULE_PARM_DESC (ir_debug,"enable debug messages [IR]" );static int pinnacle_remote;
Hi,
not exactly that one, but given all the previous changes,
I wonder if there will ever be some "tested-by:" from someone ...
Cheers,
Hermann
PATCH 7/10 bttv: rename struct card_ir to bttv_ir
In reply to David Härdemanbttv_ir is more consistent with all other structs used in the same driver. Also, clean up the struct to remove commented out members and the work_struct which is unused.
--- drivers/media/video/bt8xx/bttv-input.c | 27 +++++++++++++-------------- drivers/media/video/bt8xx/bttvp.h | 31 +++++++++---------------------- 2 files changed, 22 insertions(+), 36 deletions(-)
drivers/media/video/bt8xx/bttv-input.c +13 -14
@@ -49,7 +49,7 @@ module_param(ir_rc5_remote_gap, int, 0644);static void ir_handle_key (struct bttv *btv) { -struct card_ir *ir = btv->remote; +struct bttv_ir *ir = btv->remote;u32 gpio,data;/* read gpio value */
@@ -83,7 +83,7 @@ static void ir_handle_key(struct bttv *btv)static void ir_enltv_handle_key (struct bttv *btv) { -struct card_ir *ir = btv->remote; +struct bttv_ir *ir = btv->remote;u32 gpio, data, keyup;/* read gpio value */
@@ -122,7 +122,7 @@ static void ir_enltv_handle_key(struct bttv *btv)void bttv_input_irq (struct bttv *btv) { -struct card_ir *ir = btv->remote; +struct bttv_ir *ir = btv->remote;if (!ir->polling)ir_handle_key (btv);
@@ -131,7 +131,7 @@ void bttv_input_irq(struct bttv *btv)static void bttv_input_timer (unsigned long data) {struct bttv *btv = (struct bttv *)data; -struct card_ir *ir = btv->remote; +struct bttv_ir *ir = btv->remote;if (btv->c.type ==BTTV_BOARD_ENLTV_FM_2 )ir_enltv_handle_key (btv);
@@ -185,9 +185,9 @@ static u32 bttv_rc5_decode(unsigned int code)return rc5; } -void bttv_rc5_timer_end (unsigned long data) +static void bttv_rc5_timer_end (unsigned long data) { -struct card_ir *ir = (struct card_ir *)data; +struct bttv_ir *ir = (struct card_ir *)data;struct timeval tv;unsigned long current_jiffies;u32 gap;
@@ -206,7 +206,7 @@ void bttv_rc5_timer_end(unsigned long data) }/* signal we're ready to start a new code */ - ir->active =0 ; + ir->active = false;/* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */ if (gap <28000 ) {
@@ -242,7 +242,7 @@ void bttv_rc5_timer_end(unsigned long data)static int bttv_rc5_irq (struct bttv *btv) { -struct card_ir *ir = btv->remote; +struct bttv_ir *ir = btv->remote;struct timeval tv;u32 gpio;u32 gap;
@@ -278,7 +278,7 @@ static int bttv_rc5_irq(struct bttv *btv) }/* starting new code */ }else { - ir->active =1 ; + ir->active = true; ir->code =0 ; ir->base_time = tv; ir->last_bit =0 ;
@@ -295,7 +295,7 @@ static int bttv_rc5_irq(struct bttv *btv)/* ---------------------------------------------------------------------- */ -static void bttv_ir_start (struct bttv *btv,struct card_ir *ir) +static void bttv_ir_start (struct bttv *btv,struct bttv_ir *ir) {if (ir->polling) {setup_timer (&ir->timer, bttv_input_timer, (unsigned long )btv);
@@ -303,9 +303,8 @@ static void bttv_ir_start(struct bttv *btv, struct card_ir *ir)add_timer (&ir->timer); }else if (ir->rc5_gpio) {/* set timer_end for code completion */ -init_timer (&ir->timer_end); - ir->timer_end.function = bttv_rc5_timer_end; - ir->timer_end.data = (unsigned long )ir; +setup_timer (&ir->timer_end, bttv_rc5_timer_end, + (unsigned long )ir); ir->shift_by =1 ; ir->start =3 ; ir->addr =0x0 ;
@@ -409,7 +408,7 @@ int __devexit fini_bttv_i2c(struct bttv *btv)int bttv_input_init (struct bttv *btv) { -struct card_ir *ir; +struct bttv_ir *ir;char *ir_codes =NULL ;struct rc_dev *rc;int err = -ENOMEM ;
drivers/media/video/bt8xx/bttvp.h +9 -22
@@ -120,15 +120,12 @@ struct bttv_format {int hshift,vshift;/* for planar modes */ }; -struct card_ir { +struct bttv_ir {struct rc_dev *dev;char name[32 ];char phys[32 ]; -#if 0 -int users; -u32 running:1 ; -#endif +/* Usual gpio signalling */ u32 mask_keycode;u32 mask_keydown;
@@ -139,25 +136,15 @@ struct card_ir {int start;// What should RC5_START() be int addr;// What RC5_ADDR() should be. int rc5_remote_gap; -struct work_struct work;struct timer_list timer;/* RC5 gpio */ -u32 rc5_gpio; -struct timer_list timer_end;/* timer_end for code completion */ -u32 last_bit;/* last raw bit seen */ -u32 code;/* raw code under construction */ -struct timeval base_time;/* time of last seen code */ -int active;/* building raw code */ - -#if 0 -/* NEC decoding */ -u32 nec_gpio; -struct tasklet_struct tlet; - -/* IR core raw decoding */ -u32 raw_decode; -#endif +u32 rc5_gpio; +struct timer_list timer_end;/* timer_end for code completion */ +u32 last_bit;/* last raw bit seen */ +u32 code;/* raw code under construction */ +struct timeval base_time;/* time of last seen code */ +bool active;/* building raw code */ };
@@ -408,7 +395,7 @@ struct bttv {/* infrared remote */ int has_remote; -struct card_ir *remote; +struct bttv_ir *remote;/* I2C remote data */ struct IR_i2c_init_data init_data;
PATCH 8/10 bttv: merge ir decoding timers
In reply to David HärdemanSimilarly to saa7134, bttv_ir has two timers, only one of which is used at a time and which serve the same purpose. Merge them.
--- drivers/media/video/bt8xx/bttv-input.c | 8 +++----- drivers/media/video/bt8xx/bttvp.h | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/media/video/bt8xx/bttv-input.c +3 -5
@@ -283,8 +283,7 @@ static int bttv_rc5_irq(struct bttv *btv) ir->base_time = tv; ir->last_bit =0 ; -mod_timer (&ir->timer_end, - current_jiffies +msecs_to_jiffies (30 )); +mod_timer (&ir->timer, current_jiffies +msecs_to_jiffies (30 )); }/* toggle GPIO pin 4 to reset the irq */
@@ -303,8 +302,7 @@ static void bttv_ir_start(struct bttv *btv, struct bttv_ir *ir)add_timer (&ir->timer); }else if (ir->rc5_gpio) {/* set timer_end for code completion */ -setup_timer (&ir->timer_end, bttv_rc5_timer_end, - (unsigned long )ir); +setup_timer (&ir->timer, bttv_rc5_timer_end, (unsigned long )ir); ir->shift_by =1 ; ir->start =3 ; ir->addr =0x0 ;
@@ -322,7 +320,7 @@ static void bttv_ir_stop(struct bttv *btv)if (btv->remote->rc5_gpio) {u32 gpio; -del_timer_sync (&btv->remote->timer_end); +del_timer_sync (&btv->remote->timer);flush_scheduled_work (); gpio =bttv_gpio_read (&btv->c);
drivers/media/video/bt8xx/bttvp.h +1 -2
@@ -122,6 +122,7 @@ struct bttv_format {struct bttv_ir {struct rc_dev *dev; +struct timer_list timer;char name[32 ];char phys[32 ];
@@ -136,11 +137,9 @@ struct bttv_ir {int start;// What should RC5_START() be int addr;// What RC5_ADDR() should be. int rc5_remote_gap; -struct timer_list timer;/* RC5 gpio */ u32 rc5_gpio; -struct timer_list timer_end;/* timer_end for code completion */ u32 last_bit;/* last raw bit seen */ u32 code;/* raw code under construction */ struct timeval base_time;/* time of last seen code */
PATCH 9/10 mceusb: int to bool conversion
In reply to David HärdemanConvert boolean variables to use the corresponding data type.
--- drivers/media/rc/mceusb.c | 62 +++++++++++++++++++-------------------------- 1 files changed, 26 insertions(+), 36 deletions(-)
drivers/media/rc/mceusb.c +26 -36
@@ -103,9 +103,9 @@/* module parameters */ #ifdef CONFIG_USB_DEBUG -static int debug =1 ; +static bool debug = true;#else -static int debug; +static bool debug;#endif /* general constants */
@@ -151,12 +151,12 @@ enum mceusb_model_type { };struct mceusb_model { -u32 mce_gen1:1 ; -u32 mce_gen2:1 ; -u32 mce_gen3:1 ; -u32 tx_mask_inverted:1 ; -u32 is_polaris:1 ; -u32 no_tx:1 ; +bool mce_gen1:1 ; +bool mce_gen2:1 ; +bool mce_gen3:1 ; +bool tx_mask_inverted:1 ; +bool is_polaris:1 ; +bool no_tx:1 ;const char *rc_map;/* Allow specify a per-board map */ const char *name;/* per-board name */
@@ -164,22 +164,22 @@ struct mceusb_model {static const struct mceusb_model mceusb_model[] = { [MCE_GEN1 ] = { - .mce_gen1 =1 , - .tx_mask_inverted =1 , + .mce_gen1 = true, + .tx_mask_inverted = true, }, [MCE_GEN2 ] = { - .mce_gen2 =1 , + .mce_gen2 = true, }, [MCE_GEN2_TX_INV ] = { - .mce_gen2 =1 , - .tx_mask_inverted =1 , + .mce_gen2 = true, + .tx_mask_inverted = true, }, [MCE_GEN3 ] = { - .mce_gen3 =1 , - .tx_mask_inverted =1 , + .mce_gen3 = true, + .tx_mask_inverted = true, }, [POLARIS_EVK ] = { - .is_polaris =1 , + .is_polaris = true,/* * In fact, the EVK is shipped without * remotes, but we should have something handy,
@@ -189,8 +189,8 @@ static const struct mceusb_model mceusb_model[] = { .name = "Conexant Hybrid TV (cx231xx) MCE IR", }, [CX_HYBRID_TV] = { - .is_polaris = 1, - .no_tx = 1, /* tx isn't wired up at all */ + .is_polaris = true, + .no_tx = true, /* tx isn't wired up at all */ .name = "Conexant Hybrid TV (cx231xx) MCE IR", }, };
@@ -344,10 +344,10 @@ struct mceusb_dev {u8 cmd, rem;/* Remaining IR data bytes in packet */ struct { -u32 connected:1 ; -u32 tx_mask_inverted:1 ; -u32 microsoft_gen1:1 ; -u32 no_tx:1 ; +bool connected:1 ; +bool tx_mask_inverted:1 ; +bool microsoft_gen1:1 ; +bool no_tx:1 ; } flags;/* transmit support */
@@ -1090,21 +1090,11 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,int pipe, maxp, i;char buf[63 ], name[128 ] ="" ;enum mceusb_model_type model = id->driver_info; -bool is_gen3; -bool is_microsoft_gen1; -bool tx_mask_inverted; -bool is_polaris;dev_dbg (&intf->dev,"%s called\n" , __func__); - idesc = intf->cur_altsetting; - is_gen3 = mceusb_model[model].mce_gen3; - is_microsoft_gen1 = mceusb_model[model].mce_gen1; - tx_mask_inverted = mceusb_model[model].tx_mask_inverted; - is_polaris = mceusb_model[model].is_polaris; - -if (is_polaris) { +if (mceusb_model[model].is_polaris) {/* Interface 0 is IR */ if (idesc->desc.bInterfaceNumber)return -ENODEV ;
@@ -1167,8 +1157,8 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, ir->usbdev = dev; ir->dev = &intf->dev; ir->len_in = maxp; - ir->flags.microsoft_gen1 = is_microsoft_gen1; - ir->flags.tx_mask_inverted = tx_mask_inverted; + ir->flags.microsoft_gen1 = mceusb_model[model].mce_gen1; + ir->flags.tx_mask_inverted = mceusb_model[model].tx_mask_inverted; ir->flags.no_tx = mceusb_model[model].no_tx; ir->model = model;
@@ -1203,7 +1193,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,/* initialize device */ if (ir->flags.microsoft_gen1)mceusb_gen1_init (ir); -else if (!is_gen3) +else if (!mceusb_model[model].mce_gen3)mceusb_gen2_init (ir);mceusb_get_parameters (ir);
PATCH 10/10 rc-core: fix some leftovers from the renaming patches
In reply to David HärdemanFix some minor comments etc which are leftover from the old naming scheme.
--- drivers/media/rc/ir-raw.c | 2 +- drivers/media/rc/rc-core-priv.h | 6 +++--- drivers/media/rc/rc-main.c | 2 +- include/media/rc-core.h | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/media/rc/ir-raw.c +1 -1
@@ -1,4 +1,4 @@ -/* ir-raw-event.c - handle IR Pulse/Space event +/* ir-raw.c - handle IR pulse/space events * * Copyright (C) 2010 by Mauro Carvalho Chehab <[email protected]> *
drivers/media/rc/rc-core-priv.h +3 -3
@@ -13,8 +13,8 @@* GNU General Public License for more details. */ -#ifndef _IR_RAW_EVENT -#define _IR_RAW_EVENT +#ifndef _RC_CORE_PRIV +#define _RC_CORE_PRIV#include <linux/slab.h> #include <linux/spinlock.h>
@@ -190,4 +190,4 @@ void ir_raw_init(void);#endif -#endif /* _IR_RAW_EVENT */ +#endif /* _RC_CORE_PRIV */
drivers/media/rc/rc-main.c +1 -1
@@ -1,4 +1,4 @@ -/* rc-core.c - handle IR scancode->keycode tables +/* rc-main.c - Remote Controller core module * * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <[email protected]> *
include/media/rc-core.h +6 -6
@@ -206,12 +206,12 @@ static inline u32 ir_extract_bits(u32 data, u32 mask)u32 vbit =1 , value =0 ;do { -if (mask &1 ) { -if (data &1 ) - value |= vbit; - vbit <<=1 ; - } - data >>=1 ; +if (mask &1 ) { +if (data &1 ) + value |= vbit; + vbit <<=1 ; + } + data >>=1 ; }while (mask >>=1 );return value;