From patchwork Wed Jun 28 10:26:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106513 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp839056qge; Wed, 28 Jun 2017 03:28:20 -0700 (PDT) X-Received: by 10.99.8.1 with SMTP id 1mr9680431pgi.15.1498645700120; Wed, 28 Jun 2017 03:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498645700; cv=none; d=google.com; s=arc-20160816; b=KOczN0pu2UrnJ11ubL+FvfG6I0EjCqqMsSeFMTboEzBSGnIbjvJmxLv2naOaKXxtnl ntzpURToz/ORJ2YSv+HBiT6qrnjBOjUAd3z9HF+lOqb7f57r9jyBqBlGSh2tiNYiZBye ruxz8/gSl6UkFc39bYk99D2JrZxwdiUYM8/nbjosE2BZPmc6j/ETXixzo7xIZNmgjm9c AcN3KZLiP+RtHbLoTdtEB2CEykCu0j7ZRoFqRics4rBJiKufLixahzBtX2uToXY84wnL 8snMja4iIm1r/8tk3oeLVmHApoSZQklDLhkPEygXyy9FQhyFuOYDVsInphzZaux3DEQN rRRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=qyB32UkiHvfw4RrsV6muACp7JOg89CFII9LwZnma0os=; b=0vfqeP30x3ZAsyoJlJGXJ0QfoNzPaWPEffhldtlG15OAnkNkGduEBlq2blOSAbRzNC aAJX2fbocfLocDWwSZsSPiZc8enYM5HS8XbOt1X8F6a3GBxOyo3KwO4OS2OB54nxangY vWEcAo9fLbzdjMk4QU4awnFpC3T7f8fAuahatxxRVhP0ELWC8UcRZt+Ok1WNsQSdoE1H RHsagOuIcKUi0CN5TS+23JNK+rAr6QBFSUj2cb5cK3cy+39QzxRc6KnROv7eIljDafx+ MgiOLtRBQtJnAzDvlIzUkYojxh4JysEQPdVVcR1/WPXYVnhs8HqdNV1KZQ2SDQJZZKHc Eizg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=AhIqkcQp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u91si1401529plb.586.2017.06.28.03.28.19; Wed, 28 Jun 2017 03:28:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=AhIqkcQp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbdF1K2G (ORCPT + 25 others); Wed, 28 Jun 2017 06:28:06 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:33923 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbdF1K1T (ORCPT ); Wed, 28 Jun 2017 06:27:19 -0400 Received: by mail-pg0-f49.google.com with SMTP id t186so29977956pgb.1 for ; Wed, 28 Jun 2017 03:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=qyB32UkiHvfw4RrsV6muACp7JOg89CFII9LwZnma0os=; b=AhIqkcQpuDm+Zq8oNR/83VVivuEJkDDxHlX4Ct2tWF1LK3plt0XdIluUidflvZ2Y0q LcbLNrMBqjq8xpQve/CulAdOcfxjDPDCAa714BVsiulQY6eOi7zz1SWtZ//klzRNycJB O0MUWfVSdYACx12SjckkVDh3vTsAzWwAAcsD0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=qyB32UkiHvfw4RrsV6muACp7JOg89CFII9LwZnma0os=; b=d0B2hupI+zpSu7OcL/q5OD9y1rO0WwrgOvhqLxSb14kqShN0lydHyrradI6KqUxQVy nUd5HXwORg8yCyL+L3OMeHFU490T08RYKqlw3fpjUNcD5uXgqep6eTCgrdp6B/9SgtEF Gg9+6h1VO/LLz7zpBh+kjJUKXK0ptjwPDIKGLSaYmaXvsMzAuwC1Slh+WGqfw0hUJWPw G4urZRWAwWVM5hOzsXcofTXPykOU/i8hFUB8KWKTJh9K8IyPOfiItvvuZcV8j9n3f/tz 3IY2OyZ2jsmzxlurkNZFUjFhybbOw0ACUFdOZh6BBRjqiMyYnQojpF5RmQ3B1UCBuSa6 DmpQ== X-Gm-Message-State: AKS2vOwrTXltQUGZJFnoXdIk6Xlf8h5Uo8QNXMlgoBQrhHIOJQjMTzUp SrLgXadhRupuN7io X-Received: by 10.99.103.7 with SMTP id b7mr9844035pgc.2.1498645638103; Wed, 28 Jun 2017 03:27:18 -0700 (PDT) Received: from localhost ([122.171.238.149]) by smtp.gmail.com with ESMTPSA id y15sm4265243pgs.33.2017.06.28.03.27.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 03:27:17 -0700 (PDT) From: Viresh Kumar To: Greg Kroah-Hartman Cc: Viresh Kumar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rafael Wysocki , Vincent Guittot , Stephen Boyd , Mark Brown , Shiraz Hashim , Rob Herring , rnayak@codeaurora.org, linux-doc@vger.kernel.org Subject: [RFC 3/5] drivers: boot_constraint: Add boot_constraints_disable kernel parameter Date: Wed, 28 Jun 2017 15:56:36 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ drivers/base/boot_constraint.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) -- 2.13.0.71.gd7076ec9c9cb 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);