From: viresh.kumar@linaro.org (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 3/5] drivers: boot_constraint: Add boot_constraints_disable kernel parameter
Date: Wed, 28 Jun 2017 15:56:36 +0530 [thread overview]
Message-ID: <f2fff03550bd14e1334de3faa1a79c0f8651b09d.1498642745.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1498642745.git.viresh.kumar@linaro.org>
Users must be given an option to discard any constraints set by
bootloaders. For example, consider that a constraint is set for the LCD
controller's supply and the LCD driver isn't loaded by the kernel. If
the user doesn't need to use the LCD device, then he shouldn't be forced
to honour the constraint.
We can also think about finer control of such constraints with help of
some sysfs files, but a kernel parameter is fine to begin with.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Documentation/admin-guide/kernel-parameters.txt | 2 ++
drivers/base/boot_constraint.c | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 7737ab5d04b2..35e8a298bfc1 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -426,6 +426,8 @@
embedded devices based on command line input.
See Documentation/block/cmdline-partition.txt
+ boot_constraints_disable = Do not set any boot constraints for devices.
+
boot_delay= Milliseconds to delay each printk during boot.
Values larger than 10 seconds (10000) are changed to
no delay (0).
diff --git a/drivers/base/boot_constraint.c b/drivers/base/boot_constraint.c
index 495344e6405b..ab766d60191a 100644
--- a/drivers/base/boot_constraint.c
+++ b/drivers/base/boot_constraint.c
@@ -45,6 +45,17 @@ static DEFINE_MUTEX(constraint_devices_mutex);
static int constraint_supply_add(struct constraint *constraint, void *data);
static void constraint_supply_remove(struct constraint *constraint);
+static bool constraints_disabled;
+
+static int __init constraints_disable(char *str)
+{
+ constraints_disabled = true;
+ pr_debug("disabled\n");
+
+ return 0;
+}
+early_param("boot_constraints_disable", constraints_disable);
+
/* Boot constraints core */
@@ -152,6 +163,9 @@ int boot_constraint_add(struct device *dev, enum boot_constraint_type type,
struct constraint *constraint;
int ret;
+ if (constraints_disabled)
+ return -ENODEV;
+
mutex_lock(&constraint_devices_mutex);
/* Find or add the cdev type first */
@@ -202,6 +216,9 @@ void boot_constraints_remove(struct device *dev)
struct constraint_dev *cdev;
struct constraint *constraint, *temp;
+ if (constraints_disabled)
+ return;
+
mutex_lock(&constraint_devices_mutex);
cdev = constraint_device_find(dev);
--
2.13.0.71.gd7076ec9c9cb
next prev parent reply other threads:[~2017-06-28 10:26 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 10:26 [RFC 0/5] drivers: Add boot constraints core Viresh Kumar
2017-06-28 10:26 ` [RFC 1/5] " Viresh Kumar
2017-06-28 15:55 ` Randy Dunlap
2017-06-29 3:51 ` Viresh Kumar
2017-06-29 12:50 ` Russell King - ARM Linux
2017-06-29 14:49 ` Viresh Kumar
2017-06-28 10:26 ` [RFC 2/5] drivers: boot_constraint: Add support for supply constraints Viresh Kumar
2017-06-28 10:26 ` Viresh Kumar [this message]
2017-06-28 15:51 ` [RFC 3/5] drivers: boot_constraint: Add boot_constraints_disable kernel parameter Randy Dunlap
2017-06-28 10:26 ` [RFC 4/5] drivers: boot_constraint: Add debugfs support Viresh Kumar
2017-06-28 15:46 ` Randy Dunlap
2017-06-29 4:11 ` Viresh Kumar
2017-06-28 10:26 ` [RFC 5/5] drivers: Code to test boot constraints Viresh Kumar
2017-06-29 12:40 ` [RFC 0/5] drivers: Add boot constraints core Enrico Weigelt, metux IT consult
2017-06-29 14:47 ` Viresh Kumar
2017-06-29 15:06 ` Enrico Weigelt, metux IT consult
2017-06-30 3:16 ` Viresh Kumar
2017-06-30 3:33 ` Chen-Yu Tsai
2017-06-30 3:55 ` Viresh Kumar
2017-06-30 4:05 ` Chen-Yu Tsai
2017-06-30 4:12 ` Viresh Kumar
2017-06-30 4:22 ` Chen-Yu Tsai
2017-06-30 5:12 ` Viresh Kumar
2017-06-30 6:36 ` Chen-Yu Tsai
2017-06-30 8:43 ` Viresh Kumar
2017-06-30 12:10 ` Mark Brown
2017-07-03 6:15 ` Viresh Kumar
2017-07-03 15:07 ` Mark Brown
2017-07-04 6:45 ` Viresh Kumar
2017-06-30 12:12 ` Mark Brown
2017-06-29 12:49 ` Russell King - ARM Linux
2017-06-29 13:05 ` Enrico Weigelt, metux IT consult
2017-06-29 14:58 ` Viresh Kumar
2017-06-29 15:43 ` Russell King - ARM Linux
2017-06-29 21:00 ` Stephen Boyd
2017-07-05 22:07 ` Rob Clark
2017-07-07 22:39 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f2fff03550bd14e1334de3faa1a79c0f8651b09d.1498642745.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).