diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/counter/counter-chrdev.c | 6 | ||||
-rw-r--r-- | drivers/counter/counter-sysfs.c | 13 |
2 files changed, 3 insertions, 16 deletions
diff --git a/drivers/counter/counter-chrdev.c b/drivers/counter/counter-chrdev.c index 967c94ae95bb..b747dc81cfc6 100644 --- a/drivers/counter/counter-chrdev.c +++ b/drivers/counter/counter-chrdev.c @@ -384,10 +384,6 @@ static int counter_chrdev_open(struct inode *inode, struct file *filp) typeof(*counter), chrdev); - /* Ensure chrdev is not opened more than 1 at a time */ - if (!atomic_add_unless(&counter->chrdev_lock, 1, 1)) - return -EBUSY; - get_device(&counter->dev); filp->private_data = counter; @@ -419,7 +415,6 @@ out_unlock: mutex_unlock(&counter->ops_exist_lock); put_device(&counter->dev); - atomic_dec(&counter->chrdev_lock); return ret; } @@ -445,7 +440,6 @@ int counter_chrdev_add(struct counter_device *const counter) mutex_init(&counter->events_lock); /* Initialize character device */ - atomic_set(&counter->chrdev_lock, 0); cdev_init(&counter->chrdev, &counter_fops); /* Allocate Counter events queue */ diff --git a/drivers/counter/counter-sysfs.c b/drivers/counter/counter-sysfs.c index c2fddbb0d442..8c2d7c29ea59 100644 --- a/drivers/counter/counter-sysfs.c +++ b/drivers/counter/counter-sysfs.c @@ -796,25 +796,18 @@ static int counter_events_queue_size_write(struct counter_device *counter, u64 val) { DECLARE_KFIFO_PTR(events, struct counter_event); - int err = 0; - - /* Ensure chrdev is not opened more than 1 at a time */ - if (!atomic_add_unless(&counter->chrdev_lock, 1, 1)) - return -EBUSY; + int err; /* Allocate new events queue */ err = kfifo_alloc(&events, val, GFP_KERNEL); if (err) - goto exit_early; + return err; /* Swap in new events queue */ kfifo_free(&counter->events); counter->events.kfifo = events.kfifo; -exit_early: - atomic_dec(&counter->chrdev_lock); - - return err; + return 0; } static struct counter_comp counter_num_signals_comp = |