From patchwork Sat Jul 6 13:49:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Rodolfo_Garc=C3=ADa_Pe=C3=B1as_=28kix=29?= X-Patchwork-Id: 2824496 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 17513C0AB2 for ; Sat, 6 Jul 2013 13:56:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2052F20161 for ; Sat, 6 Jul 2013 13:56:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D1B52012B for ; Sat, 6 Jul 2013 13:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751442Ab3GFN4i (ORCPT ); Sat, 6 Jul 2013 09:56:38 -0400 Received: from mail.kix.es ([46.105.17.89]:54724 "EHLO what.com.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751051Ab3GFN4h (ORCPT ); Sat, 6 Jul 2013 09:56:37 -0400 X-Greylist: delayed 423 seconds by postgrey-1.27 at vger.kernel.org; Sat, 06 Jul 2013 09:56:37 EDT Received: from osaka.kix.es (4.Red-217-127-226.staticIP.rima-tde.net [217.127.226.4]) by what.com.es (Postfix) with ESMTPA id 573A46A09C2; Sat, 6 Jul 2013 15:49:33 +0200 (CEST) From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= To: linux-pm@vger.kernel.org Cc: rjw@sisk.pl, =?UTF-8?q? "Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)" ?= Subject: [PATCH 6/7] Support to disable KMS using config file Date: Sat, 6 Jul 2013 15:49:15 +0200 Message-Id: <1373118556-27472-7-git-send-email-kix@kix.es> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1373118556-27472-1-git-send-email-kix@kix.es> References: <1373118556-27472-1-git-send-email-kix@kix.es> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Rodolfo García Peñas (kix)" This patch adds support to disable the KMS via config file. The user can add "s2ram_disable_kms = y" to the configuration file to avoid the use of KMS. We need move up the call to read the config file for s2ram (get_s2ram_config()) because the test for the "no_kms_flag" [line 90: "if (!no_kms_flag) {"]. In s2ram.c, the function to read the config file search for s2ram_disable_kms" and as sign the value to s2ram_disable_kms variable. Signed-off-by: Rodolfo García Peñas (kix) --- s2ram-main.c | 6 +++--- s2ram-x86.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/s2ram-main.c b/s2ram-main.c index 40ba17b..c37d578 100644 --- a/s2ram-main.c +++ b/s2ram-main.c @@ -84,6 +84,9 @@ int main(int argc, char *argv[]) } } + /* Test if s2ram will use quirks from the configuration file */ + ret = get_s2ram_config(); + /* Check if the KMS support is disabled by user */ if (!no_kms_flag) { /* KMS */ @@ -98,9 +101,6 @@ int main(int argc, char *argv[]) printf("KMS disabled by user.\n"); } - /* Test if s2ram will use quirks from the configuration file */ - ret = get_s2ram_config(); - if (ret) { /* No configuration file, using quirks form database */ ret = s2ram_is_supported(); diff --git a/s2ram-x86.c b/s2ram-x86.c index ec581a2..78b9433 100644 --- a/s2ram-x86.c +++ b/s2ram-x86.c @@ -32,7 +32,7 @@ static unsigned char vga_pci_state[256]; static struct pci_dev vga_dev; static struct pci_access *pacc; static int vbe_mode = -1, dmi_scanned; -static char s2ram_force; +static char s2ram_force, s2ram_disable_kms; static char s2ram_quirks[MAX_STR_LEN]; int flags, force, fb_nosuspend; @@ -44,6 +44,11 @@ int flags, force, fb_nosuspend; static struct config_par s2ram_parameters[] = { { + .name = "s2ram_disable_kms", + .fmt = "%c", + .ptr = &s2ram_disable_kms, + }, + { .name = "s2ram_force", .fmt = "%c", .ptr = &s2ram_force, @@ -431,6 +436,10 @@ int get_s2ram_config(void) fprintf(stderr, "%s: Could not parse config file\n", ret_name); return error; } + + if (s2ram_disable_kms == 'y') + no_kms_flag = 1; + if (s2ram_force == 'y') { force = 1;