type
stringclasses
5 values
content
stringlengths
9
163k
functions
ssize_t show_status_value(struct device_driver *ddri, char *buf) { ssize_t len = 0; struct lis3dh_i2c_data *obj = obj_i2c_data; if (obj == NULL) { GSE_ERR("i2c_data obj is null!!\n"); return 0; }
functions
int lis3dh_create_attr(struct device_driver *driver) { int idx, err = 0; int num = (int)(sizeof(lis3dh_attr_list)/sizeof(lis3dh_attr_list[0])); if (driver == NULL) { return -EINVAL; }
functions
int lis3dh_delete_attr(struct device_driver *driver) { int idx ,err = 0; int num = (int)(sizeof(lis3dh_attr_list)/sizeof(lis3dh_attr_list[0])); if(driver == NULL) { return -EINVAL; }
functions
int lis3dh_operate(void* self, uint32_t command, void* buff_in, int size_in, void* buff_out, int size_out, int* actualout) { int err = 0; int value, sample_delay; struct lis3dh_i2c_data *priv = (struct lis3dh_i2c_data*)self; hwm_sensor_data* gsensor_data; char buff[LIS3DH_BUFSIZE]; //GSE_FUN(f); switch (com...
functions
else if(value <= 10) { sample_delay = ~LIS3DH_BW_100HZ; }
functions
int lis3dh_open(struct inode *inode, struct file *file) { file->private_data = lis3dh_i2c_client; if(file->private_data == NULL) { GSE_ERR("null pointer!!\n"); return -EINVAL; }
functions
int lis3dh_release(struct inode *inode, struct file *file) { file->private_data = NULL; return 0; }
functions
long lis3dh_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct i2c_client *client = (struct i2c_client*)file->private_data; struct lis3dh_i2c_data *obj = (struct lis3dh_i2c_data*)i2c_get_clientdata(client); char strbuf[LIS3DH_BUFSIZE]; void __user *data; SENSOR_DATA sensor_dat...
functions
int lis3dh_suspend(struct i2c_client *client, pm_message_t msg) { struct lis3dh_i2c_data *obj = i2c_get_clientdata(client); int err = 0; u8 dat; GSE_FUN(); if(msg.event == PM_EVENT_SUSPEND) { if(obj == NULL) { GSE_ERR("null pointer!!\n"); return -EINVAL; }
functions
int lis3dh_resume(struct i2c_client *client) { struct lis3dh_i2c_data *obj = i2c_get_clientdata(client); //int err; GSE_FUN(); if(obj == NULL) { GSE_ERR("null pointer!!\n"); return -EINVAL; }
functions
void lis3dh_early_suspend(struct early_suspend *h) { struct lis3dh_i2c_data *obj = container_of(h, struct lis3dh_i2c_data, early_drv); int err; GSE_FUN(); if(obj == NULL) { GSE_ERR("null pointer!!\n"); return; }
functions
void lis3dh_late_resume(struct early_suspend *h) { struct lis3dh_i2c_data *obj = container_of(h, struct lis3dh_i2c_data, early_drv); //int err; GSE_FUN(); if(obj == NULL) { GSE_ERR("null pointer!!\n"); return; }
functions
int lis3dh_i2c_detect(struct i2c_client *client, int kind, struct i2c_board_info *info) { strcpy(info->type, LIS3DH_DEV_NAME); return 0; }
functions
int lis3dh_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct i2c_client *new_client; struct lis3dh_i2c_data *obj; struct hwmsen_object sobj; int err = 0; GSE_FUN(); if(!(obj = kzalloc(sizeof(*obj), GFP_KERNEL))) { err = -ENOMEM; goto exit; }
functions
CONFIG_LIS3DH_LOWPASS if(obj->hw->firlen > C_MAX_FIR_LENGTH) { atomic_set(&obj->firlen, C_MAX_FIR_LENGTH); }
functions
int lis3dh_i2c_remove(struct i2c_client *client) { int err = 0; if((err = lis3dh_delete_attr(&(lis3dh_init_info.platform_diver_addr->driver)))) { GSE_ERR("lis3dh_delete_attr fail: %d\n", err); }
functions
int lis3dh_probe(struct platform_device *pdev) { struct acc_hw *hw = get_cust_acc_hw(); GSE_FUN(); LIS3DH_power(hw, 1); //lis3dh_force[0] = hw->i2c_num; if(i2c_add_driver(&lis3dh_i2c_driver)) { GSE_ERR("add driver error\n"); return -1; }
functions
int lis3dh_remove(struct platform_device *pdev) { struct acc_hw *hw = get_cust_acc_hw(); GSE_FUN(); LIS3DH_power(hw, 0); i2c_del_driver(&lis3dh_i2c_driver); return 0; }
functions
int lis3dh_remove(void) { struct acc_hw *hw = lis3dh_get_cust_acc_hw(); GSE_FUN(); LIS3DH_power(hw, 0); i2c_del_driver(&lis3dh_i2c_driver); return 0; }
functions
int lis3dh_local_init(void) { struct acc_hw *hw = lis3dh_get_cust_acc_hw(); GSE_FUN(); LIS3DH_power(hw, 1); if(i2c_add_driver(&lis3dh_i2c_driver)) { GSE_ERR("add driver error\n"); return -1; }
functions
__init lis3dh_init(void) { GSE_FUN(); i2c_register_board_info(0, &i2c_LIS3DH, 1); hwmsen_gsensor_add(&lis3dh_init_info); #if 0 if(platform_driver_register(&lis3dh_gsensor_driver)) { GSE_ERR("failed to register driver"); return -ENODEV; }
functions
__exit lis3dh_exit(void) { GSE_FUN(); //platform_driver_unregister(&lis3dh_gsensor_driver); }
defines
#define ISM3FIELDS
defines
#define VAR_LIST_tTemplate "tTemplate.uTemplate,tTemplate.cLabel,tTemplate.uTemplateSet,tTemplate.uTemplateType,tTemplate.cComment,tTemplate.cTemplate,tTemplate.uOwner,tTemplate.uCreatedBy,tTemplate.uCreatedDate,tTemplate.uModBy,tTemplate.uModDate"
functions
void ProcesstTemplateVars(pentry entries[], int x) { register int i; for(i=0;i<x;i++) { if(!strcmp(entries[i].name,"uTemplate")) sscanf(entries[i].val,"%u",&uTemplate); else if(!strcmp(entries[i].name,"cLabel")) sprintf(cLabel,"%.32s",entries[i].val); else if(!strcmp(entries[i].name,"uTemplateSet")) ...
functions
void ProcesstTemplateListVars(pentry entries[], int x) { register int i; for(i=0;i<x;i++) { if(!strncmp(entries[i].name,"ED",2)) { sscanf(entries[i].name+2,"%u",&uTemplate); guMode=2002; tTem...
functions
int tTemplateCommands(pentry entries[], int x) { ProcessControlVars(entries,x); ExttTemplateCommands(entries,x); if(!strcmp(gcFunction,"tTemplateTools")) { if(!strcmp(gcFind,LANG_NB_LIST)) { tTemplateList(); }
functions
void tTemplate(const char *cResult) { MYSQL_RES *res; MYSQL_RES *res2; MYSQL_ROW field; //Internal skip reloading if(!cResult[0]) { if(guMode) ExttTemplateSelectRow(); else ExttTemplateSelect(); mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) { if(strstr(mysql_error(&gMysql)," d...
functions
void tTemplateInput(unsigned uMode) { //uTemplate OpenRow(LANG_FL_tTemplate_uTemplate,"black"); printf("<input title='%s' type=text name=uTemplate value=%u size=16 maxlength=10 " ,LANG_FT_tTemplate_uTemplate,uTemplate); if(guPermLevel>=20 && uMode) { printf("></td></tr>\n"); }
functions
void NewtTemplate(unsigned uMode) { register int i=0; MYSQL_RES *res; sprintf(gcQuery,"SELECT uTemplate FROM tTemplate\ WHERE uTemplate=%u" ,uTemplate); mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); res=mysql_store_result(&gMysql); i=mysql_num_rows(r...
functions
void DeletetTemplate(void) { #ifdef ISM3FIELDS sprintf(gcQuery,"DELETE FROM tTemplate WHERE uTemplate=%u AND ( uOwner=%u OR %u>9 )" ,uTemplate,guLoginClient,guPermLevel); #else sprintf(gcQuery,"DELETE FROM tTemplate WHERE uTemplate=%u" ,uTemplate); #endif mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMys...
functions
void Insert_tTemplate(void) { //insert query sprintf(gcQuery,"INSERT INTO tTemplate SET uTemplate=%u,cLabel='%s',uTemplateSet=%u,uTemplateType=%u,cComment='%s',cTemplate='%s',uOwner=%u,uCreatedBy=%u,uCreatedDate=UNIX_TIMESTAMP(NOW())", uTemplate ,TextAreaSave(cLabel) ,uTemplateSet ,uTemplateType ,Text...
functions
void Update_tTemplate(char *cRowid) { //update query sprintf(gcQuery,"UPDATE tTemplate SET uTemplate=%u,cLabel='%s',uTemplateSet=%u,uTemplateType=%u,cComment='%s',cTemplate='%s',uModBy=%u,uModDate=UNIX_TIMESTAMP(NOW()) WHERE _rowid=%s", uTemplate ,TextAreaSave(cLabel) ,uTemplateSet ,uTemplateType ,Tex...
functions
void ModtTemplate(void) { register int i=0; MYSQL_RES *res; MYSQL_ROW field; #ifdef ISM3FIELDS unsigned uPreModDate=0; sprintf(gcQuery,"SELECT uTemplate,uModDate FROM tTemplate WHERE uTemplate=%u" ,uTemplate); #else sprintf(gcQuery,"SELECT uTemplate FROM tTemplate\ WHERE uTemplate=%u" ,uTemplate)...
functions
void tTemplateList(void) { MYSQL_RES *res; MYSQL_ROW field; ExttTemplateListSelect(); mysql_query(&gMysql,gcQuery); if(mysql_error(&gMysql)[0]) htmlPlainTextError(mysql_error(&gMysql)); res=mysql_store_result(&gMysql); guI=mysql_num_rows(res); PageMachine("tTemplateList",1,"");//1 is auto header list guMode....
functions
void CreatetTemplate(void) { sprintf(gcQuery,"CREATE TABLE IF NOT EXISTS tTemplate ( uTemplate INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, cLabel VARCHAR(32) NOT NULL DEFAULT '', uOwner INT UNSIGNED NOT NULL DEFAULT 0,index (uOwner), uCreatedBy INT UNSIGNED NOT NULL DEFAULT 0, uCreatedDate INT UNSIGNED NOT NULL DEFAULT 0...
includes
#include <stdarg.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <time.h>
functions
void test_cunit_start_tests(const char* strName) { fprintf(stdout, _("\n testing %s ... "), strName); f_nTests_stored = f_nTests; f_nFails_stored = f_nFailures; }
functions
void test_cunit_end_tests(void) { fprintf(stdout, _("%d assertions, %d failures"), f_nTests - f_nTests_stored, f_nFailures - f_nFails_stored); }
functions
void test_cunit_add_test(void) { ++f_nTests; }
functions
void test_cunit_add_failure(void) { ++f_nFailures; }
functions
int test_cunit_test_count(void) { return f_nTests; }
functions
int test_cunit_failure_count(void) { return f_nFailures; }
functions
void test_cunit_initialize(void) { f_nTests = 0; f_nFailures = 0; f_start_time = clock(); }
functions
void test_cunit_report_results(void) { fprintf(stdout, "\n\n---------------------------" "\n%s" "\n---------------------------" "\n %s%d" "\n %s%d" "\n %s%d" "\n\n%s%8.3f%s\n", _("CUnit Internal Test Results"), _("Total...
functions
CU_BOOL test_cunit_assert_impl(CU_BOOL value, const char* condition, const char* file, unsigned int line) { test_cunit_add_test(); if (CU_FALSE == value) { test_cunit_add_failure(); printf(_("\nTEST FAILED: File '%s...
main
int main() { /* No line buffering. */ setbuf(stdout, NULL); test_cunit_initialize(); fprintf(stdout, "\n%s", _("Testing CUnit internals...")); /* individual module test functions go here */ test_cunit_CUError(); test_cunit_MyMem(); test_cunit_TestDB(); test_cunit_TestRun(); test_cunit_Util(); te...
includes
#include <config.h>
includes
#include <sys/param.h>
includes
#include <sys/socket.h>
includes
#include <sys/poll.h>
includes
#include <netinet/in.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <memory.h>
includes
#include <errno.h>
includes
#include <fcntl.h>
includes
#include <signal.h>
includes
#include <unistd.h>
includes
#include <dirent.h>
defines
#define _GNU_SOURCE
defines
#define POLL_MILLISECS 500
functions
void scan_poll_results(int ret) { int i; struct clnt_info *clp; for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next) { i = clp->gssd_poll_index; if (i >= 0 && pollarray[i].revents) { if (pollarray[i].revents & POLLHUP) { clp->gssd_close_me = 1; dir_changed = 1; }
functions
int topdirs_add_entry(struct dirent *dent) { struct topdirs_info *tdi; tdi = calloc(sizeof(struct topdirs_info), 1); if (tdi == NULL) { printerr(0, "ERROR: Couldn't allocate struct topdirs_info\n"); return -1; }
functions
void topdirs_free_list(void) { struct topdirs_info *tdi; TAILQ_FOREACH(tdi, &topdirs_list, list) { free(tdi->dirname); if (tdi->fd != -1) close(tdi->fd); TAILQ_REMOVE(&topdirs_list, tdi, list); free(tdi); }
functions
int topdirs_init_list(void) { DIR *pipedir; struct dirent *dent; int ret; TAILQ_INIT(&topdirs_list); pipedir = opendir(pipefs_dir); if (pipedir == NULL) { printerr(0, "ERROR: could not open rpc_pipefs directory '%s': " "%s\n", pipefs_dir, strerror(errno)); return -1; }
functions
void gssd_poll(struct pollfd *fds, unsigned long nfds) { sigset_t emptyset; int ret; sigemptyset(&emptyset); ret = ppoll(fds, nfds, NULL, &emptyset); if (ret < 0) { if (errno != EINTR) printerr(0, "WARNING: error return from poll\n"); }
functions
else if (ret == 0) { printerr(0, "WARNING: unexpected timeout\n"); }
functions
void gssd_poll(struct pollfd *fds, unsigned long nfds) { int ret; /* race condition here: dir_changed could be set before we * enter the poll, and we'd never notice if it weren't for the * timeout. */ ret = poll(fds, nfds, POLL_MILLISECS); if (ret < 0) { if (errno != EINTR) printerr(0, "WARNING: error ret...
functions
else if (ret == 0) { /* timeout */ }
functions
void gssd_run() { struct sigaction dn_act = { .sa_handler = dir_notify_handler }
includes
#include <linux/module.h>
includes
#include <linux/types.h>
includes
#include <linux/init.h>
includes
#include <linux/slab.h>
includes
#include <linux/device.h>
includes
#include <linux/notifier.h>
includes
#include <linux/err.h>
includes
#include <linux/power_supply.h>
includes
#include <linux/thermal.h>
includes
#include <linux/of.h>
functions
bool __power_supply_is_supplied_by(struct power_supply *supplier, struct power_supply *supply) { int i; if (!supply->supplied_from && !supplier->supplied_to) return false; /* Support both supplied_to and supplied_from modes */ if (supply->supplied_from) { if (!supplier->name) return false; for (i =...
functions
int power_supply_set_current_limit(struct power_supply *psy, int limit) { const union power_supply_propval ret = {limit,}
functions
int power_supply_set_charging_enabled(struct power_supply *psy, bool enable) { const union power_supply_propval ret = {enable,}
functions
int power_supply_set_present(struct power_supply *psy, bool enable) { const union power_supply_propval ret = {enable,}
functions
int power_supply_set_online(struct power_supply *psy, bool enable) { const union power_supply_propval ret = {enable,}
functions
int power_supply_set_health_state(struct power_supply *psy, int health) { const union power_supply_propval ret = {health,}
functions
int power_supply_set_scope(struct power_supply *psy, int scope) { const union power_supply_propval ret = {scope, }
functions
int power_supply_set_supply_type(struct power_supply *psy, enum power_supply_type supply_type) { const union power_supply_propval ret = {supply_type,}
functions
int power_supply_set_charge_type(struct power_supply *psy, int charge_type) { const union power_supply_propval ret = {charge_type,}
functions
int __power_supply_changed_work(struct device *dev, void *data) { struct power_supply *psy = (struct power_supply *)data; struct power_supply *pst = dev_get_drvdata(dev); if (__power_supply_is_supplied_by(psy, pst)) { if (pst->external_power_changed) pst->external_power_changed(pst); }
functions
void power_supply_changed_work(struct work_struct *work) { unsigned long flags; struct power_supply *psy = container_of(work, struct power_supply, changed_work); dev_dbg(psy->dev, "%s\n", __func__); spin_lock_irqsave(&psy->changed_lock, flags); if (psy->changed) { psy->changed = false; spin_unlock_irqr...
functions
void power_supply_changed(struct power_supply *psy) { unsigned long flags; dev_dbg(psy->dev, "%s\n", __func__); spin_lock_irqsave(&psy->changed_lock, flags); psy->changed = true; pm_stay_awake(psy->dev); spin_unlock_irqrestore(&psy->changed_lock, flags); schedule_work(&psy->changed_work); }
functions
int __power_supply_populate_supplied_from(struct device *dev, void *data) { struct power_supply *psy = (struct power_supply *)data; struct power_supply *epsy = dev_get_drvdata(dev); struct device_node *np; int i = 0; do { np = of_parse_phandle(psy->of_node, "power-supplies", i++); if (!np) continue;...
functions
int power_supply_populate_supplied_from(struct power_supply *psy) { int error; error = class_for_each_device(power_supply_class, NULL, psy, __power_supply_populate_supplied_from); dev_dbg(psy->dev, "%s %d\n", __func__, error); return error; }