Skip to content

Commit d9452ad

Browse files
gwendalcrEnric Balletbo i Serra
authored andcommitted
iio: cros_ec: Move function description to .c file
To prevent comment rot, move function description to cros_ec_sensors_core.c. Signed-off-by: Gwendal Grignou <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]>
1 parent 93fe48a commit d9452ad

File tree

2 files changed

+69
-80
lines changed

2 files changed

+69
-80
lines changed

drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ static void get_default_min_max_freq(enum motionsensor_type type,
8282
}
8383
}
8484

85+
/**
86+
* cros_ec_sensors_core_init() - basic initialization of the core structure
87+
* @pdev: platform device created for the sensors
88+
* @indio_dev: iio device structure of the device
89+
* @physical_device: true if the device refers to a physical device
90+
*
91+
* Return: 0 on success, -errno on failure.
92+
*/
8593
int cros_ec_sensors_core_init(struct platform_device *pdev,
8694
struct iio_dev *indio_dev,
8795
bool physical_device)
@@ -159,6 +167,16 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
159167
}
160168
EXPORT_SYMBOL_GPL(cros_ec_sensors_core_init);
161169

170+
/**
171+
* cros_ec_motion_send_host_cmd() - send motion sense host command
172+
* @state: pointer to state information for device
173+
* @opt_length: optional length to reduce the response size, useful on the data
174+
* path. Otherwise, the maximal allowed response size is used
175+
*
176+
* When called, the sub-command is assumed to be set in param->cmd.
177+
*
178+
* Return: 0 on success, -errno on failure.
179+
*/
162180
int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *state,
163181
u16 opt_length)
164182
{
@@ -421,6 +439,14 @@ int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev,
421439
}
422440
EXPORT_SYMBOL_GPL(cros_ec_sensors_read_lpc);
423441

442+
/**
443+
* cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol
444+
* @indio_dev: pointer to IIO device
445+
* @scan_mask: bitmap of the sensor indices to scan
446+
* @data: location to store data
447+
*
448+
* Return: 0 on success, -errno on failure.
449+
*/
424450
int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev,
425451
unsigned long scan_mask, s16 *data)
426452
{
@@ -445,6 +471,18 @@ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev,
445471
}
446472
EXPORT_SYMBOL_GPL(cros_ec_sensors_read_cmd);
447473

474+
/**
475+
* cros_ec_sensors_capture() - the trigger handler function
476+
* @irq: the interrupt number.
477+
* @p: a pointer to the poll function.
478+
*
479+
* On a trigger event occurring, if the pollfunc is attached then this
480+
* handler is called as a threaded interrupt (and hence may sleep). It
481+
* is responsible for grabbing data from the device and pushing it into
482+
* the associated buffer.
483+
*
484+
* Return: IRQ_HANDLED
485+
*/
448486
irqreturn_t cros_ec_sensors_capture(int irq, void *p)
449487
{
450488
struct iio_poll_func *pf = p;
@@ -480,6 +518,16 @@ irqreturn_t cros_ec_sensors_capture(int irq, void *p)
480518
}
481519
EXPORT_SYMBOL_GPL(cros_ec_sensors_capture);
482520

521+
/**
522+
* cros_ec_sensors_core_read() - function to request a value from the sensor
523+
* @st: pointer to state information for device
524+
* @chan: channel specification structure table
525+
* @val: will contain one element making up the returned value
526+
* @val2: will contain another element making up the returned value
527+
* @mask: specifies which values to be requested
528+
*
529+
* Return: the type of value returned by the device
530+
*/
483531
int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,
484532
struct iio_chan_spec const *chan,
485533
int *val, int *val2, long mask)
@@ -520,6 +568,17 @@ int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,
520568
}
521569
EXPORT_SYMBOL_GPL(cros_ec_sensors_core_read);
522570

571+
/**
572+
* cros_ec_sensors_core_read_avail() - get available values
573+
* @indio_dev: pointer to state information for device
574+
* @chan: channel specification structure table
575+
* @vals: list of available values
576+
* @type: type of data returned
577+
* @length: number of data returned in the array
578+
* @mask: specifies which values to be requested
579+
*
580+
* Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST
581+
*/
523582
int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev,
524583
struct iio_chan_spec const *chan,
525584
const int **vals,
@@ -541,6 +600,16 @@ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev,
541600
}
542601
EXPORT_SYMBOL_GPL(cros_ec_sensors_core_read_avail);
543602

