Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused function warnings #83830

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmake/compiler/clang/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ check_set_compiler_property(PROPERTY warning_extended
-Wno-missing-braces
-Wno-self-assign
-Wno-address-of-packed-member
-Wno-unused-function
-Wno-initializer-overrides
-Wno-section
-Wno-unknown-warning-option
Expand Down
5 changes: 0 additions & 5 deletions drivers/dma/dma_emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ static void dma_emul_work_handler(struct k_work *work);

LOG_MODULE_REGISTER(dma_emul, CONFIG_DMA_LOG_LEVEL);

static inline bool dma_emul_xfer_is_error_status(int status)
{
return status < 0;
}

static inline const char *const dma_emul_channel_state_to_string(enum dma_emul_channel_state state)
{
switch (state) {
Expand Down
6 changes: 2 additions & 4 deletions drivers/flash/spi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ static inline void record_entered_dpd(const struct device *const dev)
#endif
}

#if ANY_INST_HAS_DPD
/* Check the current time against the time DPD was entered and delay
* until it's ok to initiate the DPD exit process.
*/
static inline void delay_until_exit_dpd_ok(const struct device *const dev)
{
#if ANY_INST_HAS_DPD
const struct spi_nor_config *const driver_config = dev->config;

if (driver_config->dpd_exist) {
Expand Down Expand Up @@ -333,10 +333,8 @@ static inline void delay_until_exit_dpd_ok(const struct device *const dev)
}
}
}
#else
ARG_UNUSED(dev);
#endif /* ANY_INST_HAS_DPD */
}
#endif /* ANY_INST_HAS_DPD */

/* Indicates that an access command includes bytes for the address.
* If not provided the opcode is not followed by address bytes.
Expand Down
42 changes: 0 additions & 42 deletions drivers/gpio/gpio_pca95xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,38 +117,6 @@ struct gpio_pca95xx_drv_data {
#endif
};

static int read_port_reg(const struct device *dev, uint8_t reg, uint8_t pin,
uint16_t *cache, uint16_t *buf)
{
const struct gpio_pca95xx_config * const config = dev->config;
uint8_t b_buf;
int ret;

if (pin >= 8) {
reg++;
}

ret = i2c_reg_read_byte_dt(&config->bus, reg, &b_buf);
if (ret != 0) {
LOG_ERR("PCA95XX[0x%X]: error reading register 0x%X (%d)",
config->bus.addr, reg, ret);
return ret;
}

if (pin < 8) {
((uint8_t *)cache)[LOW_BYTE_LE16_IDX] = b_buf;
} else {
((uint8_t *)cache)[HIGH_BYTE_LE16_IDX] = b_buf;
}

*buf = *cache;

LOG_DBG("PCA95XX[0x%X]: Read: REG[0x%X] = 0x%X",
config->bus.addr, reg, b_buf);

return 0;
}

/**
* @brief Read both port 0 and port 1 registers of certain register function.
*
Expand Down Expand Up @@ -253,16 +221,6 @@ static int write_port_regs(const struct device *dev, uint8_t reg,
return ret;
}

static inline int update_input_reg(const struct device *dev, uint8_t pin,
uint16_t *buf)
{
struct gpio_pca95xx_drv_data * const drv_data =
(struct gpio_pca95xx_drv_data * const)dev->data;

return read_port_reg(dev, REG_INPUT_PORT0, pin,
&drv_data->reg_cache.input, buf);
}

static inline int update_input_regs(const struct device *dev, uint16_t *buf)
{
struct gpio_pca95xx_drv_data * const drv_data =
Expand Down
10 changes: 0 additions & 10 deletions drivers/ieee802154/ieee802154_dw1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,6 @@ static inline uint32_t dwt_reg_read_u32(const struct device *dev,
return sys_get_le32(buf);
}

static inline uint16_t dwt_reg_read_u16(const struct device *dev,
uint8_t reg, uint16_t offset)
{
uint8_t buf[sizeof(uint16_t)];

dwt_spi_transfer(dev, reg, offset, sizeof(buf), buf, false);

return sys_get_le16(buf);
}

static inline uint8_t dwt_reg_read_u8(const struct device *dev,
uint8_t reg, uint16_t offset)
{
Expand Down
6 changes: 0 additions & 6 deletions drivers/modem/modem_cmd_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ static bool starts_with(struct net_buf *buf, const char *str)
* Cmd Handler Functions
*/

static inline struct net_buf *read_rx_allocator(k_timeout_t timeout,
void *user_data)
{
return net_buf_alloc((struct net_buf_pool *)user_data, timeout);
}

/* return scanned length for params */
static int parse_params(struct modem_cmd_handler_data *data, size_t match_len,
const struct modem_cmd *cmd,
Expand Down
14 changes: 0 additions & 14 deletions drivers/sensor/st/iis2iclx/iis2iclx.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ static int iis2iclx_accel_range_to_fs_val(int32_t range)
return -EINVAL;
}

