Skip to content

Commit 5513eaa

Browse files
committed
tests: drivers: power: max17616: Fix astyle errors
Fix astyle errors found on test files for the max17616 driver. Signed-off-by: Carlos Jones <[email protected]>
1 parent 186d212 commit 5513eaa

File tree

5 files changed

+70
-51
lines changed

5 files changed

+70
-51
lines changed

tests/drivers/power/max17616/test/support/test_iio_max17616_support.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@
4646
*/
4747
void iio_max17616_test_setup(void)
4848
{
49-
// Any test setup code can go here
50-
// Currently no specific setup needed
49+
// Any test setup code can go here
50+
// Currently no specific setup needed
5151
}
5252

5353
/**
5454
* @brief Teardown function for IIO MAX17616 tests
5555
*/
5656
void iio_max17616_test_teardown(void)
5757
{
58-
// Any test teardown code can go here
59-
// Currently no specific teardown needed
58+
// Any test teardown code can go here
59+
// Currently no specific teardown needed
6060
}

tests/drivers/power/max17616/test/support/test_max17616_support.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,16 @@ void max17616_test_teardown(void);
5757
* @param chip_id - Chip ID to set
5858
*/
5959
void max17616_test_device_setup(struct max17616_dev *device,
60-
struct no_os_i2c_desc *i2c_desc,
61-
enum max17616_chip_id chip_id);
60+
struct no_os_i2c_desc *i2c_desc,
61+
enum max17616_chip_id chip_id);
6262

6363
/**
6464
* @brief Validate telemetry structure
6565
* @param telemetry - Telemetry structure to validate
6666
* @return true if valid, false otherwise
6767
*/
68-
bool max17616_test_validate_telemetry(const struct max17616_telemetry *telemetry);
68+
bool max17616_test_validate_telemetry(const struct max17616_telemetry
69+
*telemetry);
6970

