From: Vyacheslav Cherkashin Date: Fri, 4 Jul 2014 12:58:44 +0000 (+0400) Subject: [STYLE] energy: doxygen comments X-Git-Tag: Tizen_SDK_2.3~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=717d856794e771e21bd506eb45156f6b609f345e;p=kernel%2Fswap-modules.git [STYLE] energy: doxygen comments Change-Id: I2db7a3ecade2a51f60cc0b6784cdf860117972b1 Signed-off-by: Vyacheslav Cherkashin --- diff --git a/energy/debugfs_energy.c b/energy/debugfs_energy.c index 7706da7..bf72a66 100644 --- a/energy/debugfs_energy.c +++ b/energy/debugfs_energy.c @@ -226,11 +226,21 @@ enum { */ static struct dentry *energy_dir = NULL; +/** + * @brief Destroy debugfs for LCD + * + * @return Dentry of energy debugfs + */ struct dentry *get_energy_dir(void) { return energy_dir; } +/** + * @brief Destroy debugfs for energy + * + * @return Void + */ void exit_debugfs_energy(void) { if (energy_dir) @@ -239,6 +249,11 @@ void exit_debugfs_energy(void) energy_dir = NULL; } +/** + * @brief Create debugfs for energy + * + * @return Error code + */ int init_debugfs_energy(void) { int i; diff --git a/energy/debugfs_energy.h b/energy/debugfs_energy.h index d404e76..f8ee51c 100644 --- a/energy/debugfs_energy.h +++ b/energy/debugfs_energy.h @@ -1,10 +1,11 @@ #ifndef _DEBUGFS_ENERGY_H #define _DEBUGFS_ENERGY_H -/* - * Dynamic Binary Instrumentation Module based on KProbes - * energy/debugfs_energy.h +/** + * @file energy/debugfs_energy.h + * @author Vyacheslav Cherkashin * + * @section LICENSE * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,10 +20,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * @section COPYRIGHT * Copyright (C) Samsung Electronics, 2013 * - * 2013 Vyacheslav Cherkashin - * + * @section DESCRIPTION + * Debugfs for energy */ diff --git a/energy/energy.c b/energy/energy.c index f311c7d..9dbf9fd 100644 --- a/energy/energy.c +++ b/energy/energy.c @@ -486,6 +486,14 @@ static int current_parameter_apps(enum parameter_type pt, void *buf, int sz) return 0; } +/** + * @brief Get energy parameter + * + * @param pe Type of energy parameter + * @param buf Buffer + * @param sz Buffer size + * @return Error code + */ int get_parameter_energy(enum parameter_energy pe, void *buf, size_t sz) { unsigned long flags; @@ -580,6 +588,11 @@ void do_unset_energy(void) static DEFINE_MUTEX(mutex_enable); static int energy_enable = 0; +/** + * @brief Start measuring the energy consumption + * + * @return Error code + */ int set_energy(void) { int ret = -EINVAL; @@ -601,6 +614,11 @@ unlock: } EXPORT_SYMBOL_GPL(set_energy); +/** + * @brief Stop measuring the energy consumption + * + * @return Error code + */ int unset_energy(void) { int ret = 0; @@ -622,6 +640,12 @@ unlock: } EXPORT_SYMBOL_GPL(unset_energy); + +/** + * @brief Initialization energy + * + * @return Error code + */ int energy_init(void) { int ret; @@ -661,6 +685,11 @@ int energy_init(void) return 0; } +/** + * @brief Deinitialization energy + * + * @return Void + */ void energy_uninit(void) { lcd_exit(); diff --git a/energy/energy.h b/energy/energy.h index 991e37a..408a0f8 100644 --- a/energy/energy.h +++ b/energy/energy.h @@ -1,10 +1,11 @@ #ifndef _ENERGY_H #define _ENERGY_H -/* - * Dynamic Binary Instrumentation Module based on KProbes - * energy/energy.h +/** + * @file energy/energy.h + * @author Vyacheslav Cherkashin * + * @section LICENCE * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,9 +20,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * @section COPYRIGHT * Copyright (C) Samsung Electronics, 2013 * - * 2013 Vyacheslav Cherkashin + * @section DESCRIPTION * */ @@ -29,14 +31,15 @@ #include +/** Description of parameters */ enum parameter_energy { - PE_TIME_IDLE, - PE_TIME_SYSTEM, - PE_TIME_APPS, - PE_READ_SYSTEM, - PE_WRITE_SYSTEM, - PE_READ_APPS, - PE_WRITE_APPS + PE_TIME_IDLE, /**< IDLE working time */ + PE_TIME_SYSTEM, /**< system working time */ + PE_TIME_APPS, /**< apps working time */ + PE_READ_SYSTEM, /**< number of bytes are read by system */ + PE_WRITE_SYSTEM, /**< number of bytes are write by system */ + PE_READ_APPS, /**< number of bytes are read by apps */ + PE_WRITE_APPS /**< number of bytes are write by apps*/ }; diff --git a/energy/lcd/lcd_base.c b/energy/lcd/lcd_base.c index 71a782f..f40cc25 100644 --- a/energy/lcd/lcd_base.c +++ b/energy/lcd/lcd_base.c @@ -33,6 +33,12 @@ #include "lcd_debugfs.h" +/** + * @brief Read the number of file + * + * @param path of the file + * @return Value or error(when negative) + */ int read_val(const char *path) { int ret; @@ -253,6 +259,12 @@ static int func_notifier_lcd(struct lcd_ops *ops, enum lcd_action_type action, return 0; } +/** + * @brief Get the array size of LCD + * + * @param ops LCD operations + * @return Array size + */ size_t get_lcd_size_array(struct lcd_ops *ops) { struct lcd_priv_data *lcd = get_lcd_priv(ops); @@ -260,6 +272,13 @@ size_t get_lcd_size_array(struct lcd_ops *ops) return lcd->tms_brt_cnt; } +/** + * @brief Get an array of times + * + * @param ops LCD operations + * @param array_time[out] Array of times + * @return Void + */ void get_lcd_array_time(struct lcd_ops *ops, u64 *array_time) { struct lcd_priv_data *lcd = get_lcd_priv(ops); @@ -349,6 +368,11 @@ static void do_lcd_exit(void) mutex_unlock(&lcd_lock); } +/** + * @brief LCD deinitialization + * + * @return Void + */ void lcd_exit(void) { do_lcd_exit(); @@ -387,6 +411,11 @@ static int do_lcd_init(void) return count ? 0 : -EPERM; } +/** + * @brief LCD initialization + * + * @return Error code + */ int lcd_init(void) { int ret; @@ -417,6 +446,12 @@ int lcd_init(void) * === LCD_SET_ENERGY/LCD_UNSET_ENERGY === * ============================================================================ */ + +/** + * @brief Start measuring the energy consumption of LСD + * + * @return Error code + */ int lcd_set_energy(void) { int i, ret, count = 0; @@ -444,6 +479,11 @@ int lcd_set_energy(void) return count ? 0 : -EPERM; } +/** + * @brief Stop measuring the energy consumption of LСD + * + * @return Void + */ void lcd_unset_energy(void) { int i, ret; diff --git a/energy/lcd/lcd_base.h b/energy/lcd/lcd_base.h index 3e210f6..44de0b4 100644 --- a/energy/lcd/lcd_base.h +++ b/energy/lcd/lcd_base.h @@ -1,10 +1,11 @@ #ifndef _LCD_BASE_H #define _LCD_BASE_H -/* - * Dynamic Binary Instrumentation Module based on KProbes - * energy/lcd/lcd_base.h +/** + * @file energy/lcd/lcd_base.h + * @author Vyacheslav Cherkashin * + * @section LICENSE * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,10 +20,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * @section COPYRIGHT * Copyright (C) Samsung Electronics, 2013 * - * 2013 Vyacheslav Cherkashin - * + * @section DESCRIPTION + * Description of the interface for interacting with LСD */ @@ -30,43 +32,74 @@ #include +/** Description of actions */ enum lcd_action_type { - LAT_BRIGHTNESS, - LAT_POWER + LAT_BRIGHTNESS, /**< LCD brightness */ + LAT_POWER /**< LCD power */ }; + +/** Description of parameters */ enum lcd_parameter_type { - LPD_MIN_BRIGHTNESS, - LPD_MAX_BRIGHTNESS, - LPD_BRIGHTNESS, + LPD_MIN_BRIGHTNESS, /**< minimum brightness value */ + LPD_MAX_BRIGHTNESS, /**< maximum brightness value */ + LPD_BRIGHTNESS, /**< current brightness value */ - LPD_POWER + LPD_POWER /**< current power value */ }; struct lcd_ops; +/** + * @brief LCD callback type + * + * @param ops LCD operations + * @return Error code + */ typedef int (*call_lcd)(struct lcd_ops *ops); + +/** + * @brief LCD notifier type + * + * @param ops LCD operations + * @param action Event type + * @param data Date + * @return Error code + */ typedef int (*notifier_lcd)(struct lcd_ops *ops, enum lcd_action_type action, void *data); + +/** + * @brief LCD parameter type + * + * @param ops LCD operations + * @param type Requested parameter type + * @return Requested parameter value + * + */ typedef unsigned long (*get_parameter_lcd)(struct lcd_ops *ops, enum lcd_parameter_type type); +/** + * @struct lcd_ops + * @breaf set of operations available for LСD + */ struct lcd_ops { - char *name; - notifier_lcd notifier; - get_parameter_lcd get; + char *name; /**< LCD driver name */ + notifier_lcd notifier; /**< Notifier */ + get_parameter_lcd get; /**< Method to obtain the parameters */ - call_lcd check; - call_lcd set; - call_lcd unset; + call_lcd check; /**< LCD check on device */ + call_lcd set; /**< LCD initialization */ + call_lcd unset; /**< LCD deinitialization */ /* for debugfs */ - struct dentry *dentry; - struct rational min_coef; - struct rational max_coef; + struct dentry *dentry; /**< Dentry of debugfs for this LCD */ + struct rational min_coef; /**< Minimum coefficient */ + struct rational max_coef; /**< Maximum coefficient */ - void *priv; + void *priv; /**< Private data */ }; size_t get_lcd_size_array(struct lcd_ops *ops); diff --git a/energy/lcd/lcd_debugfs.c b/energy/lcd/lcd_debugfs.c index d549758..841d4ce 100644 --- a/energy/lcd/lcd_debugfs.c +++ b/energy/lcd/lcd_debugfs.c @@ -69,6 +69,12 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_get_system, get_system, NULL, "%llu\n"); static struct dentry *lcd_dir = NULL; +/** + * @brief Register LCD in debugfs + * + * @param ops LCD operations + * @return Error code + */ int register_lcd_debugfs(struct lcd_ops *ops) { int ret; @@ -104,11 +110,22 @@ fail: return -ENOMEM; } +/** + * @brief Unregister LCD in debugfs + * + * @param ops LCD operations + * @return Void + */ void unregister_lcd_debugfs(struct lcd_ops *ops) { debugfs_remove_recursive(ops->dentry); } +/** + * @brief Destroy debugfs for LCD + * + * @return Void + */ void exit_lcd_debugfs(void) { if (lcd_dir) @@ -117,6 +134,12 @@ void exit_lcd_debugfs(void) lcd_dir = NULL; } +/** + * @brief Create debugfs for LCD + * + * @param dentry Dentry + * @return Error code + */ int init_lcd_debugfs(struct dentry *energy_dir) { lcd_dir = debugfs_create_dir("lcd", energy_dir); diff --git a/energy/lcd/lcd_debugfs.h b/energy/lcd/lcd_debugfs.h index c6c4887..369748c 100644 --- a/energy/lcd/lcd_debugfs.h +++ b/energy/lcd/lcd_debugfs.h @@ -1,10 +1,11 @@ #ifndef _LCD_DEBUGFS_H #define _LCD_DEBUGFS_H -/* - * Dynamic Binary Instrumentation Module based on KProbes - * energy/lcd/lcd_debugfs.h +/** + * @file energy/lcd/lcd_debugfs.h + * @author Vyacheslav Cherkashin * + * @section LICENSE * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,9 +20,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * @section COPYRIGHT * Copyright (C) Samsung Electronics, 2013 * - * 2013 Vyacheslav Cherkashin + * @section DESCRIPTION + * Debugfs for LСD * */ diff --git a/energy/rational_debugfs.c b/energy/rational_debugfs.c index 046c4f2..32a3f1b 100644 --- a/energy/rational_debugfs.c +++ b/energy/rational_debugfs.c @@ -46,6 +46,15 @@ static int denom_get(void *data, u64 *val) DEFINE_SIMPLE_ATTRIBUTE(fops_denom, denom_get, denom_set, "%llu\n"); +/** + * @brief Create file in debugfs for rational struct + * + * @param parent Dentry parent + * @param r Pointer to the rational struct + * @param num_name File name of numerator + * @param denom_name File name of denominator + * @return Error code + */ int create_rational_files(struct dentry *parent, struct rational *r, const char *num_name, const char *denom_name) { diff --git a/energy/rational_debugfs.h b/energy/rational_debugfs.h index e6d19b1..6a30155 100644 --- a/energy/rational_debugfs.h +++ b/energy/rational_debugfs.h @@ -1,10 +1,11 @@ #ifndef _RATIONAL_DEBUGFS_H #define _RATIONAL_DEBUGFS_H -/* - * Dynamic Binary Instrumentation Module based on KProbes - * energy/rational_debugfs.h +/** + * @file energy/rational_debugfs.h + * @author Vyacheslav Cherkashin * + * @section LICENSE * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,22 +20,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * @section COPYRIGHT * Copyright (C) Samsung Electronics, 2013 - * - * 2013 Vyacheslav Cherkashin - * */ #include +/** + * @struct rational + * @brief Description of rational number + */ struct rational { - u64 num; - u64 denom; + u64 num; /**< Numerator */ + u64 denom; /**< Denominator */ }; +/** + * @def DEFINE_RATIONAL + * Initialize of rational struct @hideinitializer + */ #define DEFINE_RATIONAL(rational_name) \ struct rational rational_name = { \ .num = 1, \ @@ -44,7 +51,6 @@ struct rational { struct dentry; - int create_rational_files(struct dentry *parent, struct rational *r, const char *num_name, const char *denom_name); diff --git a/energy/tm_stat.h b/energy/tm_stat.h index 3f427d8..d595634 100644 --- a/energy/tm_stat.h +++ b/energy/tm_stat.h @@ -1,10 +1,11 @@ #ifndef _TM_STAT_H #define _TM_STAT_H -/* - * Dynamic Binary Instrumentation Module based on KProbes - * energy/tm_stat.h +/** + * @file energy/tm_stat.h + * @author Vyacheslav Cherkashin * + * @section LICENSE * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,10 +20,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * @section COPYFIGHT * Copyright (C) Samsung Electronics, 2013 * - * 2013 Vyacheslav Cherkashin - * */ @@ -30,12 +30,19 @@ #include +/** + * @struct tm_stat + * @brief Description of statistic time + */ struct tm_stat { - u64 timestamp; - u64 running; + u64 timestamp; /**< Time stamp */ + u64 running; /**< Running time */ }; - +/** + * @def DEFINE_TM_STAT + * Initialize of tm_stat struct @hideinitializer + */ #define DEFINE_TM_STAT(tm_name) \ struct tm_stat tm_name = { \ .timestamp = 0, \