From 982b8cc116118b3463d3f332581945625722acd8 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Tue, 09 Jan 2024 02:10:54 +0000
Subject: [PATCH] add poweroff command
---
kernel/lib/kobject_uevent.c | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/kernel/lib/kobject_uevent.c b/kernel/lib/kobject_uevent.c
index ec73e97..c87d5b6 100644
--- a/kernel/lib/kobject_uevent.c
+++ b/kernel/lib/kobject_uevent.c
@@ -200,7 +200,7 @@
r = kobject_action_type(buf, count, &action, &action_args);
if (r) {
- msg = "unknown uevent action string\n";
+ msg = "unknown uevent action string";
goto out;
}
@@ -212,7 +212,7 @@
r = kobject_action_args(action_args,
count - (action_args - buf), &env);
if (r == -EINVAL) {
- msg = "incorrect uevent action arguments\n";
+ msg = "incorrect uevent action arguments";
goto out;
}
@@ -224,7 +224,7 @@
out:
if (r) {
devpath = kobject_get_path(kobj, GFP_KERNEL);
- printk(KERN_WARNING "synth uevent: %s: %s",
+ pr_warn("synth uevent: %s: %s\n",
devpath ?: "unknown device",
msg ?: "failed to send uevent");
kfree(devpath);
@@ -240,6 +240,7 @@
ops = kobj_ns_ops(kobj);
if (ops) {
const void *init_ns, *ns;
+
ns = kobj->ktype->namespace(kobj);
init_ns = ops->initial_ns();
return ns != init_ns;
@@ -391,6 +392,7 @@
ops = kobj_ns_ops(kobj);
if (!ops && kobj->kset) {
struct kobject *ksobj = &kobj->kset->kobj;
+
if (ksobj->parent != NULL)
ops = kobj_ns_ops(ksobj->parent);
}
@@ -518,21 +520,6 @@
return 0;
}
- if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP) &&
- IS_ENABLED(CONFIG_FREEZER) &&
- IS_ENABLED(CONFIG_ANDROID)) {
- /*
- * Android healthd try to listen power_supply subsystem uevent,
- * but which will block system from suspend on big.LITTLE system
- * because thermal_cooling_device_unregister will called when
- * cpufreq_exit. So ignore this uevent when suspend.
- */
- extern bool pm_freezing;
-
- if (pm_freezing && !strcmp(subsystem, "thermal"))
- return 0;
- }
-
/* environment buffer */
env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
if (!env)
@@ -598,7 +585,7 @@
mutex_lock(&uevent_sock_mutex);
/* we will send an event, so request a new sequence number */
- retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)++uevent_seqnum);
+ retval = add_uevent_var(env, "SEQNUM=%llu", ++uevent_seqnum);
if (retval) {
mutex_unlock(&uevent_sock_mutex);
goto exit;
@@ -782,8 +769,7 @@
ue_sk->sk = netlink_kernel_create(net, NETLINK_KOBJECT_UEVENT, &cfg);
if (!ue_sk->sk) {
- printk(KERN_ERR
- "kobject_uevent: unable to create netlink socket!\n");
+ pr_err("kobject_uevent: unable to create netlink socket!\n");
kfree(ue_sk);
return -ENODEV;
}
--
Gitblit v1.6.2