From: Michal Bloch Date: Tue, 29 Jun 2021 18:22:46 +0000 (+0200) Subject: Linting: storage and const correctness X-Git-Tag: submit/tizen/20210705.023617~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F260609%2F2;p=platform%2Fcore%2Fapi%2Fperipheral-io.git Linting: storage and const correctness Change-Id: I0c52f2e1e0642e1bbb48d3a02cb7f4cec6991747 Signed-off-by: Michal Bloch --- diff --git a/src/peripheral_gpio.c b/src/peripheral_gpio.c index 3d92be5..b77bcdb 100644 --- a/src/peripheral_gpio.c +++ b/src/peripheral_gpio.c @@ -210,7 +210,7 @@ static int peripheral_gpio_set_initial_direction_into_handle(peripheral_gpio_h g static int peripheral_gpio_set_initial_edge_into_handle(peripheral_gpio_h gpio) { - static predefined_type_s types[4] = { + static const predefined_type_s types[4] = { {"none", 4}, {"rising", 6}, {"falling", 7}, @@ -344,7 +344,7 @@ int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direct RETV_IF(gpio->direction == direction, PERIPHERAL_ERROR_NONE); RETV_IF(gpio->edge != PERIPHERAL_GPIO_EDGE_NONE, PERIPHERAL_ERROR_IO_ERROR); - static predefined_type_s types[3] = { + static const predefined_type_s types[3] = { {"in", 2}, {"high", 4}, {"low", 3} @@ -379,7 +379,7 @@ int peripheral_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e RETV_IF(gpio->edge == edge, PERIPHERAL_ERROR_NONE); RETV_IF(gpio->direction != PERIPHERAL_GPIO_DIRECTION_IN, PERIPHERAL_ERROR_IO_ERROR); - static predefined_type_s types[4] = { + static const predefined_type_s types[4] = { {"none", 4}, {"rising", 6}, {"falling", 7}, @@ -549,7 +549,7 @@ int peripheral_gpio_write(peripheral_gpio_h gpio, uint32_t value) */ RETV_IF(gpio->direction == PERIPHERAL_GPIO_DIRECTION_IN, PERIPHERAL_ERROR_IO_ERROR); - static predefined_type_s types[2] = { + static const predefined_type_s types[2] = { {"0", 1}, {"1", 1} }; diff --git a/src/peripheral_pwm.c b/src/peripheral_pwm.c index 80b2907..cedab7a 100644 --- a/src/peripheral_pwm.c +++ b/src/peripheral_pwm.c @@ -286,7 +286,7 @@ int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL"); RETVM_IF((polarity < PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH) || (polarity > PERIPHERAL_PWM_POLARITY_ACTIVE_LOW), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid polarity parameter"); - static predefined_type_s types[2] = { + static const predefined_type_s types[2] = { {"normal", 6}, {"inversed", 8} }; @@ -302,7 +302,7 @@ int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, bool enable) RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "PWM feature is not supported"); RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL"); - static predefined_type_s types[2] = { + static const predefined_type_s types[2] = { {"0", 1}, {"1", 1} }; diff --git a/src/peripheral_uart.c b/src/peripheral_uart.c index 6a649df..11a5e9a 100644 --- a/src/peripheral_uart.c +++ b/src/peripheral_uart.c @@ -82,7 +82,7 @@ int peripheral_uart_open_flags(int port, peripheral_open_flags_e flags, peripher return PERIPHERAL_ERROR_OUT_OF_MEMORY; } - const char *sysfs_uart_path[] = { + static const char *const sysfs_uart_path[] = { "/dev/ttyS", "/dev/ttyAMA", "/dev/ttySAC",