From patchwork Fri Apr 26 20:02:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 2495641 Return-Path: X-Original-To: patchwork-linux-fbdev@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 A9C2E3FC64 for ; Fri, 26 Apr 2013 20:04:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757136Ab3DZUEe (ORCPT ); Fri, 26 Apr 2013 16:04:34 -0400 Received: from mail-ea0-f173.google.com ([209.85.215.173]:51300 "EHLO mail-ea0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756869Ab3DZUEd (ORCPT ); Fri, 26 Apr 2013 16:04:33 -0400 Received: by mail-ea0-f173.google.com with SMTP id m14so1795868eaj.18 for ; Fri, 26 Apr 2013 13:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=h4gBqQOdUhbA5z3ESu3GdSMq/pBsvQjsG5lVkE6ZBn4=; b=q4azkUm1IL7yqpAdUUkXjfFlL0ZzoEEncdhuTfAMqEK7VmWvUL7VzNFbWsIuxC+N/h PXxfYO8gDxfdIFKpUhu8JoVCSfNEf9Ms/RhTQMCP6Z9E77kN1kDG7OR1KWcA0nfeZBOi GGC0VmZ11k3TnGf4ciWkOxhi8WryKVoiBkdB8u04Ypld0rzsYqmEbpCHT5AHXCU3OC/g 0IQTukG75fTHTn9hkM5QoAhRdAVTIAXSs9Oau7kQ6xTmWpFRDPxN69R1te1dlF0dR8BL yjtymsq+KUK42AAGQVeZvMaIStLttt+iGyKYpecXDfJuqxoo8yhsG6w78S/BxfP7JxkT ZYFg== X-Received: by 10.14.87.199 with SMTP id y47mr91620299eee.17.1367006672089; Fri, 26 Apr 2013 13:04:32 -0700 (PDT) Received: from localhost.localdomain (093105185086.warszawa.vectranet.pl. [93.105.185.86]) by mx.google.com with ESMTPSA id cd3sm17841788eeb.6.2013.04.26.13.04.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Apr 2013 13:04:31 -0700 (PDT) From: Sylwester Nawrocki To: kgene.kim@samsung.com, FlorianSchandinat@gmx.de Cc: linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH 9/9] s3c2410fb: Use module parameter instead of a sysfs entry Date: Fri, 26 Apr 2013 22:02:23 +0200 Message-Id: <1367006543-5458-10-git-send-email-sylvester.nawrocki@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1367006543-5458-1-git-send-email-sylvester.nawrocki@gmail.com> References: <1367006543-5458-1-git-send-email-sylvester.nawrocki@gmail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Use module parameter to set debug level instead of a sysfs entry. Replace pr_debug() with pr_info() so we can actually control the debug traces without DYNAMIC_PRINTK. This fixes a sort of regression introduced in commit 81c1655811e941af2 video: s3c2410: Use pr_* and dev_* instead of printk Signed-off-by: Sylwester Nawrocki --- drivers/video/s3c2410fb.c | 48 +++++++------------------------------------- 1 files changed, 8 insertions(+), 40 deletions(-) diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 0439ed0..c2ee75a 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -46,10 +46,13 @@ static int debug = 1; static int debug; #endif -#define dprintk(msg...) \ -do { \ - if (debug) \ - pr_debug(msg); \ +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Debug level (0-1)"); + +#define dprintk(msg...) \ +do { \ + if (debug) \ + pr_info(msg); \ } while (0) /* useful functions */ @@ -584,36 +587,6 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info) return 0; } -static int s3c2410fb_debug_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return snprintf(buf, PAGE_SIZE, "%s\n", debug ? "on" : "off"); -} - -static int s3c2410fb_debug_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) -{ - if (len < 1) - return -EINVAL; - - if (strnicmp(buf, "on", 2) == 0 || - strnicmp(buf, "1", 1) == 0) { - debug = 1; - dev_dbg(dev, "s3c2410fb: Debug On"); - } else if (strnicmp(buf, "off", 3) == 0 || - strnicmp(buf, "0", 1) == 0) { - debug = 0; - dev_dbg(dev, "s3c2410fb: Debug Off"); - } else { - return -EINVAL; - } - - return len; -} - -static DEVICE_ATTR(debug, 0666, s3c2410fb_debug_show, s3c2410fb_debug_store); - static struct fb_ops s3c2410fb_ops = { .owner = THIS_MODULE, .fb_check_var = s3c2410fb_check_var, @@ -962,17 +935,12 @@ static int s3c2410fb_probe(struct platform_device *pdev) goto free_cpufreq; } - /* create device files */ - ret = device_create_file(&pdev->dev, &dev_attr_debug); - if (ret) - dev_err(&pdev->dev, "failed to add debug attribute\n"); - dev_info(&pdev->dev, "fb%d: %s frame buffer device\n", fbinfo->node, fbinfo->fix.id); return 0; - free_cpufreq: +free_cpufreq: s3c2410fb_cpufreq_deregister(info); free_video_memory: s3c2410fb_unmap_video_memory(fbinfo);