Skip to content

Commit a7e57dc

Browse files
Sachin Kamatjic23
authored andcommitted
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>
1 parent 8caa07c commit a7e57dc

4 files changed

Lines changed: 72 additions & 80 deletions

File tree

‎drivers/iio/industrialio-core.c‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ static const char * const iio_chan_info_postfix[] = {
107107
[IIO_CHAN_INFO_INT_TIME] = "integration_time",
108108
};
109109

110+
/**
111+
* iio_find_channel_from_si() - get channel from its scan index
112+
* @indio_dev: device
113+
* @si: scan index to match
114+
*/
110115
const struct iio_chan_spec
111116
*iio_find_channel_from_si(struct iio_dev *indio_dev, int si)
112117
{
@@ -922,6 +927,10 @@ struct device_type iio_device_type = {
922927
.release = iio_dev_release,
923928
};
924929

930+
/**
931+
* iio_device_alloc() - allocate an iio_dev from a driver
932+
* @sizeof_priv: Space to allocate for private structure.
933+
**/
925934
struct iio_dev *iio_device_alloc(int sizeof_priv)
926935
{
927936
struct iio_dev *dev;
@@ -962,6 +971,10 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
962971
}
963972
EXPORT_SYMBOL(iio_device_alloc);
964973

974+
/**
975+
* iio_device_free() - free an iio_dev from a driver
976+
* @dev: the iio_dev associated with the device
977+
**/
965978
void iio_device_free(struct iio_dev *dev)
966979
{
967980
if (dev)
@@ -984,6 +997,20 @@ static int devm_iio_device_match(struct device *dev, void *res, void *data)
984997
return *r == data;
985998
}
986999

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+
*/
9871014
struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
9881015
{
9891016
struct iio_dev **ptr, *iio_dev;
@@ -1006,6 +1033,13 @@ struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
10061033
}
10071034
EXPORT_SYMBOL_GPL(devm_iio_device_alloc);
10081035

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+
*/
10091043
void devm_iio_device_free(struct device *dev, struct iio_dev *iio_dev)
10101044
{
10111045
int rc;
@@ -1080,6 +1114,10 @@ static const struct file_operations iio_buffer_fileops = {
10801114

10811115
static const struct iio_buffer_setup_ops noop_ring_setup_ops;
10821116

1117+
/**
1118+
* iio_device_register() - register a device with the IIO subsystem
1119+
* @indio_dev: Device structure filled by the device driver
1120+
**/
10831121
int iio_device_register(struct iio_dev *indio_dev)
10841122
{
10851123
int ret;
@@ -1141,6 +1179,10 @@ int iio_device_register(struct iio_dev *indio_dev)
11411179
}
11421180
EXPORT_SYMBOL(iio_device_register);
11431181

1182+
/**
1183+
* iio_device_unregister() - unregister a device from the IIO subsystem
1184+
* @indio_dev: Device structure representing the device.
1185+
**/
11441186
void iio_device_unregister(struct iio_dev *indio_dev)
11451187
{
11461188
mutex_lock(&indio_dev->info_exist_lock);

‎drivers/iio/industrialio-event.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ struct iio_event_interface {
4242
struct attribute_group group;
4343
};
4444

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+
**/
4551
int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)
4652
{
4753
struct iio_event_interface *ev_int = indio_dev->event_interface;

‎drivers/iio/industrialio-trigger.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,23 @@ static int devm_iio_trigger_match(struct device *dev, void *res, void *data)
506506
return *r == data;
507507
}
508508

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+
*/
509526
struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
510527
const char *fmt, ...)
511528
{
@@ -532,6 +549,13 @@ struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
532549
}
533550
EXPORT_SYMBOL_GPL(devm_iio_trigger_alloc);
534551

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+
*/
535559
void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig)
536560
{
537561
int rc;

‎include/linux/iio/iio.h‎

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -490,35 +490,12 @@ struct iio_dev {
490490
#endif
491491
};
492492

493-
/**
494-
* iio_find_channel_from_si() - get channel from its scan index
495-
* @indio_dev: device
496-
* @si: scan index to match
497-
*/
498493
const struct iio_chan_spec
499494
*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-
**/
505495
int 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-
**/
511496
void iio_device_unregister(struct iio_dev *indio_dev);
512-
513497
int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev);
514498
void 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-
**/
522499
int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
523500

524501
extern struct bus_type iio_bus_type;
@@ -582,10 +559,6 @@ static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
582559

583560
/* Can we make this smaller? */
584561
#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-
**/
589562
struct iio_dev *iio_device_alloc(int sizeof_priv);
590563

591564
static 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)
599572
ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
600573
}
601574

602-
/**
603-
* iio_device_free() - free an iio_dev from a driver
604-
* @indio_dev: the iio_dev associated with the device
605-
**/
606575
void 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-
*/
622576
struct 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-
*/
631577
void 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-
*/
650578
struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
651579
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-
*/
660580
void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
661581

662582
/**

0 commit comments

Comments
 (0)