7071
/**
7172
* @brief Create test chip info structure

tests/drivers/power/max17616/test/test_iio_max17616.c

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ extern int max17616_iio_write_global_attr(void *device, char *buf, uint32_t len,
129129

130130
/* Mock callback for telemetry reading */
131131
static int mock_read_telemetry_all_callback(struct max17616_dev *dev,
132-
struct max17616_telemetry *telemetry,
133-
int num_calls)
132+
struct max17616_telemetry *telemetry,
133+
int num_calls)
134134
{
135135
if (telemetry && dev) {
136136
*telemetry = test_telemetry;
@@ -141,8 +141,8 @@ static int mock_read_telemetry_all_callback(struct max17616_dev *dev,
141141

142142
/* Mock callback for status reading */
143143
static int mock_read_status_callback(struct max17616_dev *dev,
144-
struct max17616_status *status,
145-
int num_calls)
144+
struct max17616_status *status,
145+
int num_calls)
146146
{
147147
if (status && dev) {
148148
*status = test_status;
@@ -159,7 +159,8 @@ static uint8_t mock_status_temp = 0;
159159
static uint8_t mock_status_cml = 0;
160160
static uint8_t mock_status_mfr = 0;
161161

162-
static int mock_read_status_vout_callback(struct max17616_dev *dev, uint8_t *status_vout, int num_calls)
162+
static int mock_read_status_vout_callback(struct max17616_dev *dev,
163+
uint8_t *status_vout, int num_calls)
163164
{
164165
if (status_vout && dev) {
165166
*status_vout = mock_status_vout;
@@ -168,7 +169,8 @@ static int mock_read_status_vout_callback(struct max17616_dev *dev, uint8_t *sta
168169
return -EINVAL;
169170
}
170171

171-
static int mock_read_status_iout_callback(struct max17616_dev *dev, uint8_t *status_iout, int num_calls)
172+
static int mock_read_status_iout_callback(struct max17616_dev *dev,
173+
uint8_t *status_iout, int num_calls)
172174
{
173175
if (status_iout && dev) {
174176
*status_iout = mock_status_iout;
@@ -177,7 +179,8 @@ static int mock_read_status_iout_callback(struct max17616_dev *dev, uint8_t *sta
177179
return -EINVAL;
178180
}
179181

180-
static int mock_read_status_input_callback(struct max17616_dev *dev, uint8_t *status_input, int num_calls)
182+
static int mock_read_status_input_callback(struct max17616_dev *dev,
183+
uint8_t *status_input, int num_calls)
181184
{
182185
if (status_input && dev) {
183186
*status_input = mock_status_input;
@@ -186,7 +189,8 @@ static int mock_read_status_input_callback(struct max17616_dev *dev, uint8_t *st
186189
return -EINVAL;
187190
}
188191

189-
static int mock_read_status_temperature_callback(struct max17616_dev *dev, uint8_t *status_temperature, int num_calls)
192+
static int mock_read_status_temperature_callback(struct max17616_dev *dev,
193+
uint8_t *status_temperature, int num_calls)
190194
{
191195
if (status_temperature && dev) {
192196
*status_temperature = mock_status_temp;
@@ -195,7 +199,8 @@ static int mock_read_status_temperature_callback(struct max17616_dev *dev, uint8
195199
return -EINVAL;
196200
}
197201

198-
static int mock_read_status_cml_callback(struct max17616_dev *dev, uint8_t *status_cml, int num_calls)
202+
static int mock_read_status_cml_callback(struct max17616_dev *dev,
203+
uint8_t *status_cml, int num_calls)
199204
{
200205
if (status_cml && dev) {
201206
*status_cml = mock_status_cml;
@@ -204,7 +209,9 @@ static int mock_read_status_cml_callback(struct max17616_dev *dev, uint8_t *stat
204209
return -EINVAL;
205210
}
206211

207-
static int mock_read_status_mfr_specific_callback(struct max17616_dev *dev, uint8_t *status_mfr, int num_calls)
212+
static int mock_read_status_mfr_specific_callback(struct max17616_dev *dev,
213+
uint8_t *status_mfr,
214+
int num_calls)
208215
{
209216
if (status_mfr && dev) {
210217
*status_mfr = mock_status_mfr;
@@ -221,7 +228,9 @@ static enum max17616_overcurrent_limit mock_istlim = MAX17616_OC_LIMIT_1_25;
221228
static enum max17616_nominal_voltage mock_nominal_voltage = MAX17616_NOMINAL_5V;
222229
static enum max17616_pgood_threshold mock_pgood_threshold = MAX17616_PGOOD_MINUS_10_PERCENT;
223230

224-
static int mock_get_current_limit_mode_callback(struct max17616_dev *dev, enum max17616_current_limit_mode *clmode, int num_calls)
231+
static int mock_get_current_limit_mode_callback(struct max17616_dev *dev,
232+
enum max17616_current_limit_mode *clmode,
233+
int num_calls)
225234
{
226235
if (clmode && dev) {
227236
*clmode = mock_clmode;
@@ -230,7 +239,9 @@ static int mock_get_current_limit_mode_callback(struct max17616_dev *dev, enum m
230239
return -EINVAL;
231240
}
232241

233-
static int mock_get_istart_ratio_callback(struct max17616_dev *dev, enum max17616_istart_ratio *istart_ratio, int num_calls)
242+
static int mock_get_istart_ratio_callback(struct max17616_dev *dev,
243+
enum max17616_istart_ratio *istart_ratio,
244+
int num_calls)
234245
{
235246
if (istart_ratio && dev) {
236247
*istart_ratio = mock_istart_ratio;
@@ -239,7 +250,9 @@ static int mock_get_istart_ratio_callback(struct max17616_dev *dev, enum max1761
239250
return -EINVAL;
240251
}
241252

242-
static int mock_get_overcurrent_timeout_callback(struct max17616_dev *dev, enum max17616_overcurrent_timeout *timeout, int num_calls)
253+
static int mock_get_overcurrent_timeout_callback(struct max17616_dev *dev,
254+
enum max17616_overcurrent_timeout *timeout,
255+
int num_calls)
243256
{
244257
if (timeout && dev) {
245258
*timeout = mock_tstoc;
@@ -248,7 +261,9 @@ static int mock_get_overcurrent_timeout_callback(struct max17616_dev *dev, enum
248261
return -EINVAL;
249262
}
250263

251-
static int mock_get_overcurrent_limit_callback(struct max17616_dev *dev, enum max17616_overcurrent_limit *istlim, int num_calls)
264+
static int mock_get_overcurrent_limit_callback(struct max17616_dev *dev,
265+
enum max17616_overcurrent_limit *istlim,
266+
int num_calls)
252267
{
253268
if (istlim && dev) {
254269
*istlim = mock_istlim;
@@ -274,7 +289,8 @@ static int mock_get_vout_uv_fault_limit_config_callback(struct max17616_dev *dev
274289
static bool mock_operation_state = false;
275290
static uint8_t mock_capability = 0;
276291

277-
static int mock_get_operation_state_callback(struct max17616_dev *dev, bool *enabled, int num_calls)
292+
static int mock_get_operation_state_callback(struct max17616_dev *dev,
293+
bool *enabled, int num_calls)
278294
{
279295
if (enabled && dev) {
280296
*enabled = mock_operation_state;
@@ -283,7 +299,8 @@ static int mock_get_operation_state_callback(struct max17616_dev *dev, bool *ena
283299
return -EINVAL;
284300
}
285301

286-
static int mock_read_capability_callback(struct max17616_dev *dev, uint8_t *capability, int num_calls)
302+
static int mock_read_capability_callback(struct max17616_dev *dev,
303+
uint8_t *capability, int num_calls)
287304
{
288305
if (capability && dev) {
289306
*capability = mock_capability;

tests/drivers/power/max17616/test/test_iio_max17616_internal.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@
4747

4848
/* External declaration for testing static function max17616_iio_read_attr */
4949
extern int max17616_iio_read_attr(void *device, char *buf, uint32_t len,
50-
const struct iio_ch_info *channel,
51-
intptr_t priv);
50+
const struct iio_ch_info *channel,
51+
intptr_t priv);
5252

5353
/* External declaration for testing static function max17616_iio_write_attr */
5454
extern int max17616_iio_write_attr(void *device, char *buf, uint32_t len,
55-
const struct iio_ch_info *channel,
56-
intptr_t priv);
55+
const struct iio_ch_info *channel,
56+
intptr_t priv);
5757

5858
/* External declaration for testing static function max17616_iio_read_global_attr */
5959
extern int max17616_iio_read_global_attr(void *device, char *buf, uint32_t len,
60-
const struct iio_ch_info *channel,
61-
intptr_t priv);
60+
const struct iio_ch_info *channel,
61+
intptr_t priv);
6262

6363
/* External declaration for testing static function max17616_iio_write_global_attr */
6464
extern int max17616_iio_write_global_attr(void *device, char *buf, uint32_t len,
65-
const struct iio_ch_info *channel,
66-
intptr_t priv);
65+
const struct iio_ch_info *channel,
66+
intptr_t priv);
6767

6868
/* Channel enumeration from iio_max17616.c - matches actual implementation */
6969
enum max17616_iio_channels {

tests/drivers/power/max17616/test/test_max17616.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ char os_malloc[512] = {0};
7171
* @brief Mock callback for no_os_i2c_read to simulate reading data
7272
*/
7373
static int32_t test_i2c_read_callback(struct no_os_i2c_desc* desc,
74-
uint8_t* data,
75-
uint8_t bytes_number, uint8_t stop_bit,
76-
int cmock_num_calls)
74+
uint8_t* data,
75+
uint8_t bytes_number, uint8_t stop_bit,
76+
int cmock_num_calls)
7777
{
78-
if (data && bytes_number > 0) {
79-
if (bytes_number == 1) {
80-
data[0] = test_expected_read_data;
81-
} else {
78+
if (data && bytes_number > 0) {
79+
if (bytes_number == 1) {
80+
data[0] = test_expected_read_data;
81+
} else {
8282
// Multi-byte read - copy from buffer
8383
uint8_t copy_length = (bytes_number <= test_expected_read_length) ?
8484
bytes_number : test_expected_read_length;
@@ -93,9 +93,9 @@ static int32_t test_i2c_read_callback(struct no_os_i2c_desc* desc,
9393
* sequential calls
9494
*/
9595
static int32_t test_i2c_read_init_callback(struct no_os_i2c_desc* desc,
96-
uint8_t* data, uint8_t bytes_number,
97-
uint8_t stop_bit,
98-
int cmock_num_calls)
96+
uint8_t* data, uint8_t bytes_number,
97+
uint8_t stop_bit,
98+
int cmock_num_calls)
9999
{
100100
// Handle different calls based on call count or cmock_num_calls
101101
switch (cmock_num_calls) {
@@ -148,9 +148,9 @@ static int32_t test_i2c_read_init_callback(struct no_os_i2c_desc* desc,
148148
* @brief Mock callback for I2C read that returns unknown device variant
149149
*/
150150
static int32_t test_i2c_read_unknown_device_callback(struct no_os_i2c_desc* desc,
151-
uint8_t* data, uint8_t bytes_number,
152-
uint8_t stop_bit,
153-
int cmock_num_calls)
151+
uint8_t* data, uint8_t bytes_number,
152+
uint8_t stop_bit,
153+
int cmock_num_calls)
154154
{
155155
switch (cmock_num_calls) {
156156
case 0: // First call - manufacturer ID (7 bytes) - succeeds with "MAXIM"
@@ -192,9 +192,9 @@ static int32_t test_i2c_read_unknown_device_callback(struct no_os_i2c_desc* desc
192192
* @brief Mock callback for I2C read that returns wrong manufacturer
193193
*/
194194
static int32_t test_i2c_read_wrong_mfr_callback(struct no_os_i2c_desc* desc,
195-
uint8_t* data, uint8_t bytes_number,
196-
uint8_t stop_bit,
197-
int cmock_num_calls)
195+
uint8_t* data, uint8_t bytes_number,
196+
uint8_t stop_bit,
197+
int cmock_num_calls)
198198
{
199199
switch (cmock_num_calls) {
200200
case 0: // First call - manufacturer ID (7 bytes) - returns wrong manufacturer
@@ -221,9 +221,9 @@ static int32_t test_i2c_read_wrong_mfr_callback(struct no_os_i2c_desc* desc,
221221
* @brief Mock callback for I2C read that returns wrong PMBus revision
222222
*/
223223
static int32_t test_i2c_read_wrong_pmbus_callback(struct no_os_i2c_desc* desc,
224-
uint8_t* data, uint8_t bytes_number,
225-
uint8_t stop_bit,
226-
int cmock_num_calls)
224+
uint8_t* data, uint8_t bytes_number,
225+
uint8_t stop_bit,
226+
int cmock_num_calls)
227227
{
228228
switch (cmock_num_calls) {
229229
case 0: // First call - manufacturer ID (7 bytes) - succeeds with "MAXIM"
@@ -529,7 +529,8 @@ void test_max17616_init_i2c_failure(void)
529529
}
530530

531531
/**
532-
* @brief Test max17616_init function with chip identification failure - unknown device variant
532+
* @brief Test max17616_init function with chip identification failure - unknown
533+
* device variant
533534
*/
534535
void test_max17616_init_unknown_device_variant(void)
535536
{

0 commit comments

Comments
 (0)