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: 9813919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53237603D7 for ; Wed, 28 Jun 2017 10:39:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3015E284F4 for ; Wed, 28 Jun 2017 10:39:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 232FF28506; Wed, 28 Jun 2017 10:39:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6F9E284F4 for ; Wed, 28 Jun 2017 10:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=01cixGVlrl70lxEfQ+E5EkBT37zjuyNjTCS6a6MTboA=; b=Nn5+PPY43Tc2uVnDR3hTeRstgF XKLYqs1xOA6HC7yfBhnc/MvsGmw2nayZ9fRDyzh3uzHDRbvRqeSq0i2bsFirezRFGq+bYTrbJ4ibc zlW7qzsZ1gQtKpk+ZxrrZAhzImwxrAp8UrcbRk7IqwrlADNoSjKHS+HwGUGvLUHt/TY9hNVCvqBYI e6vT89AmDwm9HvqNFkwzjiE0o9JBbB81BCwVKpGviFQCE1CorSfBcI4124tHeJuIcRve1Gpmcdoho 1t5EF6Lepek/EwFRF5OaoKk5wqC7ZEo2ejtAGTNxWSedNFzbkD5zDUnwFYeUyK1TE8yoqUwRCzNqi yDC/pdgQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dQANs-0001aO-9N; Wed, 28 Jun 2017 10:39:44 +0000 Received: from mail-pg0-x236.google.com ([2607:f8b0:400e:c05::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dQACB-0004vY-9c for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2017 10:27:44 +0000 Received: by mail-pg0-x236.google.com with SMTP id f127so29835560pgc.0 for ; Wed, 28 Jun 2017 03:27:18 -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=ctwLhhRt+KqGSmFLDXbzReusEyIyght1R4SAArI6MllKycMlmoowXLud/ZOuOtC+vG jlDdOAhFCF3xMTk4ukYg/BhixumRijqjv2cx4Rs4kettWcErSlqJNjXRv4UZiKL3Q2PT 5yqstX+jgsY2pYqrYW9U3ZZbeehrNf1We+pwIYihM2mutd5uU9n7JaUNxGW3j3j9v1cw dEkvW12E7SYrJUMYB7/2maq25kztBicUyxgvzytTK8mtdJtdlfyY3maictCONx4+qlyb b7vB6K5+O5lbLsxkeMw8O/1EZalTRMBCjaxzDLwUJS166i2IFc7ZcsfSKWESn6HWSV0P 1H9A== X-Gm-Message-State: AKS2vOyGwVG4BRYh+moqnyOHjoprHmTr5ZIZ/Tg5iShFQgHgHj7zKqNB QefKuxmnUlmgacIt 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170628_032739_679128_60235E82 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rafael Wysocki , Vincent Guittot , Rob Herring , Viresh Kumar , linux-doc@vger.kernel.org, Stephen Boyd , linux-kernel@vger.kernel.org, Mark Brown , rnayak@codeaurora.org, Shiraz Hashim , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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);