diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 19:57:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 19:57:09 -0400 |
commit | 89a86a2da30a6a90dda719874092905cd762b7ef (patch) | |
tree | 140a289a990e7810e9c365bce304af1e065ca649 /drivers/iio/industrialio-core.c | |
parent | 71f882fe71823c54ae095ce29ce050f814eefdbc (diff) | |
parent | 364ed2f4653d7c86ebedcc116a9cb34fd272867c (diff) |
Merge branch 'staging-linus' into staging-next
We need this for the pstore fixes that went into the staging-linus branch, so
that things apply properly for the pstore/android code merge.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r-- | drivers/iio/industrialio-core.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index cf9ecd0ae7c9..a5a446beb2fa 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
@@ -724,7 +724,6 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev) | |||
724 | * New channel registration method - relies on the fact a group does | 724 | * New channel registration method - relies on the fact a group does |
725 | * not need to be initialized if it is name is NULL. | 725 | * not need to be initialized if it is name is NULL. |
726 | */ | 726 | */ |
727 | INIT_LIST_HEAD(&indio_dev->channel_attr_list); | ||
728 | if (indio_dev->channels) | 727 | if (indio_dev->channels) |
729 | for (i = 0; i < indio_dev->num_channels; i++) { | 728 | for (i = 0; i < indio_dev->num_channels; i++) { |
730 | ret = iio_device_add_channel_sysfs(indio_dev, | 729 | ret = iio_device_add_channel_sysfs(indio_dev, |
@@ -788,12 +787,16 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev) | |||
788 | static void iio_dev_release(struct device *device) | 787 | static void iio_dev_release(struct device *device) |
789 | { | 788 | { |
790 | struct iio_dev *indio_dev = dev_to_iio_dev(device); | 789 | struct iio_dev *indio_dev = dev_to_iio_dev(device); |
791 | cdev_del(&indio_dev->chrdev); | 790 | if (indio_dev->chrdev.dev) |
791 | cdev_del(&indio_dev->chrdev); | ||
792 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) | 792 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) |
793 | iio_device_unregister_trigger_consumer(indio_dev); | 793 | iio_device_unregister_trigger_consumer(indio_dev); |
794 | iio_device_unregister_eventset(indio_dev); | 794 | iio_device_unregister_eventset(indio_dev); |
795 | iio_device_unregister_sysfs(indio_dev); | 795 | iio_device_unregister_sysfs(indio_dev); |
796 | iio_device_unregister_debugfs(indio_dev); | 796 | iio_device_unregister_debugfs(indio_dev); |
797 | |||
798 | ida_simple_remove(&iio_ida, indio_dev->id); | ||
799 | kfree(indio_dev); | ||
797 | } | 800 | } |
798 | 801 | ||
799 | static struct device_type iio_dev_type = { | 802 | static struct device_type iio_dev_type = { |
@@ -824,6 +827,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv) | |||
824 | dev_set_drvdata(&dev->dev, (void *)dev); | 827 | dev_set_drvdata(&dev->dev, (void *)dev); |
825 | mutex_init(&dev->mlock); | 828 | mutex_init(&dev->mlock); |
826 | mutex_init(&dev->info_exist_lock); | 829 | mutex_init(&dev->info_exist_lock); |
830 | INIT_LIST_HEAD(&dev->channel_attr_list); | ||
827 | 831 | ||
828 | dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); | 832 | dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); |
829 | if (dev->id < 0) { | 833 | if (dev->id < 0) { |
@@ -841,10 +845,8 @@ EXPORT_SYMBOL(iio_device_alloc); | |||
841 | 845 | ||
842 | void iio_device_free(struct iio_dev *dev) | 846 | void iio_device_free(struct iio_dev *dev) |
843 | { | 847 | { |
844 | if (dev) { | 848 | if (dev) |
845 | ida_simple_remove(&iio_ida, dev->id); | 849 | put_device(&dev->dev); |
846 | kfree(dev); | ||
847 | } | ||
848 | } | 850 | } |
849 | EXPORT_SYMBOL(iio_device_free); | 851 | EXPORT_SYMBOL(iio_device_free); |
850 | 852 | ||
@@ -965,7 +967,7 @@ void iio_device_unregister(struct iio_dev *indio_dev) | |||
965 | mutex_lock(&indio_dev->info_exist_lock); | 967 | mutex_lock(&indio_dev->info_exist_lock); |
966 | indio_dev->info = NULL; | 968 | indio_dev->info = NULL; |
967 | mutex_unlock(&indio_dev->info_exist_lock); | 969 | mutex_unlock(&indio_dev->info_exist_lock); |
968 | device_unregister(&indio_dev->dev); | 970 | device_del(&indio_dev->dev); |
969 | } | 971 | } |
970 | EXPORT_SYMBOL(iio_device_unregister); | 972 | EXPORT_SYMBOL(iio_device_unregister); |
971 | subsys_initcall(iio_init); | 973 | subsys_initcall(iio_init); |