603+
/**
604+
* cros_ec_sensors_core_write() - function to write a value to the sensor
605+
* @st: pointer to state information for device
606+
* @chan: channel specification structure table
607+
* @val: first part of value to write
608+
* @val2: second part of value to write
609+
* @mask: specifies which values to write
610+
*
611+
* Return: the type of value returned by the device
612+
*/
544613
int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st,
545614
struct iio_chan_spec const *chan,
546615
int val, int val2, long mask)

include/linux/iio/common/cros_ec_sensors_core.h

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -79,112 +79,32 @@ struct cros_ec_sensors_core_state {
7979
int frequencies[3];
8080
};
8181

82-
/**
83-
* cros_ec_sensors_read_lpc() - retrieve data from EC shared memory
84-
* @indio_dev: pointer to IIO device
85-
* @scan_mask: bitmap of the sensor indices to scan
86-
* @data: location to store data
87-
*
88-
* This is the safe function for reading the EC data. It guarantees that the
89-
* data sampled was not modified by the EC while being read.
90-
*
91-
* Return: 0 on success, -errno on failure.
92-
*/
9382
int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, unsigned long scan_mask,
9483
s16 *data);
9584

96-
/**
97-
* cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol
98-
* @indio_dev: pointer to IIO device
99-
* @scan_mask: bitmap of the sensor indices to scan
100-
* @data: location to store data
101-
*
102-
* Return: 0 on success, -errno on failure.
103-
*/
10485
int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask,
10586
s16 *data);
10687

10788
struct platform_device;
108-
/**
109-
* cros_ec_sensors_core_init() - basic initialization of the core structure
110-
* @pdev: platform device created for the sensors
111-
* @indio_dev: iio device structure of the device
112-
* @physical_device: true if the device refers to a physical device
113-
*
114-
* Return: 0 on success, -errno on failure.
115-
*/
11689
int cros_ec_sensors_core_init(struct platform_device *pdev,
11790
struct iio_dev *indio_dev, bool physical_device);
11891

119-
/**
120-
* cros_ec_sensors_capture() - the trigger handler function
121-
* @irq: the interrupt number.
122-
* @p: a pointer to the poll function.
123-
*
124-
* On a trigger event occurring, if the pollfunc is attached then this
125-
* handler is called as a threaded interrupt (and hence may sleep). It
126-
* is responsible for grabbing data from the device and pushing it into
127-
* the associated buffer.
128-
*
129-
* Return: IRQ_HANDLED
130-
*/
13192
irqreturn_t cros_ec_sensors_capture(int irq, void *p);
13293

133-
/**
134-
* cros_ec_motion_send_host_cmd() - send motion sense host command
135-
* @st: pointer to state information for device
136-
* @opt_length: optional length to reduce the response size, useful on the data
137-
* path. Otherwise, the maximal allowed response size is used
138-
*
139-
* When called, the sub-command is assumed to be set in param->cmd.
140-
*
141-
* Return: 0 on success, -errno on failure.
142-
*/
14394
int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,
14495
u16 opt_length);
14596

146-
/**
147-
* cros_ec_sensors_core_read() - function to request a value from the sensor
148-
* @st: pointer to state information for device
149-
* @chan: channel specification structure table
150-
* @val: will contain one element making up the returned value
151-
* @val2: will contain another element making up the returned value
152-
* @mask: specifies which values to be requested
153-
*
154-
* Return: the type of value returned by the device
155-
*/
15697
int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,
15798
struct iio_chan_spec const *chan,
15899
int *val, int *val2, long mask);
159100

160-
/**
161-
* cros_ec_sensors_core_read_avail() - get available values
162-
* @indio_dev: pointer to state information for device
163-
* @chan: channel specification structure table
164-
* @vals: list of available values
165-
* @type: type of data returned
166-
* @length: number of data returned in the array
167-
* @mask: specifies which values to be requested
168-
*
169-
* Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST
170-
*/
171101
int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev,
172102
struct iio_chan_spec const *chan,
173103
const int **vals,
174104
int *type,
175105
int *length,
176106
long mask);
177107

178-
/**
179-
* cros_ec_sensors_core_write() - function to write a value to the sensor
180-
* @st: pointer to state information for device
181-
* @chan: channel specification structure table
182-
* @val: first part of value to write
183-
* @val2: second part of value to write
184-
* @mask: specifies which values to write
185-
*
186-
* Return: the type of value returned by the device
187-
*/
188108
int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st,
189109
struct iio_chan_spec const *chan,
190110
int val, int val2, long mask);

0 commit comments

Comments
 (0)