aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-10-29 07:39:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-11-24 16:07:11 -0500
commita7e57dce02ceb8212f106191fdfbc0fcb61ce9e0 (patch)
treeb3527156948f0a208869dfdf31a890ebfcc4261a
parent8caa07c0e565a15f49f290ca4c6a3adf968ddd38 (diff)
iio: core: Move kernel doc to the right location
Documentation related to function should be placed above its implementation. Move it accordingly. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/industrialio-core.c42
-rw-r--r--drivers/iio/industrialio-event.c6
-rw-r--r--drivers/iio/industrialio-trigger.c24
-rw-r--r--include/linux/iio/iio.h80
4 files changed, 72 insertions, 80 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 1c280b50c74b..2fe88c189f74 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -107,6 +107,11 @@ static const char * const iio_chan_info_postfix[] = {
107 [IIO_CHAN_INFO_INT_TIME] = "integration_time", 107 [IIO_CHAN_INFO_INT_TIME] = "integration_time",
108}; 108};
109 109
110/**
111 * iio_find_channel_from_si() - get channel from its scan index
112 * @indio_dev: device
113 * @si: scan index to match
114 */
110const struct iio_chan_spec 115const struct iio_chan_spec
111*iio_find_channel_from_si(struct iio_dev *indio_dev, int si) 116*iio_find_channel_from_si(struct iio_dev *indio_dev, int si)
112{ 117{
@@ -922,6 +927,10 @@ struct device_type iio_device_type = {
922 .release = iio_dev_release, 927 .release = iio_dev_release,
923}; 928};
924 929
930/**
931 * iio_device_alloc() - allocate an iio_dev from a driver
932 * @sizeof_priv: Space to allocate for private structure.
933 **/
925struct iio_dev *iio_device_alloc(int sizeof_priv) 934struct iio_dev *iio_device_alloc(int sizeof_priv)
926{ 935{
927 struct iio_dev *dev; 936 struct iio_dev *dev;
@@ -962,6 +971,10 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
962} 971}
963EXPORT_SYMBOL(iio_device_alloc); 972EXPORT_SYMBOL(iio_device_alloc);
964 973
974/**
975 * iio_device_free() - free an iio_dev from a driver
976 * @dev: the iio_dev associated with the device
977 **/
965void iio_device_free(struct iio_dev *dev) 978void iio_device_free(struct iio_dev *dev)
966{ 979{
967 if (dev) 980 if (dev)
@@ -984,6 +997,20 @@ static int devm_iio_device_match(struct device *dev, void *res, void *data)
984 return *r == data; 997 return *r == data;
985} 998}
986 999
1000/**
1001 * devm_iio_device_alloc - Resource-managed iio_device_alloc()
1002 * @dev: Device to allocate iio_dev for
1003 * @sizeof_priv: Space to allocate for private structure.
1004 *
1005 * Managed iio_device_alloc. iio_dev allocated with this function is
1006 * automatically freed on driver detach.
1007 *
1008 * If an iio_dev allocated with this function needs to be freed separately,
1009 * devm_iio_device_free() must be used.
1010 *
1011 * RETURNS:
1012 * Pointer to allocated iio_dev on success, NULL on failure.
1013 */
987struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv) 1014struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
988{ 1015{
989 struct iio_dev **ptr, *iio_dev; 1016 struct iio_dev **ptr, *iio_dev;
@@ -1006,6 +1033,13 @@ struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
1006} 1033}
1007EXPORT_SYMBOL_GPL(devm_iio_device_alloc); 1034EXPORT_SYMBOL_GPL(devm_iio_device_alloc);
1008 1035
1036/**
1037 * devm_iio_device_free - Resource-managed iio_device_free()
1038 * @dev: Device this iio_dev belongs to
1039 * @iio_dev: the iio_dev associated with the device
1040 *
1041 * Free iio_dev allocated with devm_iio_device_alloc().
1042 */
1009void devm_iio_device_free(struct device *dev, struct iio_dev *iio_dev) 1043void devm_iio_device_free(struct device *dev, struct iio_dev *iio_dev)
1010{ 1044{
1011 int rc; 1045 int rc;
@@ -1080,6 +1114,10 @@ static const struct file_operations iio_buffer_fileops = {
1080 1114
1081static const struct iio_buffer_setup_ops noop_ring_setup_ops; 1115static const struct iio_buffer_setup_ops noop_ring_setup_ops;
1082 1116
1117/**
1118 * iio_device_register() - register a device with the IIO subsystem
1119 * @indio_dev: Device structure filled by the device driver
1120 **/
1083int iio_device_register(struct iio_dev *indio_dev) 1121int iio_device_register(struct iio_dev *indio_dev)
1084{ 1122{
1085 int ret; 1123 int ret;
@@ -1141,6 +1179,10 @@ error_ret:
1141} 1179}
1142EXPORT_SYMBOL(iio_device_register); 1180EXPORT_SYMBOL(iio_device_register);
1143 1181
1182/**
1183 * iio_device_unregister() - unregister a device from the IIO subsystem
1184 * @indio_dev: Device structure representing the device.
1185 **/
1144void iio_device_unregister(struct iio_dev *indio_dev) 1186void iio_device_unregister(struct iio_dev *indio_dev)
1145{ 1187{
1146 mutex_lock(&indio_dev->info_exist_lock); 1188 mutex_lock(&indio_dev->info_exist_lock);
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index dac15b9f9df8..32b2c2d8d237 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -42,6 +42,12 @@ struct iio_event_interface {
42 struct attribute_group group; 42 struct attribute_group group;
43}; 43};
44 44
45/**
46 * iio_push_event() - try to add event to the list for userspace reading
47 * @indio_dev: IIO device structure
48 * @ev_code: What event
49 * @timestamp: When the event occurred
50 **/
45int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp) 51int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)
46{ 52{
47 struct iio_event_interface *ev_int = indio_dev->event_interface; 53 struct iio_event_interface *ev_int = indio_dev->event_interface;
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index bf5e70a32d3f..8bd092b9327e 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -506,6 +506,23 @@ static int devm_iio_trigger_match(struct device *dev, void *res, void *data)
506 return *r == data; 506 return *r == data;
507} 507}
508 508
509/**
510 * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
511 * @dev: Device to allocate iio_trigger for
512 * @fmt: trigger name format. If it includes format
513 * specifiers, the additional arguments following
514 * format are formatted and inserted in the resulting
515 * string replacing their respective specifiers.
516 *
517 * Managed iio_trigger_alloc. iio_trigger allocated with this function is
518 * automatically freed on driver detach.
519 *
520 * If an iio_trigger allocated with this function needs to be freed separately,
521 * devm_iio_trigger_free() must be used.
522 *
523 * RETURNS:
524 * Pointer to allocated iio_trigger on success, NULL on failure.
525 */
509struct iio_trigger *devm_iio_trigger_alloc(struct device *dev, 526struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
510 const char *fmt, ...) 527 const char *fmt, ...)
511{ 528{
@@ -532,6 +549,13 @@ struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
532} 549}
533EXPORT_SYMBOL_GPL(devm_iio_trigger_alloc); 550EXPORT_SYMBOL_GPL(devm_iio_trigger_alloc);
534 551
552/**
553 * devm_iio_trigger_free - Resource-managed iio_trigger_free()
554 * @dev: Device this iio_dev belongs to
555 * @iio_trig: the iio_trigger associated with the device
556 *
557 * Free iio_trigger allocated with devm_iio_trigger_alloc().
558 */
535void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig) 559void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig)
536{ 560{
537 int rc; 561 int rc;
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index a8cabda4d108..5b125fd554e4 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -490,35 +490,12 @@ struct iio_dev {
490#endif 490#endif
491}; 491};
492 492
493/**
494 * iio_find_channel_from_si() - get channel from its scan index
495 * @indio_dev: device
496 * @si: scan index to match
497 */
498const struct iio_chan_spec 493const struct iio_chan_spec
499*iio_find_channel_from_si(struct iio_dev *indio_dev, int si); 494*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
500
501/**
502 * iio_device_register() - register a device with the IIO subsystem
503 * @indio_dev: Device structure filled by the device driver
504 **/
505int iio_device_register(struct iio_dev *indio_dev); 495int iio_device_register(struct iio_dev *indio_dev);
506
507/**
508 * iio_device_unregister() - unregister a device from the IIO subsystem
509 * @indio_dev: Device structure representing the device.
510 **/
511void iio_device_unregister(struct iio_dev *indio_dev); 496void iio_device_unregister(struct iio_dev *indio_dev);
512
513int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev); 497int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev);
514void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev); 498void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev);
515
516/**
517 * iio_push_event() - try to add event to the list for userspace reading
518 * @indio_dev: IIO device structure
519 * @ev_code: What event
520 * @timestamp: When the event occurred
521 **/
522int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp); 499int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
523 500
524extern struct bus_type iio_bus_type; 501extern struct bus_type iio_bus_type;
@@ -582,10 +559,6 @@ static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
582 559
583/* Can we make this smaller? */ 560/* Can we make this smaller? */
584#define IIO_ALIGN L1_CACHE_BYTES 561#define IIO_ALIGN L1_CACHE_BYTES
585/**
586 * iio_device_alloc() - allocate an iio_dev from a driver
587 * @sizeof_priv: Space to allocate for private structure.
588 **/
589struct iio_dev *iio_device_alloc(int sizeof_priv); 562struct iio_dev *iio_device_alloc(int sizeof_priv);
590 563
591static inline void *iio_priv(const struct iio_dev *indio_dev) 564static inline void *iio_priv(const struct iio_dev *indio_dev)
@@ -599,64 +572,11 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
599 ALIGN(sizeof(struct iio_dev), IIO_ALIGN)); 572 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
600} 573}
601 574
602/**
603 * iio_device_free() - free an iio_dev from a driver
604 * @indio_dev: the iio_dev associated with the device
605 **/
606void iio_device_free(struct iio_dev *indio_dev); 575void iio_device_free(struct iio_dev *indio_dev);
607
608/**
609 * devm_iio_device_alloc - Resource-managed iio_device_alloc()
610 * @dev: Device to allocate iio_dev for
611 * @sizeof_priv: Space to allocate for private structure.
612 *
613 * Managed iio_device_alloc. iio_dev allocated with this function is
614 * automatically freed on driver detach.
615 *
616 * If an iio_dev allocated with this function needs to be freed separately,
617 * devm_iio_device_free() must be used.
618 *
619 * RETURNS:
620 * Pointer to allocated iio_dev on success, NULL on failure.
621 */
622struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv); 576struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
623
624/**
625 * devm_iio_device_free - Resource-managed iio_device_free()
626 * @dev: Device this iio_dev belongs to
627 * @indio_dev: the iio_dev associated with the device
628 *
629 * Free iio_dev allocated with devm_iio_device_alloc().
630 */
631void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev); 577void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev);
632
633/**
634 * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
635 * @dev: Device to allocate iio_trigger for
636 * @fmt: trigger name format. If it includes format
637 * specifiers, the additional arguments following
638 * format are formatted and inserted in the resulting
639 * string replacing their respective specifiers.
640 *
641 * Managed iio_trigger_alloc. iio_trigger allocated with this function is
642 * automatically freed on driver detach.
643 *
644 * If an iio_trigger allocated with this function needs to be freed separately,
645 * devm_iio_trigger_free() must be used.
646 *
647 * RETURNS:
648 * Pointer to allocated iio_trigger on success, NULL on failure.
649 */
650struct iio_trigger *devm_iio_trigger_alloc(struct device *dev, 578struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
651 const char *fmt, ...); 579 const char *fmt, ...);
652
653/**
654 * devm_iio_trigger_free - Resource-managed iio_trigger_free()
655 * @dev: Device this iio_dev belongs to
656 * @iio_trig: the iio_trigger associated with the device
657 *
658 * Free iio_trigger allocated with devm_iio_trigger_alloc().
659 */
660void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig); 580void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
661 581
662/** 582/**