From patchwork Sat Apr 14 20:14:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leann Ogasawara X-Patchwork-Id: 152550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 5231DB7004 for ; Sun, 15 Apr 2012 06:15:16 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SJ9N2-0004PS-4i; Sat, 14 Apr 2012 20:14:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SJ9Mz-0004P6-EE for kernel-team@lists.ubuntu.com; Sat, 14 Apr 2012 20:14:53 +0000 Received: from c-67-171-184-21.hsd1.or.comcast.net ([67.171.184.21] helo=adamo) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1SJ9Mz-000304-2I for kernel-team@lists.ubuntu.com; Sat, 14 Apr 2012 20:14:53 +0000 Received: by adamo (Postfix, from userid 1000) id 646512B268; Sat, 14 Apr 2012 13:14:50 -0700 (PDT) From: leann.ogasawara@canonical.com To: kernel-team@lists.ubuntu.com Subject: [Precise][SRU][PATCH 2/3] UBUNTU: SAUCE: staging: comedi: Add kernel config for default buffer sizes Date: Sat, 14 Apr 2012 13:14:49 -0700 Message-Id: X-Mailer: git-send-email 1.7.9.1 In-Reply-To: References: In-Reply-To: References: X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Ian Abbott BugLink: http://bugs.launchpad.net/bugs/981234 Allow the default values for the module parameters for the default initial buffer size and default maximum buffer size to be specified in the kernel configuration. I'm not sure what the defaults for the defaults for the defaults should be, but 64 KiB seems to small, so I used values suggested by Bernd Porr, which are 2048 KiB for the default initial buffer size and 20480 for the default maximum buffer size. Signed-off-by: Ian Abbott Cc: Bernd Porr Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 234bb3c60f1f1489630750aba4adf40154e0bd70 in git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next) Signed-off-by: Leann Ogasawara --- drivers/staging/comedi/Kconfig | 20 ++++++++++++++++++++ drivers/staging/comedi/comedi_fops.c | 12 +++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 4c77e50..661f520 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -14,6 +14,26 @@ config COMEDI_DEBUG This is an option for use by developers; most people should say N here. This enables comedi core and driver debugging. +config COMEDI_DEFAULT_BUF_SIZE_KB + int "Comedi default initial asynchronous buffer size in KiB" + default "2048" + depends on COMEDI != n + ---help--- + This is the default asynchronous buffer size which is used for + commands running in the background in kernel space. This + defaults to 2048 KiB of memory so that a 16 channel card + running at 10 kHz has of 2-4 seconds of buffer. + +config COMEDI_DEFAULT_BUF_MAXSIZE_KB + int "Comedi default maximum asynchronous buffer size in KiB" + default "20480" + depends on COMEDI != n + ---help--- + This is the default maximum asynchronous buffer size which can + be requested by a userspace program without root privileges. + This is set to 20480 KiB so that a fast I/O card with 16 + channels running at 100 kHz has 2-4 seconds of buffer. + menuconfig COMEDI_MISC_DRIVERS tristate "Comedi misc drivers" depends on COMEDI diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 57742b1..25185ef 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -55,9 +55,6 @@ MODULE_AUTHOR("http://www.comedi.org"); MODULE_DESCRIPTION("Comedi core module"); MODULE_LICENSE("GPL"); -#define DEFAULT_BUF_MAXSIZE_KB 64 -#define DEFAULT_BUF_SIZE_KB 64 - #ifdef CONFIG_COMEDI_DEBUG int comedi_debug; EXPORT_SYMBOL(comedi_debug); @@ -78,17 +75,18 @@ MODULE_PARM_DESC(comedi_num_legacy_minors, "number of comedi minor devices to reserve for non-auto-configured devices (default 0)" ); -unsigned int comedi_default_buf_size_kb = DEFAULT_BUF_SIZE_KB; +unsigned int comedi_default_buf_size_kb = CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB; module_param(comedi_default_buf_size_kb, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(comedi_default_buf_size_kb, "default asynchronous buffer size in KiB (default " - __MODULE_STRING(DEFAULT_BUF_SIZE_KB) ")"); + __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB) ")"); -unsigned int comedi_default_buf_maxsize_kb = DEFAULT_BUF_MAXSIZE_KB; +unsigned int comedi_default_buf_maxsize_kb + = CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB; module_param(comedi_default_buf_maxsize_kb, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(comedi_default_buf_maxsize_kb, "default maximum size of asynchronous buffer in KiB (default " - __MODULE_STRING(DEFAULT_BUF_MAXSIZE_KB) ")"); + __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB) ")"); static DEFINE_SPINLOCK(comedi_file_info_table_lock); static struct comedi_device_file_info