Skip to content

Commit

Permalink
V4L/DVB (13639): ir-sysfs: Properly protect rc_tab changes with a lock
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Mauro Carvalho Chehab committed Feb 26, 2010
1 parent d4b778d commit eecee32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/IR/ir-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static ssize_t store_protocol(struct device *d,
struct ir_input_dev *ir_dev = dev_get_drvdata(d);
enum ir_type ir_type = IR_TYPE_UNKNOWN;
int rc = -EINVAL;
unsigned long flags;
char *buf;

buf = strsep((char **) &data, "\n");
Expand All @@ -104,7 +105,9 @@ static ssize_t store_protocol(struct device *d,
return -EINVAL;
}

spin_lock_irqsave(&ir_dev->rc_tab.lock, flags);
ir_dev->rc_tab.ir_type = ir_type;
spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags);

IR_dprintk(1, "Current protocol is %ld\n", ir_type);

Expand Down

0 comments on commit eecee32

Please sign in to comment.