Skip to content

Commit 56791f0

Browse files
committed
Staging: echo: coding style cleanups
Some remaining coding style cleanups to the header files and the echo.c file. Cc: David Rowe <david@rowetel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent c8b3953 commit 56791f0

4 files changed

Lines changed: 67 additions & 63 deletions

File tree

‎drivers/staging/echo/echo.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ static inline void lms_adapt_bg(struct oslec_state *ec, int clean,
220220
}
221221
#endif
222222

223-
static __inline__ int top_bit(unsigned int bits)
223+
static inline int top_bit(unsigned int bits)
224224
{
225225
if (bits == 0)
226-
return -1;
227-
else
228-
return (int)fls((int32_t)bits)-1;
226+
return -1;
227+
else
228+
return (int)fls((int32_t)bits)-1;
229229
}
230230

231231
struct oslec_state *oslec_create(int len, int adaption_mode)
@@ -466,7 +466,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
466466
467467
factor = (2^30) * (2^-2) * clean_bg_rx/P
468468
469-
(30 - 2 - log2(P))
469+
(30 - 2 - log2(P))
470470
factor = clean_bg_rx 2 ----- (3)
471471
472472
To avoid a divide we approximate log2(P) as top_bit(P),

‎drivers/staging/echo/echo.h‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@
2828
#ifndef __ECHO_H
2929
#define __ECHO_H
3030

31-
/*! \page echo_can_page Line echo cancellation for voice
31+
/*
32+
Line echo cancellation for voice
33+
34+
What does it do?
3235
33-
\section echo_can_page_sec_1 What does it do?
3436
This module aims to provide G.168-2002 compliant echo cancellation, to remove
3537
electrical echoes (e.g. from 2-4 wire hybrids) from voice calls.
3638
37-
\section echo_can_page_sec_2 How does it work?
39+
40+
How does it work?
41+
3842
The heart of the echo cancellor is FIR filter. This is adapted to match the
3943
echo impulse response of the telephone line. It must be long enough to
4044
adequately cover the duration of that impulse response. The signal transmitted
@@ -108,7 +112,8 @@ major mis-convergence in the adaption process. An assessment algorithm is
108112
needed which produces a fairly accurate result from a very short burst of far
109113
end energy.
110114
111-
\section echo_can_page_sec_3 How do I use it?
115+
How do I use it?
116+
112117
The echo cancellor processes both the transmit and receive streams sample by
113118
sample. The processing function is not declared inline. Unfortunately,
114119
cancellation requires many operations per sample, so the call overhead is only
@@ -118,7 +123,7 @@ a minor burden.
118123
#include "fir.h"
119124
#include "oslec.h"
120125

121-
/*!
126+
/*
122127
G.168 echo canceller descriptor. This defines the working state for a line
123128
echo canceller.
124129
*/

‎drivers/staging/echo/fir.h‎

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@
2323
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2424
*/
2525

26-
/*! \page fir_page FIR filtering
27-
\section fir_page_sec_1 What does it do?
28-
???.
29-
30-
\section fir_page_sec_2 How does it work?
31-
???.
32-
*/
33-
3426
#if !defined(_FIR_H_)
3527
#define _FIR_H_
3628

@@ -62,33 +54,33 @@
6254
can.
6355
*/
6456

65-
/*!
66-
16 bit integer FIR descriptor. This defines the working state for a single
67-
instance of an FIR filter using 16 bit integer coefficients.
68-
*/
57+
/*
58+
* 16 bit integer FIR descriptor. This defines the working state for a single
59+
* instance of an FIR filter using 16 bit integer coefficients.
60+
*/
6961
struct fir16_state_t {
7062
int taps;
7163
int curr_pos;
7264
const int16_t *coeffs;
7365
int16_t *history;
7466
};
7567

76-
/*!
77-
32 bit integer FIR descriptor. This defines the working state for a single
78-
instance of an FIR filter using 32 bit integer coefficients, and filtering
79-
16 bit integer data.
80-
*/
68+
/*
69+
* 32 bit integer FIR descriptor. This defines the working state for a single
70+
* instance of an FIR filter using 32 bit integer coefficients, and filtering
71+
* 16 bit integer data.
72+
*/
8173
struct fir32_state_t {
8274
int taps;
8375
int curr_pos;
8476
const int32_t *coeffs;
8577
int16_t *history;
8678
};
8779