static inline int iis2iclx_reboot(const struct device *dev)
{
const struct iis2iclx_config *cfg = dev->config;

if (iis2iclx_boot_set((stmdev_ctx_t *)&cfg->ctx, 1) < 0) {
return -EIO;
}

/* Wait sensor turn-on time as per datasheet */
k_msleep(35);

return 0;
}

static int iis2iclx_accel_set_fs_raw(const struct device *dev, uint8_t fs)
{
const struct iis2iclx_config *cfg = dev->config;
Expand Down
14 changes: 0 additions & 14 deletions drivers/sensor/st/ism330dhcx/ism330dhcx.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,6 @@ static int ism330dhcx_gyro_range_to_fs_val(int32_t range)
return -EINVAL;
}

static inline int ism330dhcx_reboot(const struct device *dev)
{
struct ism330dhcx_data *data = dev->data;

if (ism330dhcx_boot_set(data->ctx, 1) < 0) {
return -EIO;
}

/* Wait sensor turn-on time as per datasheet */
k_busy_wait(35 * USEC_PER_MSEC);

return 0;
}

static int ism330dhcx_accel_set_fs_raw(const struct device *dev, uint8_t fs)
{
struct ism330dhcx_data *data = dev->data;
Expand Down
4 changes: 2 additions & 2 deletions drivers/sensor/st/lis2dw12/lis2dw12.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ static int lis2dw12_config(const struct device *dev, enum sensor_channel chan,
}


#if (CONFIG_LIS2DW12_SLEEP || CONFIG_LIS2DW12_WAKEUP)

static inline int32_t sensor_ms2_to_mg(const struct sensor_value *ms2)
{
int64_t nano_ms2 = (ms2->val1 * 1000000LL + ms2->val2) * 1000LL;
Expand All @@ -202,8 +204,6 @@ static inline int32_t sensor_ms2_to_mg(const struct sensor_value *ms2)
}
}

#if (CONFIG_LIS2DW12_SLEEP || CONFIG_LIS2DW12_WAKEUP)

/* Converts a lis2dw12_fs_t range to its value in milli-g
* Range can be 2/4/8/16G
*/
Expand Down
15 changes: 0 additions & 15 deletions drivers/sensor/st/lsm6dso/lsm6dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,6 @@ static int lsm6dso_gyro_range_to_fs_val(int32_t range)
return -EINVAL;
}

static inline int lsm6dso_reboot(const struct device *dev)
{
const struct lsm6dso_config *cfg = dev->config;
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;

if (lsm6dso_boot_set(ctx, 1) < 0) {
return -EIO;
}

/* Wait sensor turn-on time as per datasheet */
k_busy_wait(35 * USEC_PER_MSEC);

return 0;
}

static int lsm6dso_accel_set_fs_raw(const struct device *dev, uint8_t fs)
{
const struct lsm6dso_config *cfg = dev->config;
Expand Down
15 changes: 0 additions & 15 deletions drivers/sensor/st/lsm6dso16is/lsm6dso16is.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,6 @@ static int lsm6dso16is_gyro_range_to_fs_val(int32_t range)
return -EINVAL;
}

static inline int lsm6dso16is_reboot(const struct device *dev)
{
const struct lsm6dso16is_config *cfg = dev->config;
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;

if (lsm6dso16is_boot_set(ctx, 1) < 0) {
return -EIO;
}

/* Wait sensor turn-on time as per datasheet */
k_sleep(K_MSEC(35)); /* turn-on time in ms */

return 0;
}

static int lsm6dso16is_accel_set_fs_raw(const struct device *dev, uint8_t fs)
{
const struct lsm6dso16is_config *cfg = dev->config;
Expand Down
5 changes: 2 additions & 3 deletions drivers/sensor/st/lsm9ds0_mfd/lsm9ds0_mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static inline int lsm9ds0_mfd_reboot_memory(const struct device *dev)
return 0;
}

#if !defined(LSM9DS0_MFD_ACCEL_DISABLED)
#if !defined(LSM9DS0_MFD_ACCEL_DISABLED) && defined(CONFIG_LSM9DS0_MFD_ACCEL_SAMPLING_RATE_RUNTIME)

static inline int lsm9ds0_mfd_accel_set_odr_raw(const struct device *dev,
uint8_t odr)
{
Expand All @@ -49,7 +50,6 @@ static inline int lsm9ds0_mfd_accel_set_odr_raw(const struct device *dev,
odr << LSM9DS0_MFD_SHIFT_CTRL_REG1_XM_AODR);
}

