Skip to content

Commit d5f499e

Browse files
lemreyeivindj-nordic
authored andcommitted
treewide: move const to the left
Move `const` keyword to the left to align with NCS/Zephyr. Signed-off-by: Emanuele Di Santo <[email protected]>
1 parent 5b846d6 commit d5f499e

File tree

52 files changed

+225
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+225
-225
lines changed

doc/nrf-bm/libraries/bluetooth/ble_scan.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ You can use the simple initialization with the default scanning and connection p
6666
6767
BLE_SCAN_DEF(ble_scan);
6868
69-
void scan_event_handler_func(struct ble_scan_evt const *scan_evt);
69+
void scan_event_handler_func(const struct ble_scan_evt *scan_evt);
7070
7171
uint32_t nrf_err;
7272
struct ble_scan_config scan_cfg = {
@@ -91,7 +91,7 @@ Example code:
9191
9292
BLE_SCAN_DEF(ble_scan);
9393
94-
void scan_event_handler_func(struct ble_scan_evt const *scan_evt);
94+
void scan_event_handler_func(const struct ble_scan_evt *scan_evt);
9595
9696
uint32_t nrf_err;
9797
struct ble_scan_config scan_cfg = {

drivers/bm_lpuarte/lpuarte.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ static void tx_timeout(void *context)
462462
lpu->callback(&tx_done_aborted_evt, lpu);
463463
}
464464

465-
static void nrfx_uarte_evt_handler(nrfx_uarte_event_t const *event, void *ctx)
465+
static void nrfx_uarte_evt_handler(const nrfx_uarte_event_t *event, void *ctx)
466466
{
467467
struct bm_lpuarte *lpu = ctx;
468468

@@ -563,7 +563,7 @@ void bm_lpuarte_uninit(struct bm_lpuarte *lpu)
563563
/* Don't uninitialize gpiote instances as they can be used by other drivers and libraries */
564564
}
565565

566-
int bm_lpuarte_tx(struct bm_lpuarte *lpu, uint8_t const *data, size_t len, int32_t timeout)
566+
int bm_lpuarte_tx(struct bm_lpuarte *lpu, const uint8_t *data, size_t len, int32_t timeout)
567567
{
568568
if (!lpu || !data) {
569569
return -EFAULT;

include/bm/bluetooth/ble_db_discovery.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ uint32_t ble_db_discovery_service_register(struct ble_db_discovery *db_discovery
261261
* @param[in] ble_evt BLE event received.
262262
* @param[in,out] context BLE DB discovery instance.
263263
*/
264-
void ble_db_discovery_on_ble_evt(ble_evt_t const *ble_evt, void *context);
264+
void ble_db_discovery_on_ble_evt(const ble_evt_t *ble_evt, void *context);
265265

266266
#endif /* BLE_DB_DISCOVERY_H__ */
267267

include/bm/bluetooth/ble_qwr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct ble_qwr_config {
164164
* @retval NRF_ERROR_NULL If @p qwr or @p qwr_init is @c NULL.
165165
* @retval NRF_ERROR_INVALID_STATE If the given @p qwr instance has already been initialized.
166166
*/
167-
uint32_t ble_qwr_init(struct ble_qwr *qwr, struct ble_qwr_config const *qwr_config);
167+
uint32_t ble_qwr_init(struct ble_qwr *qwr, const struct ble_qwr_config *qwr_config);
168168

169169
/**
170170
* @brief Function for assigning a connection handle to an instance of the Queued Writes module.
@@ -190,7 +190,7 @@ uint32_t ble_qwr_conn_handle_assign(struct ble_qwr *qwr, uint16_t conn_handle);
190190
* @param[in] ble_evt Event received from the BLE stack.
191191
* @param[in] context Queued Writes structure.
192192
*/
193-
void ble_qwr_on_ble_evt(ble_evt_t const *ble_evt, void *context);
193+
void ble_qwr_on_ble_evt(const ble_evt_t *ble_evt, void *context);
194194

195195
#if (CONFIG_BLE_QWR_MAX_ATTR > 0)
196196
/**

include/bm/bluetooth/ble_racp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ struct ble_racp_value {
117117
* @retval NRF_SUCCESS on success.
118118
* @retval NRF_ERROR_NULL if @p data or @p racp_val is NULL.
119119
*/
120-
uint32_t ble_racp_decode(uint8_t const *data, size_t data_len, struct ble_racp_value *racp_val);
120+
uint32_t ble_racp_decode(const uint8_t *data, size_t data_len, struct ble_racp_value *racp_val);
121121

122122
/**
123123
* @brief Encode a Record Access Control Point response.

include/bm/bluetooth/ble_scan.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct ble_scan_short_name {
118118
/**
119119
* @brief Pointer to the short name.
120120
*/
121-
char const *short_name;
121+
const char *short_name;
122122
/**
123123
* @brief Minimum length of the short name.
124124
*/
@@ -150,14 +150,14 @@ struct ble_scan_evt {
150150
/** Type of event. */
151151
enum ble_scan_evt_type evt_type;
152152
/** GAP scanning parameters. These parameter are needed to establish connection. */
153-
ble_gap_scan_params_t const *scan_params;
153+
const ble_gap_scan_params_t *scan_params;
154154
union {
155155
/** Scan filter match. */
156156
struct {
157157
/** Event structure for @ref BLE_GAP_EVT_ADV_REPORT. This data
158158
* allows the main application to establish connection.
159159
*/
160-
ble_gap_evt_adv_report_t const *adv_report;
160+
const ble_gap_evt_adv_report_t *adv_report;
161161
/** Matching filters. Information about matched filters. */
162162
struct ble_scan_filter_match filter_match;
163163
} filter_match;
@@ -166,17 +166,17 @@ struct ble_scan_evt {
166166
/** Advertising report event parameters for allow list. */
167167
struct {
168168
/** Advertising report */
169-
ble_gap_evt_adv_report_t const *report;
169+
const ble_gap_evt_adv_report_t *report;
170170
} allow_list_adv_report;
171171
/** Advertising report event parameters when filter is not found. */
172172
struct {
173173
/** Advertising report */
174-
ble_gap_evt_adv_report_t const *report;
174+
const ble_gap_evt_adv_report_t *report;
175175
} not_found;
176176
/** Connected event parameters. */
177177
struct {
178178
/** Connected event parameters. */
179-
ble_gap_evt_connected_t const *connected;
179+
const ble_gap_evt_connected_t *connected;
180180
/** Connection handle of the device on which the event occurred. */
181181
uint16_t conn_handle;
182182
} connected;
@@ -201,7 +201,7 @@ struct ble_scan_evt {
201201
/**
202202
* @brief BLE Scan event handler type.
203203
*/
204-
typedef void (*ble_scan_evt_handler_t)(struct ble_scan_evt const *scan_evt);
204+
typedef void (*ble_scan_evt_handler_t)(const struct ble_scan_evt *scan_evt);
205205

206206
#if defined(CONFIG_BLE_SCAN_FILTER)
207207

@@ -392,7 +392,7 @@ struct ble_scan {
392392
*
393393
* @return true if allow list is used.
394394
*/
395-
bool is_allow_list_used(struct ble_scan const *const scan_ctx);
395+
bool is_allow_list_used(const struct ble_scan *const scan_ctx);
396396

397397
/**
398398
* @brief Initialize the Scan library.
@@ -422,14 +422,14 @@ int ble_scan_init(struct ble_scan *scan, struct ble_scan_config *config);
422422
* @return This API propagates the error code returned by the
423423
* SoftDevice API @ref sd_ble_gap_scan_start.
424424
*/
425-
int ble_scan_start(struct ble_scan const *const scan_ctx);
425+
int ble_scan_start(const struct ble_scan *const scan_ctx);
426426

427427
/**
428428
* @brief Stop scanning.
429429
*
430430
* @param[in] scan_ctx Scan library instance.
431431
*/
432-
void ble_scan_stop(struct ble_scan const *const scan_ctx);
432+
void ble_scan_stop(const struct ble_scan *const scan_ctx);
433433

434434
#if defined(CONFIG_BLE_SCAN_FILTER)
435435

@@ -504,7 +504,7 @@ int ble_scan_filter_get(struct ble_scan *const scan_ctx, struct ble_scan_filters
504504
* @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If the BLE address type is invalid.
505505
*/
506506
int ble_scan_filter_add(struct ble_scan *const scan_ctx, uint8_t type,
507-
void const *data);
507+
const void *data);
508508

509509
/**
510510
* @brief Remove all filters.
@@ -533,15 +533,15 @@ int ble_scan_all_filter_remove(struct ble_scan *const scan_ctx);
533533
* @retval NRF_SUCCESS If parameters are changed successfully.
534534
* @retval NRF_ERROR_NULL If a NULL pointer is passed as input.
535535
*/
536-
int ble_scan_params_set(struct ble_scan *const scan_ctx, ble_gap_scan_params_t const *scan_params);
536+
int ble_scan_params_set(struct ble_scan *const scan_ctx, const ble_gap_scan_params_t *scan_params);
537537

538538
/**
539539
* @brief Handler for BLE stack events.
540540
*
541541
* @param[in] ble_evt BLE event.
542542
* @param[in,out] scan Scan library instance.
543543
*/
544-
void ble_scan_on_ble_evt(ble_evt_t const *ble_evt, void *scan);
544+
void ble_scan_on_ble_evt(const ble_evt_t *ble_evt, void *scan);
545545

546546
/**
547547
* @brief Convert the raw address to the SoftDevice GAP address.
@@ -559,7 +559,7 @@ void ble_scan_on_ble_evt(ble_evt_t const *ble_evt, void *scan);
559559
* @retval NRF_SUCCESS If the address is copied and converted successfully.
560560
*/
561561
int ble_scan_copy_addr_to_sd_gap_addr(ble_gap_addr_t *gap_addr,
562-
uint8_t const addr[BLE_GAP_ADDR_LEN]);
562+
const uint8_t addr[BLE_GAP_ADDR_LEN]);
563563

564564
#ifdef __cplusplus
565565
}

include/bm/bluetooth/services/ble_bms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ uint32_t ble_bms_init(struct ble_bms *bms, struct ble_bms_config *bms_config);
309309
* @param[in] ble_evt Event received from the BLE stack.
310310
* @param[in] context BMS structure.
311311
*/
312-
void ble_bms_on_ble_evt(ble_evt_t const *ble_evt, void *context);
312+
void ble_bms_on_ble_evt(const ble_evt_t *ble_evt, void *context);
313313

314314
/**
315315
* @brief Handle events from the @ref nrf_ble_qwr.

include/bm/bluetooth/services/ble_hids.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ struct ble_hids_link_ctx_storage {
209209
/**
210210
* @brief Maximum number of concurrent links.
211211
*/
212-
uint8_t const max_links_cnt;
212+
const uint8_t max_links_cnt;
213213
/**
214214
* @brief Context size in bytes for a single link (word-aligned).
215215
*/
216-
uint16_t const link_ctx_size;
216+
const uint16_t link_ctx_size;
217217
};
218218

219219
/* Forward declaration of ble_hids structure. */
@@ -296,7 +296,7 @@ struct ble_hids_evt {
296296
/**
297297
* @brief BLE event.
298298
*/
299-
ble_evt_t const *ble_evt;
299+
const ble_evt_t *ble_evt;
300300
/**
301301
* @brief Event parameters.
302302
*/
@@ -331,7 +331,7 @@ struct ble_hids_evt {
331331
/**
332332
* @brief Incoming data.
333333
*/
334-
uint8_t const *data;
334+
const uint8_t *data;
335335
} char_write;
336336
/**
337337
* @brief Parameters for @ref BLE_HIDS_EVT_REPORT_READ.
@@ -412,7 +412,7 @@ struct ble_hids_rep_map_config {
412412
/**
413413
* @brief Optional External Report Reference descriptor (will be added if != NULL).
414414
*/
415-
ble_uuid_t const *ext_rep_ref;
415+
const ble_uuid_t *ext_rep_ref;
416416
};
417417

418418
/** @brief HID Report characteristic structure. */
@@ -442,23 +442,23 @@ struct ble_hids_config {
442442
/**
443443
* @brief Information about the Input Report characteristics.
444444
*/
445-
struct ble_hids_report_config const *input_report;
445+
const struct ble_hids_report_config *input_report;
446446
/**
447447
* @brief Number of Output Report characteristics.
448448
*/
449449
uint8_t output_report_count;
450450
/**
451451
* @brief Information about the Output Report characteristics.
452452
*/
453-
struct ble_hids_report_config const *output_report;
453+
const struct ble_hids_report_config *output_report;
454454
/**
455455
* @brief Number of Feature Report characteristics.
456456
*/
457457
uint8_t feature_report_count;
458458
/**
459459
* @brief Information about the Feature Report characteristics.
460460
*/
461-
struct ble_hids_report_config const *feature_report;
461+
const struct ble_hids_report_config *feature_report;
462462
/**
463463
* @brief Information nedeed for initialization of the Report Map characteristic.
464464
*/
@@ -690,15 +690,15 @@ struct ble_hids {
690690
/**
691691
* @brief Information about the Input Report characteristics.
692692
*/
693-
struct ble_hids_report_config const *inp_rep_init_array;
693+
const struct ble_hids_report_config *inp_rep_init_array;
694694
/**
695695
* @brief Information about the Output Report characteristics.
696696
*/
697-
struct ble_hids_report_config const *outp_rep_init_array;
697+
const struct ble_hids_report_config *outp_rep_init_array;
698698
/**
699699
* @brief Information about the Feature Report characteristics.
700700
*/
701-
struct ble_hids_report_config const *feature_rep_init_array;
701+
const struct ble_hids_report_config *feature_rep_init_array;
702702
};
703703

704704
/**
@@ -712,7 +712,7 @@ struct ble_hids {
712712
* @param[in] ble_evt Event received from the BLE stack.
713713
* @param[in] context HID Service structure.
714714
*/
715-
void ble_hids_on_ble_evt(ble_evt_t const *ble_evt, void *context);
715+
void ble_hids_on_ble_evt(const ble_evt_t *ble_evt, void *context);
716716

717717
/**
718718
* @brief Function for initializing the HID Service.

include/bm/bluetooth/services/ble_hrs_central.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ uint32_t ble_hrs_central_init(struct ble_hrs_central *ble_hrs_central,
179179
* @param[in] ble_evt Bluetooth LE event.
180180
* @param[in] ctx Heart Rate Client structure.
181181
*/
182-
void ble_hrs_central_on_ble_evt(ble_evt_t const *ble_evt, void *ctx);
182+
void ble_hrs_central_on_ble_evt(const ble_evt_t *ble_evt, void *ctx);
183183

184184
/**
185185
* @brief Request the peer to start sending notification of Heart Rate Measurement.

include/bm/bluetooth/services/ble_nus.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern "C" {
3636
#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0003
3737

3838
/* Forward declaration */
39-
void ble_nus_on_ble_evt(ble_evt_t const *ble_evt, void *context);
39+
void ble_nus_on_ble_evt(const ble_evt_t *ble_evt, void *context);
4040

4141
/**
4242
* @brief Macro for defining a ble_nus instance.
@@ -129,7 +129,7 @@ struct ble_nus_evt {
129129
/** @ref BLE_NUS_EVT_RX_DATA event data. */
130130
struct {
131131
/** Pointer to the buffer with received data. */
132-
uint8_t const *data;
132+
const uint8_t *data;
133133
/** Length of received data. */
134134
uint16_t length;
135135
} rx_data;
@@ -207,7 +207,7 @@ struct ble_nus {
207207
* @retval NRF_ERROR_NULL If @p nus or @p nus_config is @c NULL.
208208
* @retval NRF_ERROR_INVALID_PARAM Invalid parameters.
209209
*/
210-
uint32_t ble_nus_init(struct ble_nus *nus, struct ble_nus_config const *nus_config);
210+
uint32_t ble_nus_init(struct ble_nus *nus, const struct ble_nus_config *nus_config);
211211

212212
/**
213213
* @brief Function for handling the Nordic UART Service's BLE events.
@@ -220,7 +220,7 @@ uint32_t ble_nus_init(struct ble_nus *nus, struct ble_nus_config const *nus_conf
220220
* @param[in] ble_evt Event received from the SoftDevice.
221221
* @param[in] context Nordic UART Service structure.
222222
*/
223-
void ble_nus_on_ble_evt(ble_evt_t const *ble_evt, void *context);
223+
void ble_nus_on_ble_evt(const ble_evt_t *ble_evt, void *context);
224224

225225
/**
226226
* @brief Function for sending data to the peer.

0 commit comments

Comments
 (0)