
< static int gpio_chrdev_release(struct inode *inode, struct file *file)
< {
<     struct gpio_chardev_data *cdev = file->private_data;
<     struct gpio_device *gdev = cdev->gdev;
< 
<     bitmap_free(cdev->watched_lines);
<     blocking_notifier_chain_unregister(&gdev->device_notifier,
<                                        &cdev->device_unregistered_nb);
<     blocking_notifier_chain_unregister(&gdev->line_state_notifier,
<                                        &cdev->lineinfo_changed_nb);
<     gpio_device_put(gdev);
<     kfree(cdev);
< 
<     return 0;
< }
---
> static void gpio_chardev_rcu_free(struct rcu_head *rcu)
> {
>     struct gpio_chardev_data *cdev = container_of(rcu, struct gpio_chardev_data, rcu);
>     bitmap_free(cdev->watched_lines);
>     kfree(cdev);
> }
> 
> static int gpio_chrdev_release(struct inode *inode, struct file *file)
> {
>     struct gpio_chardev_data *cdev = file->private_data;
>     struct gpio_device *gdev = cdev->gdev;
> 
>     blocking_notifier_chain_unregister(&gdev->device_notifier,
>                                        &cdev->device_unregistered_nb);
>     blocking_notifier_chain_unregister(&gdev->line_state_notifier,
>                                        &cdev->lineinfo_changed_nb);
>     gpio_device_put(gdev);
> 
>     call_rcu(&cdev->rcu, gpio_chardev_rcu_free);
>     file->private_data = NULL;
> 
>     return 0;
> }
