Skip to contentSkip to conversation

tool api fs: Correctly encode errno for read/write open failures

PATCH New Sasha Levin 1 participant 3 messages Jan 26, 2025

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

PATCH 1/3 tool api fs: Correctly encode errno for read/write open failures

From: Ian Rogers <[email protected]>

[ Upstream commit 05be17eed774aaf56f6b1e12714325ca3a266c04 ]

Switch from returning -1 to -errno so that callers can determine types of failure.

Cc Adrian Hunter <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Athira Rajeev <[email protected]>
Cc Ben Gainey <[email protected]>
Cc Colin Ian King <[email protected]>
Cc Dominique Martinet <[email protected]>
Cc Ilkka Koskinen <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Oliver Upton <[email protected]>
Cc Paran Lee <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steinar H. Gunderson <[email protected]>
Cc Steven Rostedt (VMware) <[email protected]>
Cc Thomas Falcon <[email protected]>
Cc Weilin Wang <[email protected]>
Cc Yang Jihong <[email protected]>
Cc Yang Li <[email protected]>
Cc Ze Gao <[email protected]>
Cc Zixian Cai <[email protected]>
Cc zhaimingbing <[email protected]>
---
 tools/lib/api/fs/fs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/lib/api/fs/fs.c +3 -3
index 82f53d81a7a78..a0a6a907315f0 100644
@@ -323,7 +323,7 @@ int filename__read_int(const char *filename, int *value)
 	int fd = open(filename, O_RDONLY), err = -1;
 
 	if (fd < 0)
-		return -1;
+		return -errno;
 
 	if (read(fd, line, sizeof(line)) > 0) {
 		*value = atoi(line);
@@ -341,7 +341,7 @@ static int filename__read_ull_base(const char *filename,
 	int fd = open(filename, O_RDONLY), err = -1;
 
 	if (fd < 0)
-		return -1;
+		return -errno;
 
 	if (read(fd, line, sizeof(line)) > 0) {
 		*value = strtoull(line, NULL, base);
@@ -428,7 +428,7 @@ int filename__write_int(const char *filename, int value)
 	char buf[64];
 
 	if (fd < 0)
-		return err;
+		return -errno;
 
 	sprintf(buf, "%d", value);
 	if (write(fd, buf, sizeof(buf)) == sizeof(buf))
Signature · 1 line
2.39.5
author maintainer
#1 lore raw

PATCH 2/3 Input: allocate keycode for phone linking

From: Illia Ostapyshyn <[email protected]>

[ Upstream commit 1bebc7869c99d466f819dd2cffaef0edf7d7a035 ]

The F11 key on the new Lenovo Thinkpad T14 Gen 5, T16 Gen 3, and P14s Gen 5 laptops includes a symbol showing a smartphone and a laptop chained together. According to the user manual, it starts the Microsoft Phone Link software used to connect to Android/iOS devices and relay messages/calls or sync data.

As there are no suitable keycodes for this action, introduce a new one.

---
 include/uapi/linux/input-event-codes.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/input-event-codes.h +1 -0
index bed20a89c14c1..6128146bb133b 100644
@@ -519,6 +519,7 @@
 #define KEY_NOTIFICATION_CENTER	0x1bc	/* Show/hide the notification center */
 #define KEY_PICKUP_PHONE	0x1bd	/* Answer incoming call */
 #define KEY_HANGUP_PHONE	0x1be	/* Decline incoming call */
+#define KEY_LINK_PHONE		0x1bf   /* AL Phone Syncing */
 
 #define KEY_DEL_EOL		0x1c0
 #define KEY_DEL_EOS		0x1c1
Signature · 1 line
2.39.5
author maintainer
#2 lore raw

PATCH 3/3 platform/x86: acer-wmi: Ignore AC events

In reply to Sasha Levin

From: Armin Wolf <[email protected]>

[ Upstream commit f6bfa25c6665f8721421ea94fe506cc22f1d4b43 ]

On the Acer Swift SFG14-41, the events 8 - 1 and 8 - 0 are printed on AC connect/disconnect. Ignore those events to avoid spamming the kernel log with error messages.

---
 drivers/platform/x86/acer-wmi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/acer-wmi.c +4 -0
index 82516796a53b0..7ef80f517e76e 100644
@@ -88,6 +88,7 @@ enum acer_wmi_event_ids {
 	WMID_HOTKEY_EVENT = 0x1,
 	WMID_ACCEL_OR_KBD_DOCK_EVENT = 0x5,
 	WMID_GAMING_TURBO_KEY_EVENT = 0x7,
+	WMID_AC_EVENT = 0x8,
 };
 
 static const struct key_entry acer_wmi_keymap[] __initconst = {
@@ -2067,6 +2068,9 @@ static void acer_wmi_notify(u32 value, void *context)
 		if (return_value.key_num == 0x4)
 			acer_toggle_turbo();
 		break;
+	case WMID_AC_EVENT:
+		/* We ignore AC events here */
+		break;
 	default:
 		pr_warn("Unknown function number - %d - %d\n",
 			return_value.function, return_value.key_num);
Signature · 1 line
2.39.5