From patchwork Wed Jul 12 06:34:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 107447 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp433231qge; Tue, 11 Jul 2017 23:36:04 -0700 (PDT) X-Received: by 10.98.20.21 with SMTP id 21mr54343663pfu.29.1499841364725; Tue, 11 Jul 2017 23:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499841364; cv=none; d=google.com; s=arc-20160816; b=AkD3F3IuQEEWM6T3r2JG19rX6w9QTRPQ3lZ3722RjnZOKnj/z1hhCaSLF+7Gi3kPgr 7scwZhi9nrIUcx++pzmUJ9zwpomL+v2b2KOovSxCl4LpaHNauUI+2bukzEd6DdUDfYnA 30hNocUiuKrMFx2p+x56eg24l7XmGmWIdIn1ViwTAvuiGzy48hFCSfSr3h+jvG/oT5aX 7Br6HBzOBqKhW9seRjWaBcIhQY2e6sLAg32rb35PlSqH6EAnFjBX+0QJ2VlbOT58udLA Nvjqy1jaZutcEK6ntM8JwNs0ugaBTVSArcZxy9hx7Gxxo1toI+llxq3YT1+h7i8VwXuD qplw== 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=JN2s3a0iKOt7yZpQvgFqmRb/Kxe2j8m64PVCr/uK68k=; b=Ujnzq/aAbe9fbUFuLBGx2mukVwWMouIPf0oSQJlxmL2KhzJVZRZ38m4d7Zl7/JwbPE ct74FLgbNxsfp6ut+n5YOb/f6SDvSe8NNVET+HzqnL71u1gAYkd08kJXB1ZnmhI3l2/s w4mgKzdbBZqYlrnEqH0M250EzPzF1cc3AcjK3b00jd25c97Th0k3kv/SMd7T2yjJHVTe CK1AFVoNFArZAjclKp+d45z/8YJqocYlMRd3AaoUJ+RYO/O0xhz3XNeY8nhdP2ckSd41 siOMC9a4xjwyaSVDMrtLoNFwZXe8beuxkfqxOQzJxAcx5kw/0P6x6okDgD45AaqAr8+P bE1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=UI+hRtQX; 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 t1si1258344pfj.130.2017.07.11.23.36.04; Tue, 11 Jul 2017 23:36:04 -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=UI+hRtQX; 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 S1756619AbdGLGe4 (ORCPT + 25 others); Wed, 12 Jul 2017 02:34:56 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:33098 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756455AbdGLGex (ORCPT ); Wed, 12 Jul 2017 02:34:53 -0400 Received: by mail-pf0-f181.google.com with SMTP id e7so8025181pfk.0 for ; Tue, 11 Jul 2017 23:34:53 -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=JN2s3a0iKOt7yZpQvgFqmRb/Kxe2j8m64PVCr/uK68k=; b=UI+hRtQXKHzHjDUZCip91tPgbNiPlDzHyskaiEhRp/wzn++7hglhjrN6Sh/h+TnQ6k wjbbhj/xHrPoGsZaxtl6yjku9Jf9/iUqxpzyg8S70aNT8RPE99C5bsqQ8MzXbkgz1Je8 sAa4DkFeLEkIJlvNKO+GqDs54z59RfPzRsVl4= 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=JN2s3a0iKOt7yZpQvgFqmRb/Kxe2j8m64PVCr/uK68k=; b=iQO77oLhTvBQ6dpdI1d096PUxSIgYChpVw8xIxInv4aep1TRv2Y5w7rgDM5bP35qZf 7KMUpCnipU1+IS4jBqiVkvGGdx89MtCdhHNkdoRUbYob2iwDmxMAY1T8XGvpXekKHJKk CVAd+GnRf474RMVYXUxgkUk10KRe1FtqHhYZU+vLl0PRHKIPLaob2YdEXS803wVFYfzo kilN3Ws6HyfqscAWU9v5nkw2Y7Hoy9YdCb5Wrl2mw52Kfbn1UYmWnNDYo5wppEsmonwJ S+jF3rmy/tI7yF2OfM7vbeYm3s//3/g06xEJ69XWRNwXtjdTqt79wPjjCl946phDNXOf PMew== X-Gm-Message-State: AIVw112izJ4CaKeDvm8fVxlC/nCkM7BYZ6bMu+NuzK3NbOT66GvlTO21 mOIB/k+dwGQrrQGv X-Received: by 10.98.178.15 with SMTP id x15mr52878276pfe.75.1499841293091; Tue, 11 Jul 2017 23:34:53 -0700 (PDT) Received: from localhost ([122.167.138.108]) by smtp.gmail.com with ESMTPSA id 8sm2649133pfs.23.2017.07.11.23.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 23:34:52 -0700 (PDT) From: Viresh Kumar To: Greg Kroah-Hartman , Jonathan Corbet Cc: Viresh Kumar , Vincent Guittot , Rob Herring , Mark Brown , Stephen Boyd , Rajendra Nayak , Shiraz Hashim , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org Subject: [RFC v2 3/6] drivers: boot_constraint: Add boot_constraints_disable kernel parameter Date: Wed, 12 Jul 2017 12:04:33 +0530 Message-Id: <8bcfe99c1392bee097199b682fa922f36a842857.1499770771.git.viresh.kumar@linaro.org> 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 | 3 +++ drivers/base/boot_constraint.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) -- 2.13.0.71.gd7076ec9c9cb diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 7737ab5d04b2..59ad24822d10 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -426,6 +426,9 @@ 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 4e4332751c5f..d372ddfe1264 100644 --- a/drivers/base/boot_constraint.c +++ b/drivers/base/boot_constraint.c @@ -47,6 +47,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 boot_constraints_disabled; + +static int __init constraints_disable(char *str) +{ + boot_constraints_disabled = true; + pr_debug("disabled\n"); + + return 0; +} +early_param("boot_constraints_disable", constraints_disable); + /* Boot constraints core */ @@ -154,6 +165,9 @@ int boot_constraint_add(struct device *dev, enum boot_constraint_type type, struct constraint *constraint; int ret; + if (boot_constraints_disabled) + return -ENODEV; + mutex_lock(&constraint_devices_mutex); /* Find or add the cdev type first */ @@ -211,6 +225,9 @@ void boot_constraints_remove(struct device *dev) struct constraint_dev *cdev; struct constraint *constraint, *temp; + if (boot_constraints_disabled) + return; + mutex_lock(&constraint_devices_mutex); cdev = constraint_device_find(dev);