From: Chanwoo Choi Date: Tue, 12 Sep 2017 04:09:51 +0000 (+0900) Subject: pass: Fix the checkpatch's warning to keep the coding style X-Git-Tag: submit/tizen/20170915.013740~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f212e347250b0ba504e9ec9626705f68aa335f53;p=platform%2Fcore%2Fsystem%2Fpass.git pass: Fix the checkpatch's warning to keep the coding style This patch just fixes the following checkpatch's warnings. [Warning results from Tizen's checkpatch] src/pass/pass-parser.c: :210: ERROR: [IDT_M_TAB] code indent should use tabs where possible :210: ERROR: [IDT_M_TAB] please, no spaces at the start of a line :480: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :483: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :615: ERROR: [SPC_M_OPR] spaces required around that '=' (ctx:WxV) src/pass/pass.c :355: ERROR: [IDT_M_TAB] please, no space before tabs :366: ERROR: [IDT_M_TAB] please, no space before tabs src/pass/pass-gov.c :387: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' src/core/device-notifier.c :32: ERROR: [BRC_M_FTN] open brace '{' following function declarations go on the next line src/pmqos/pmqos.c :92: WARNING: [BRC_R_SST] braces {} are not necessary for any arm of this statement src/shared/log.h :28: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :29: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :30: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :31: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' src/pass/pass.h :408: ERROR: [SPC_M_SEP] space prohibited after that open parenthesis '(' :408: ERROR: [SPC_M_SEP] space prohibited before that close parenthesis ')' :409: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :409: ERROR: [SPC_M_OPR] space required after that ';' (ctx:VxV) :409: ERROR: [SPC_M_SEP] space prohibited after that open parenthesis '(' :409: ERROR: [SPC_M_SEP] space prohibited before that close parenthesis ')' src/core/config-parser.h :40: ERROR: [IDT_M_TAB] please, no spaces at the start of a line src/core/devices.h :116: ERROR: [SPC_M_OPR] spaces required around that '?' (ctx:VxW) :119: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :120: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :123: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :124: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' src/core/common.h :115: ERROR: [IDT_M_TAB] code indent should use tabs where possible src/core/common.h:115: ERROR: [IDT_M_TAB] please, no spaces at the start of a line src/core/common.h:116: ERROR: [IDT_M_TAB] code indent should use tabs where possible src/core/common.h:116: ERROR: [IDT_M_TAB] please, no spaces at the start of a line src/core/common.h:117: ERROR: [IDT_M_TAB] code indent should use tabs where possible src/core/common.h:117: ERROR: [IDT_M_TAB] please, no spaces at the start of a line src/core/common.h:118: ERROR: [IDT_M_TAB] code indent should use tabs where possible src/core/common.h:118: ERROR: [IDT_M_TAB] please, no spaces at the start of a line src/hal/hal-log.h :29: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :30: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :31: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :32: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :33: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :34: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :35: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' :36: ERROR: [SPC_M_KWD] space required before the open parenthesis '(' src/hal/hal.h :26: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :26: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :26: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :29: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :29: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :29: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :29: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :29: ERROR: [SPC_M_OPR] space required after that ',' (ctx:Vx ) :29: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :31: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :31: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) :31: ERROR: [SPC_M_OPR] space required after that ',' (ctx:VxV) Change-Id: I9bfb0db97b825e00d89487929037f833ecc0f156 Signed-off-by: Chanwoo Choi --- diff --git a/src/core/common.h b/src/core/common.h index 6601117..46c7490 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -112,10 +112,10 @@ static inline void safe_free_memory(void** mem) } #define ret_value_if(expr, val) do { \ - if (expr) { \ - _E("(%s)", #expr); \ - return (val); \ - } \ + if (expr) { \ + _E("(%s)", #expr); \ + return (val); \ + } \ } while (0) #define ret_value_msg_if(expr, val, fmt, arg...) do { \ diff --git a/src/core/config-parser.h b/src/core/config-parser.h index 66b72ec..32a0d9b 100644 --- a/src/core/config-parser.h +++ b/src/core/config-parser.h @@ -37,6 +37,6 @@ struct parse_result { * @return 0 on success, negative if failed */ int config_parse(const char *file_name, int cb(struct parse_result *result, - void *user_data), void *user_data); + void *user_data), void *user_data); #endif diff --git a/src/core/device-notifier.c b/src/core/device-notifier.c index e88b9e7..4a03ead 100644 --- a/src/core/device-notifier.c +++ b/src/core/device-notifier.c @@ -29,7 +29,8 @@ static GList *device_notifier_list; static guint idle_func_id = 0; static struct device_notifier device_notifiers[DEVICE_NOTIFIER_MAX_COUNT]; -static struct device_notifier *get_device_notifier(void) { +static struct device_notifier *get_device_notifier(void) +{ static int pos = 0; if ((pos < DEVICE_NOTIFIER_MAX_COUNT) && diff --git a/src/core/devices.h b/src/core/devices.h index d7b8d9a..38bad23 100644 --- a/src/core/devices.h +++ b/src/core/devices.h @@ -112,15 +112,14 @@ void remove_device(const struct device_ops *dev); const struct device_ops *find_device(const char *name); int check_default(const struct device_ops *dev); -#define NOT_SUPPORT_OPS(dev) \ - ((check_default(dev))? 1 : 0) +#define NOT_SUPPORT_OPS(dev) ((check_default(dev)) ? 1 : 0) #define FIND_DEVICE_INT(dev, name) do { \ - if (!dev) dev = find_device(name); if(check_default(dev)) return -ENODEV; \ -} while(0) + if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \ +} while (0) #define FIND_DEVICE_VOID(dev, name) do { \ - if (!dev) dev = find_device(name); if(check_default(dev)) return; \ -} while(0) + if (!dev) dev = find_device(name); if (check_default(dev)) return; \ +} while (0) #endif diff --git a/src/hal/hal-log.h b/src/hal/hal-log.h index 3590ab5..7c7771e 100644 --- a/src/hal/hal-log.h +++ b/src/hal/hal-log.h @@ -25,14 +25,13 @@ #define LOG_TAG "PASS" #endif /* LOG_TAG */ - -#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while(0) -#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while(0) -#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while(0) -#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while(0) -#define _SD(fmt, arg...) do { SECURE_SLOGD(fmt, ##arg); } while(0) -#define _SI(fmt, arg...) do { SECURE_SLOGI(fmt, ##arg); } while(0) -#define _SW(fmt, arg...) do { SECURE_SLOGW(fmt, ##arg); } while(0) -#define _SE(fmt, arg...) do { SECURE_SLOGE(fmt, ##arg); } while(0) +#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while (0) +#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while (0) +#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while (0) +#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while (0) +#define _SD(fmt, arg...) do { SECURE_SLOGD(fmt, ##arg); } while (0) +#define _SI(fmt, arg...) do { SECURE_SLOGI(fmt, ##arg); } while (0) +#define _SW(fmt, arg...) do { SECURE_SLOGW(fmt, ##arg); } while (0) +#define _SE(fmt, arg...) do { SECURE_SLOGE(fmt, ##arg); } while (0) #endif /* __HAL_LOG_H__ */ diff --git a/src/hal/hal.h b/src/hal/hal.h index 5cae596..b9e2699 100644 --- a/src/hal/hal.h +++ b/src/hal/hal.h @@ -23,12 +23,12 @@ #define BUFF_MAX 255 -#define MAKE_4B_CODE_4(A,B,C,D) \ - ((((A) & 0xff) << 24) | (((B) & 0xff) << 16) | \ +#define MAKE_4B_CODE_4(A, B, C, D) \ + ((((A) & 0xff) << 24) | (((B) & 0xff) << 16) | \ (((C) & 0xff) << 8) | (((D) & 0xff))) -#define MAKE_TAG_CONSTANT(A,B,C,D) MAKE_4B_CODE_4(A,B,C,D) +#define MAKE_TAG_CONSTANT(A, B, C, D) MAKE_4B_CODE_4(A, B, C, D) -#define HAL_INFO_TAG MAKE_TAG_CONSTANT('P','A','S','S') +#define HAL_INFO_TAG MAKE_TAG_CONSTANT('P', 'A', 'S', 'S') /* Symbolic name of the HAL info (PASS HAL Info) */ #define HAL_INFO_SYM PassHalInfo diff --git a/src/pass/pass-gov.c b/src/pass/pass-gov.c index 7bb1e3c..c51d1a9 100644 --- a/src/pass/pass-gov.c +++ b/src/pass/pass-gov.c @@ -384,7 +384,7 @@ static int __pass_governor_init(struct pass_policy *policy) { int ret; - if(policy->gov_timeout < 0) { + if (policy->gov_timeout < 0) { _E("invalid timeout value [%d]!", policy->gov_timeout); pass_governor_update(policy, PASS_GOV_STOP); return -EINVAL; diff --git a/src/pass/pass-parser.c b/src/pass/pass-parser.c index 6e8a072..1add5fb 100644 --- a/src/pass/pass-parser.c +++ b/src/pass/pass-parser.c @@ -207,7 +207,7 @@ static int pass_parse_core(struct parse_result *result, void *user_data) if (!result->section || !result->name || !result->value) return 0; - if (MATCH(result->name, "pass_support")) + if (MATCH(result->name, "pass_support")) policy->state = atoi(result->value); else if (MATCH(result->name, "pass_gov_type")) policy->gov_type = atoi(result->value); @@ -477,10 +477,10 @@ int pass_get_table(struct pass_policy *policy, char *pass_conf_path) void pass_put_table(struct pass_policy *policy) { - if(policy->pass_table) + if (policy->pass_table) free(policy->pass_table); - if(policy->scenario.list) + if (policy->scenario.list) free(policy->scenario.list); } @@ -612,7 +612,7 @@ static int pass_resource_config(struct parse_result *result, void *user_data) len = strlen(result->value); snprintf(path_compatible, len + 1, "%s", result->value); - len =strlen(compatible); + len = strlen(compatible); if (len > 0) { ret = check_compatible(compatible, path_compatible); if (ret < 0) diff --git a/src/pass/pass.c b/src/pass/pass.c index 4e46465..894abe5 100644 --- a/src/pass/pass.c +++ b/src/pass/pass.c @@ -352,7 +352,7 @@ static int pass_exit_done(void) * pass_init - Initialize PASS(Power Aware System Service) * * @data: When the data is passed from pass_main(), it is NULL. - * On the other hand, it will contain the result of this function + * On the other hand, it will contain the result of this function */ static void pass_init(void *data) { @@ -363,7 +363,7 @@ static void pass_init(void *data) * pass_exit - Exit PASS * * @data: When the data is passed from pass_main(), it is NULL. - * On the other hand, it will contain the result of this function + * On the other hand, it will contain the result of this function */ static void pass_exit(void *data) { diff --git a/src/pass/pass.h b/src/pass/pass.h index 060e94b..1a81c18 100644 --- a/src/pass/pass.h +++ b/src/pass/pass.h @@ -405,8 +405,8 @@ struct pass { }; #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) + const typeof(((type *)0)->member) *__mptr = (ptr); \ + (type *)((char *)__mptr - offsetof(type, member)); }) #define to_pass_resource(policy) \ container_of(policy, struct pass_resource, policy) diff --git a/src/pmqos/pmqos.c b/src/pmqos/pmqos.c index 5543e6d..bf6120f 100644 --- a/src/pmqos/pmqos.c +++ b/src/pmqos/pmqos.c @@ -89,11 +89,10 @@ static gboolean dbus_cb_pmqos_start(SystemPassPmqos *obj, int ret = 0; int booting_done = 1; - if (g_initialized) { + if (g_initialized) _I("PASS PMQoS is already started\n"); - } else { + else ret = pmqos_init_done(&booting_done, NULL); - } g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", ret)); diff --git a/src/shared/log.h b/src/shared/log.h index 105332d..d170161 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -25,8 +25,8 @@ #define LOG_TAG "PASS" #endif /* LOG_TAG */ -#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while(0) -#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while(0) -#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while(0) -#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while(0) +#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while (0) +#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while (0) +#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while (0) +#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while (0) #endif