armbian_build/patch/kernel/archive/sunxi-5.16/patches.megous/misc-modem-power-Allow-blocking-user-space-from-controlling-the.patch
The-going f80117f21c
Recycling of megous v5.16.4 patches (#3449)
* Recycling of megous v5.16.4 patches

The patches were sorted as far as possible. Some patches are renamed
according to their place of application. The length of the patch name
has been changed to improve readability using
the `git format-patch --filename-max-length=75` method.

The folder containing the patches will have the name `patches.name`
and the corresponding file `series.name` for the convenience
of processing and moving them upstream. But the control file remains
`series.conf`.


Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>

* Add a series of armbian patches for 5.16

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>

* Remove patches whose fixes are already in the kernel

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>
2022-02-02 11:03:44 +01:00

71 lines
1.8 KiB
Diff

From 583495a6ebc48d7aa9b84db680c673c936b842d3 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Mon, 23 Nov 2020 02:42:46 +0100
Subject: [PATCH 120/446] misc:modem-power: Allow blocking user space from
controlling the modem power driver.
Allow to block userpsace from controlling the modem power driver
For p-boot privacy switch.
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/misc/modem-power.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/misc/modem-power.c b/drivers/misc/modem-power.c
index 1f5bfe104..9afa64ce0 100644
--- a/drivers/misc/modem-power.c
+++ b/drivers/misc/modem-power.c
@@ -179,6 +179,7 @@ enum {
/* config options */
MPWR_F_DUMB_POWERUP,
MPWR_F_FASTBOOT_POWERUP,
+ MPWR_F_BLOCKED,
/* file */
MPWR_F_OPEN,
MPWR_F_OVERFLOW,
@@ -1188,6 +1189,9 @@ static ssize_t powered_store(struct device *dev,
bool status;
int ret;
+ if (test_bit(MPWR_F_BLOCKED, mpwr->flags))
+ return -EPERM;
+
ret = kstrtobool(buf, &status);
if (ret)
return ret;
@@ -1205,6 +1209,9 @@ static ssize_t powered_blocking_store(struct device *dev,
bool status;
int ret;
+ if (test_bit(MPWR_F_BLOCKED, mpwr->flags))
+ return -EPERM;
+
ret = kstrtobool(buf, &status);
if (ret)
return ret;
@@ -1311,6 +1318,9 @@ static ssize_t hard_reset_store(struct device *dev,
bool val;
int ret;
+ if (test_bit(MPWR_F_BLOCKED, mpwr->flags))
+ return -EPERM;
+
ret = kstrtobool(buf, &val);
if (ret)
return ret;
@@ -1400,6 +1410,9 @@ static int mpwr_probe_generic(struct device *dev, struct mpwr_dev **mpwr_out)
return -EINVAL;
}
+ if (of_property_read_bool(np, "blocked"))
+ set_bit(MPWR_F_BLOCKED, mpwr->flags);
+
mpwr->status_pwrkey_multiplexed =
of_property_read_bool(np, "status-pwrkey-multiplexed");
--
2.31.1