#if defined(CONFIG_LSM9DS0_MFD_ACCEL_SAMPLING_RATE_RUNTIME)
static const struct {
int freq_int;
int freq_micro;
Expand Down Expand Up @@ -122,7 +122,6 @@ static int lsm9ds0_mfd_accel_set_fs(const struct device *dev, int val)
return -ENOTSUP;
}
#endif
#endif

#if !defined(LSM9DS0_MFD_MAGN_DISABLED)
static inline int lsm9ds0_mfd_magn_set_odr_raw(const struct device *dev,
Expand Down
15 changes: 0 additions & 15 deletions subsys/net/ip/ipv6_nbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,6 @@ static inline struct net_nbr *get_nbr(int idx)
return &net_neighbor_pool[idx].nbr;
}

static inline struct net_nbr *get_nbr_from_data(struct net_ipv6_nbr_data *data)
{
int i;

for (i = 0; i < CONFIG_NET_IPV6_MAX_NEIGHBORS; i++) {
struct net_nbr *nbr = get_nbr(i);

if (nbr->data == (uint8_t *)data) {
return nbr;
}
}

return NULL;
}

static void ipv6_nbr_set_state(struct net_nbr *nbr,
enum net_ipv6_nbr_state new_state)
{
Expand Down
10 changes: 0 additions & 10 deletions subsys/net/ip/net_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,6 @@ struct net_buf *net_pkt_get_reserve_tx_data(size_t min_len, k_timeout_t timeout)


#if defined(CONFIG_NET_CONTEXT_NET_PKT_POOL)
static inline struct k_mem_slab *get_tx_slab(struct net_context *context)
{
if (context->tx_slab) {
return context->tx_slab();
}

return NULL;
}

static inline struct net_buf_pool *get_data_pool(struct net_context *context)
{
if (context->data_pool) {
Expand All @@ -511,7 +502,6 @@ static inline struct net_buf_pool *get_data_pool(struct net_context *context)
return NULL;
}
#else
#define get_tx_slab(...) NULL
#define get_data_pool(...) NULL
#endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */

Expand Down
2 changes: 1 addition & 1 deletion subsys/net/ip/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ uint16_t calc_chksum(uint16_t sum_in, const uint8_t *data, size_t len)
}
}

#if defined(CONFIG_NET_NATIVE_IP)
static inline uint16_t pkt_calc_chksum(struct net_pkt *pkt, uint16_t sum)
{
struct net_pkt_cursor *cur = &pkt->cursor;
Expand Down Expand Up @@ -634,7 +635,6 @@ static inline uint16_t pkt_calc_chksum(struct net_pkt *pkt, uint16_t sum)
return sum;
}

#if defined(CONFIG_NET_NATIVE_IP)
uint16_t net_calc_chksum(struct net_pkt *pkt, uint8_t proto)
{
size_t len = 0U;
Expand Down
16 changes: 0 additions & 16 deletions subsys/net/lib/coap/coap_link_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,6 @@ static inline bool append_u8(struct coap_packet *cpkt, uint8_t data)
return true;
}

static inline bool append_be16(struct coap_packet *cpkt, uint16_t data)
{
if (!cpkt) {
return false;
}

if (cpkt->max_len - cpkt->offset < 2) {
return false;
}

cpkt->data[cpkt->offset++] = data >> 8;
cpkt->data[cpkt->offset++] = (uint8_t) data;

return true;
}

static inline bool append(struct coap_packet *cpkt, const uint8_t *data, uint16_t len)
{
if (!cpkt || !data) {
Expand Down
5 changes: 0 additions & 5 deletions subsys/net/lib/http/http_hpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ static inline bool http_hpack_key_is_static(uint32_t key)
return key > HTTP_SERVER_HPACK_INVALID && key <= HTTP_SERVER_HPACK_WWW_AUTHENTICATE;
}

static inline bool http_hpack_key_is_dynamic(uint32_t key)
{
return key > HTTP_SERVER_HPACK_WWW_AUTHENTICATE;
}

struct hpack_table_entry {
const char *name;
const char *value;
Expand Down
18 changes: 0 additions & 18 deletions tests/net/arp/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,6 @@ static int tester_send(const struct device *dev, struct net_pkt *pkt)
return 0;
}

static inline struct in_addr *if_get_addr(struct net_if *iface)
{
int i;

for (i = 0; i < NET_IF_MAX_IPV4_ADDR; i++) {
if (iface->config.ip.ipv4->unicast[i].ipv4.is_used &&
iface->config.ip.ipv4->unicast[i].ipv4.address.family ==
AF_INET &&
iface->config.ip.ipv4->unicast[i].ipv4.addr_state ==
NET_ADDR_PREFERRED) {
return
&iface->config.ip.ipv4->unicast[i].ipv4.address.in_addr;
}
}

return NULL;
}

static inline struct net_pkt *prepare_arp_reply(struct net_if *iface,
struct net_pkt *req,
struct net_eth_addr *addr,
Expand Down
Loading
Loading