From patchwork Mon Mar 11 10:46:20 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: 2247791 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 84F103FCF6 for ; Mon, 11 Mar 2013 10:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753857Ab3CKKql (ORCPT ); Mon, 11 Mar 2013 06:46:41 -0400 Received: from ks399202.kimsufi.com ([37.59.37.136]:49899 "EHLO ks399202.kimsufi.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753748Ab3CKKqk (ORCPT ); Mon, 11 Mar 2013 06:46:40 -0400 Received: from kentin.kix.es (98.Red-95-125-211.staticIP.rima-tde.net [95.125.211.98]) by ks399202.kimsufi.com (mail) with ESMTPSA id EA7A12F8014E; Mon, 11 Mar 2013 11:52:59 +0100 (CET) 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 2/3] Support to disable KMS using config file Date: Mon, 11 Mar 2013 11:46:20 +0100 Message-Id: <1362998781-4651-3-git-send-email-kix@kix.es> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362998781-4651-1-git-send-email-kix@kix.es> References: <1362998781-4651-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 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 assign the value to s2ram_disable_kms variable. Signed-off-by: Rodolfo García Peñas (kix) --- s2ram-main.c | 6 +++--- s2ram.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/s2ram-main.c b/s2ram-main.c index b430054..27d4823 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 */ @@ -96,9 +99,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.c b/s2ram.c index aa2a605..e04cae6 100644 --- a/s2ram.c +++ b/s2ram.c @@ -23,11 +23,16 @@ #include "s2ram.h" #include "config_parser.h" -static char s2ram_force; +static char s2ram_force, s2ram_disable_kms; static char s2ram_quirks[MAX_STR_LEN]; static struct config_par s2ram_parameters[] = { { + .name = "s2ram_disable_kms", + .fmt = "%c", + .ptr = &s2ram_disable_kms, + }, + { .name = "s2ram_force", .fmt = "%c", .ptr = &s2ram_force, @@ -110,6 +115,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;