From patchwork Tue Aug 1 09:23:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 109131 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1268489qge; Tue, 1 Aug 2017 02:30:32 -0700 (PDT) X-Received: by 10.98.34.201 with SMTP id p70mr18504980pfj.330.1501579832126; Tue, 01 Aug 2017 02:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501579832; cv=none; d=google.com; s=arc-20160816; b=rwn71OXyLfVxacf+LaHkCZn6UH2WIEWXscLShdlEScRgmKiHX09lHaJhEn5VBG6XwM 8wrClM/lsaFD7VK5jwCFDB5J0VnJgHjG2mzgOfi9nNiNAXKI/1jZRKMT6f+vwfmcOQjV MUXcFam3o4PiLzM/r8H1WbFeEEznQ1Nsi0dOaKJTzsl2QXSB+EfnBJSTO3jedbwI2Lie Y/W/kFkID75n1VpAtQbalID3UbxApNJ0VquRyeqfWQ+ihCRRux30fTHThD8ZPcUx1G1j ofTmo7ts211D13Nds7Td8d3qbaeP/ElAGB4udlHUAtu9om9SRHqW+QfJtiMcLI+ZujBd ZIMw== 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=aH8FdonCLl0m8Z3J7tViAvmmWIkQ8wHx84A/SUHjLg8=; b=s+OPxf1CNO/zf/ZqOIbqR6Jf4+WoYApwYxO5tOVYRh8MCSXBsO/+2Kwc0TodUAwgRx ACVaGb/J2QabIPxmfK+o6hOCzfXo7yROqx68oLCdHnxxQsUq7u+TjKuH0t0RNy26Af55 K6wZzuxGzZkb2o530PUvaWlINhbdiDNWWTJZngxYjq56kOVAT+hfOtBxB/6jOI9f//ok 2JkY9eis9RZPqtO9a0pyqsbck2Qxaciv1+svlqjmpYR//0ntC4bdbeYpC6rqGhugfVmx 8Hs3aFFXrXpQ0Ij6juyBdLc78kh+S0UCcK1z6EmTdwskivDxKi6GeNWqFa+n4mNrapIk K00A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=XoWlccBu; 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 j10si17567484pfc.13.2017.08.01.02.30.31; Tue, 01 Aug 2017 02:30:32 -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=XoWlccBu; 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 S1751993AbdHAJa3 (ORCPT + 26 others); Tue, 1 Aug 2017 05:30:29 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:33550 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbdHAJ2y (ORCPT ); Tue, 1 Aug 2017 05:28:54 -0400 Received: by mail-pf0-f172.google.com with SMTP id d67so5614447pfc.0 for ; Tue, 01 Aug 2017 02:28:54 -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=aH8FdonCLl0m8Z3J7tViAvmmWIkQ8wHx84A/SUHjLg8=; b=XoWlccBufOT5MRayOPCO5bsLalMaVjorNtK88xC4l8vAMHcpGUUgB8xE05ZX9EU6NP esq9SmD/AFq7+lgncMcgswdkCfFgO+61IJKR2xyLNixJmD66yFr+oZSEUUeKhAJTOc5Q 3eVlpkKuRhm7RFWLPPGoqQTxqfYKBpXnh5gA8= 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=aH8FdonCLl0m8Z3J7tViAvmmWIkQ8wHx84A/SUHjLg8=; b=fmKnIEEluiFlgc3wTfyojoQpb8+ZYjx/rQUDWNcFoJUcfserofRN8fCm6sApB8p6BS vcEQXlQYm+myvWGQ6qw2XskyKLMFWyYzHBI1nvtsanB+Y5Xjb1+K08LrnG5OPUlino/C iLN7l8OPyUegfxGI2eocodKi0DPk/GR/5ikBpUBnTWCKirCFdYvhD2V6ll5J25V+hAj8 2nUjbCn6TyxwmbtUw28du5PtRE7gYiI5GWSPHFddZMeA18eSdvOLvVxFiXFbVmfCPm+a wyBsNf8/vpjogetS8LNjCzdg6YEZuFXV8FRFkLLUGy8tjuAXOnvKEP/0R9LJRnTf2oV4 Gu6Q== X-Gm-Message-State: AIVw111879eamNguDRRle3Isbvord++5E7gTXdKVhM7BLnh7Snt6V56g 7EJYhvICSdWetVRv X-Received: by 10.98.215.21 with SMTP id b21mr3205762pfh.120.1501579733947; Tue, 01 Aug 2017 02:28:53 -0700 (PDT) Received: from localhost ([122.172.27.66]) by smtp.gmail.com with ESMTPSA id a87sm8569597pfg.18.2017.08.01.02.28.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 02:28:53 -0700 (PDT) From: Viresh Kumar To: Greg Kroah-Hartman , Jonathan Corbet Cc: Viresh Kumar , Vincent Guittot , Mark Brown , Stephen Boyd , Rajendra Nayak , Shiraz Hashim , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robdclark@gmail.com, linux-doc@vger.kernel.org Subject: [PATCH V3 2/8] drivers: boot_constraint: Add boot_constraints_disable kernel parameter Date: Tue, 1 Aug 2017 14:53:43 +0530 Message-Id: <4bec0c3e58f76e06e5305c5ddbab859e2a87935e.1501578037.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. Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- Documentation/admin-guide/kernel-parameters.txt | 3 +++ drivers/base/boot_constraints/core.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 d9c171ce4190..0706d1b6004d 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_constraints/core.c b/drivers/base/boot_constraints/core.c index 366a05d6d9ba..e0c33b2b216f 100644 --- a/drivers/base/boot_constraints/core.c +++ b/drivers/base/boot_constraints/core.c @@ -24,6 +24,17 @@ static LIST_HEAD(constraint_devices); static DEFINE_MUTEX(constraint_devices_mutex); +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 */ static struct constraint_dev *constraint_device_find(struct device *dev) @@ -126,6 +137,9 @@ int dev_boot_constraint_add(struct device *dev, struct constraint *constraint; int ret; + if (boot_constraints_disabled) + return -ENODEV; + mutex_lock(&constraint_devices_mutex); /* Find or add the cdev type first */ @@ -184,6 +198,9 @@ void dev_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);