88-
/*!
89-
Floating point FIR descriptor. This defines the working state for a single
90-
instance of an FIR filter using floating point coefficients and data.
91-
*/
80+
/*
81+
* Floating point FIR descriptor. This defines the working state for a single
82+
* instance of an FIR filter using floating point coefficients and data.
83+
*/
9284
struct fir_float_state_t {
9385
int taps;
9486
int curr_pos;
@@ -222,4 +214,3 @@ static inline int16_t fir32(struct fir32_state_t *fir, int16_t sample)
222214
}
223215

224216
#endif
225-
/*- End of file ------------------------------------------------------------*/

‎drivers/staging/echo/oslec.h‎

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#ifndef __OSLEC_H
2828
#define __OSLEC_H
2929

30-
/* TODO: document interface */
31-
3230
/* Mask bits for the adaption mode */
3331
#define ECHO_CAN_USE_ADAPTION 0x01
3432
#define ECHO_CAN_USE_NLP 0x02
@@ -38,49 +36,59 @@
3836
#define ECHO_CAN_USE_RX_HPF 0x20
3937
#define ECHO_CAN_DISABLE 0x40
4038

41-
/*!
42-
G.168 echo canceller descriptor. This defines the working state for a line
43-
echo canceller.
44-
*/
39+
/**
40+
* oslec_state: G.168 echo canceller descriptor.
41+
*
42+
* This defines the working state for a line echo canceller.
43+
*/
4544
struct oslec_state;
4645

47-
/*! Create a voice echo canceller context.
48-
\param len The length of the canceller, in samples.
49-
\return The new canceller context, or NULL if the canceller could not be created.
50-
*/
46+
/**
47+
* oslec_create - Create a voice echo canceller context.
48+
* @len: The length of the canceller, in samples.
49+
* @return: The new canceller context, or NULL if the canceller could not be
50+
* created.
51+
*/
5152
struct oslec_state *oslec_create(int len, int adaption_mode);
5253

53-
/*! Free a voice echo canceller context.
54-
\param ec The echo canceller context.
55-
*/
54+
/**
55+
* oslec_free - Free a voice echo canceller context.
56+
* @ec: The echo canceller context.
57+
*/
5658
void oslec_free(struct oslec_state *ec);
5759

58-
/*! Flush (reinitialise) a voice echo canceller context.
59-
\param ec The echo canceller context.
60-
*/
60+
/**
61+
* oslec_flush - Flush (reinitialise) a voice echo canceller context.
62+
* @ec: The echo canceller context.
63+
*/
6164
void oslec_flush(struct oslec_state *ec);
6265

63-
/*! Set the adaption mode of a voice echo canceller context.
64-
\param ec The echo canceller context.
65-
\param adapt The mode.
66-
*/
66+
/**
67+
* oslec_adaption_mode - set the adaption mode of a voice echo canceller context.
68+
* @ec The echo canceller context.
69+
* @adaption_mode: The mode.
70+
*/
6771
void oslec_adaption_mode(struct oslec_state *ec, int adaption_mode);
6872

6973
void oslec_snapshot(struct oslec_state *ec);
7074

71-
/*! Process a sample through a voice echo canceller.
72-
\param ec The echo canceller context.
73-
\param tx The transmitted audio sample.
74-
\param rx The received audio sample.
75-
\return The clean (echo cancelled) received sample.
76-
*/
75+
/**
76+
* oslec_update: Process a sample through a voice echo canceller.
77+
* @ec: The echo canceller context.
78+
* @tx: The transmitted audio sample.
79+
* @rx: The received audio sample.
80+
*
81+
* The return value is the clean (echo cancelled) received sample.
82+
*/
7783
int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx);
7884

79-
/*! Process to high pass filter the tx signal.
80-
\param ec The echo canceller context.
81-
\param tx The transmitted auio sample.
82-
\return The HP filtered transmit sample, send this to your D/A.
83-
*/
85+
/**
86+
* oslec_hpf_tx: Process to high pass filter the tx signal.
87+
* @ec: The echo canceller context.
88+
* @tx: The transmitted auio sample.
89+
*
90+
* The return value is the HP filtered transmit sample, send this to your D/A.
91+
*/
8492
int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx);
8593

8694
#endif /* __OSLEC_H */

0 commit comments

Comments
 (0)