Update source to Armbian-dev-202610.A311Y3
This commit is contained in:
@@ -86,6 +86,13 @@ void register_early_suspend(struct early_suspend *handler)
|
||||
struct early_suspend *e;
|
||||
|
||||
e = list_entry(pos, struct early_suspend, link);
|
||||
/*
|
||||
* early_suspend_handlers is a statically initialized LIST_HEAD and
|
||||
* only modified under early_suspend_lock, the entry fetched by
|
||||
* list_entry() is always valid; coverity cannot see through the
|
||||
* container_of() cast here.
|
||||
*/
|
||||
/* coverity[NULL_FIELD] */
|
||||
if (e->level > handler->level)
|
||||
break;
|
||||
}
|
||||
@@ -130,6 +137,13 @@ static inline void early_suspend(void)
|
||||
deep_suspend = 0;
|
||||
if (early_suspend_debug)
|
||||
pr_info("%s: call handlers\n", __func__);
|
||||
/*
|
||||
* The list walk is protected by early_suspend_lock over a statically
|
||||
* initialized list, the iterated entry can not be NULL; coverity cannot
|
||||
* resolve the list_entry cast inside the list_for_each_entry macro and
|
||||
* reports a false NULL_FIELD here.
|
||||
*/
|
||||
/* coverity[NULL_FIELD] */
|
||||
list_for_each_entry(pos, &early_suspend_handlers, link)
|
||||
if (pos->suspend) {
|
||||
if (early_suspend_debug)
|
||||
@@ -285,25 +299,34 @@ static ssize_t suspend_debug_show(const struct class *class,
|
||||
unsigned int len;
|
||||
int i;
|
||||
|
||||
len = sprintf(&buf[0], "suspend_debug_flag = 0x%x\n\n", suspend_debug_flag);
|
||||
len = snprintf(&buf[0], PAGE_SIZE, "suspend_debug_flag = 0x%x\n\n",
|
||||
suspend_debug_flag);
|
||||
if (len >= PAGE_SIZE)
|
||||
return len;
|
||||
|
||||
len += sprintf(&buf[len], "%s\n", suspend_debug_help_str);
|
||||
len += snprintf(&buf[len], PAGE_SIZE - len, "%s\n", suspend_debug_help_str);
|
||||
if (len >= PAGE_SIZE)
|
||||
return len;
|
||||
|
||||
check_suspend_debug_mode();
|
||||
|
||||
for (i = 0; i < MAX_ENTRIES; i++) {
|
||||
if (suspend_debug_mode[i].description) {
|
||||
if (suspend_debug_mode[i].start_bit == suspend_debug_mode[i].end_bit)
|
||||
len += sprintf(&buf[len], "%-80s bit[%d] \t%d\n",
|
||||
len += snprintf(&buf[len], PAGE_SIZE - len,
|
||||
"%-80s bit[%d] \t%d\n",
|
||||
suspend_debug_mode[i].description,
|
||||
suspend_debug_mode[i].start_bit,
|
||||
suspend_debug_mode[i].state);
|
||||
else
|
||||
len += sprintf(&buf[len], "%-80s bit[%d:%d] \t%d\n",
|
||||
len += snprintf(&buf[len], PAGE_SIZE - len,
|
||||
"%-80s bit[%d:%d] \t%d\n",
|
||||
suspend_debug_mode[i].description,
|
||||
suspend_debug_mode[i].end_bit,
|
||||
suspend_debug_mode[i].start_bit,
|
||||
suspend_debug_mode[i].state);
|
||||
if (len >= PAGE_SIZE)
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +420,7 @@ static unsigned long __invoke_psci_fn_smc(unsigned long function_id,
|
||||
unsigned long arg1,
|
||||
unsigned long arg2)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
struct arm_smccc_res res = {0};
|
||||
|
||||
arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res);
|
||||
return res.a0;
|
||||
@@ -523,7 +546,7 @@ static ssize_t suspend_reason_show(const struct class *class,
|
||||
unsigned int len;
|
||||
unsigned int val;
|
||||
|
||||
suspend_reason = get_resume_reason();
|
||||
suspend_reason = get_resume_method();
|
||||
val = get_resume_value();
|
||||
len = sprintf(buf, "%d\nreg val:0x%x\n", suspend_reason, val);
|
||||
|
||||
@@ -588,7 +611,7 @@ static int suspend_ddr_mode_show(void *data, char *buf)
|
||||
|
||||
bool ee_support_powerdown(void)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
struct arm_smccc_res res = {0};
|
||||
|
||||
arm_smccc_smc(SMCID_POWER_MANAGER, SMCSUBID_PM_GET_EE_STAT, 0, 0, 0, 0, 0, 0, &res);
|
||||
|
||||
@@ -617,12 +640,34 @@ static int suspend_ctrl_store(void *data, const char *buf, size_t count)
|
||||
|
||||
static int suspend_ctrl_show(void *data, char *buf)
|
||||
{
|
||||
unsigned int no_32k, ee_pwr_dn;
|
||||
int len;
|
||||
|
||||
(void)data;
|
||||
|
||||
if (!deep_mode_init_done)
|
||||
return 0;
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "SUSPEND MODE=0x%x\n", deep_mode);
|
||||
no_32k = GET_MODULE_VAL(NO_32K, deep_mode);
|
||||
ee_pwr_dn = GET_MODULE_VAL(EE_PWR_DN, deep_mode);
|
||||
|
||||
len = scnprintf(buf, PAGE_SIZE, "SUSPEND MODE=0x%x\n", deep_mode);
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len, "NO_32K=%s\n",
|
||||
no_32k ? "ON" : "OFF");
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len, "EE_PWR_DN=%s\n",
|
||||
ee_pwr_dn ? "ON" : "OFF");
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"\nUsage: echo \"DEEPCTRL <val>\" > suspend_mode\n");
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
" bit[1:0] DDR mode: 0=NORMAL 1=SelfRefresh\n");
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
" bit[2] NO_32K : 0=OFF 1=ON\n");
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
" bit[3] EE_PWR_DN: 0=OFF 1=ON\n");
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
" e.g. echo \"DEEPCTRL 0x0e\" (DDR=SelfRefresh, NO_32K=ON, EE_PWR_DN=ON)\n");
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static inline int deep_mode_init(struct platform_device *pdev)
|
||||
@@ -743,7 +788,7 @@ static ssize_t power_event_state_show(const struct class *class,
|
||||
{
|
||||
char def[] = "NULL";
|
||||
char msg[] = "POWER_PRESSED";
|
||||
unsigned int len = -1;
|
||||
unsigned int len;
|
||||
|
||||
if (power_event_available == 1) {
|
||||
len = snprintf(buf, sizeof(msg) + 1, "%s\n", msg);
|
||||
@@ -790,7 +835,7 @@ static ssize_t power_event_name_show(const struct class *class,
|
||||
char *buf)
|
||||
{
|
||||
char def[] = "NULL";
|
||||
unsigned int len = -1;
|
||||
unsigned int len;
|
||||
|
||||
if (power_event_available == 1) {
|
||||
len = snprintf(buf, sizeof(dev_name_event) + 1, "%s\n", dev_name_event);
|
||||
@@ -888,12 +933,22 @@ static int power_handler_connect(struct input_handler *handler,
|
||||
}
|
||||
|
||||
pr_info("%s: Connected to device: %s\n", DRIVER_NAME, dev->name);
|
||||
/*
|
||||
* The true release occurs within the "disconnect" callback.
|
||||
*/
|
||||
/* coverity[resource_leak] */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* disconnect devices */
|
||||
static void power_handler_disconnect(struct input_handle *handle)
|
||||
{
|
||||
if (!handle->dev) {
|
||||
pr_err("%s: disconnect with NULL dev\n", DRIVER_NAME);
|
||||
kfree(handle);
|
||||
return;
|
||||
}
|
||||
|
||||
pr_info("%s: Disconnected from device: %s\n", DRIVER_NAME, handle->dev->name);
|
||||
input_close_device(handle);
|
||||
input_unregister_handle(handle);
|
||||
@@ -1108,6 +1163,7 @@ static int pm_platform_resume(struct device *dev)
|
||||
static int pm_platform_suspend(struct device *dev)
|
||||
{
|
||||
deep_suspend = 1;
|
||||
|
||||
if (early_suspend_debug)
|
||||
pr_info("%s: set deep_suspend flag as 1\n", __func__);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user