From patchwork Thu Feb 2 10:04:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9551539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 045DF60453 for ; Thu, 2 Feb 2017 10:04:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F06E720855 for ; Thu, 2 Feb 2017 10:04:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E55062823D; Thu, 2 Feb 2017 10:04:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8013820855 for ; Thu, 2 Feb 2017 10:04:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 06EA36E982; Thu, 2 Feb 2017 10:04:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 55F8A6E982 for ; Thu, 2 Feb 2017 10:04:47 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from nuc-i3427.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 5241609-1500050 for multiple; Thu, 02 Feb 2017 10:04:43 +0000 Received: by nuc-i3427.alporthouse.com (sSMTP sendmail emulation); Thu, 02 Feb 2017 10:04:42 +0000 Date: Thu, 2 Feb 2017 10:04:42 +0000 From: Chris Wilson To: Jani Nikula Message-ID: <20170202100442.GQ12889@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Jani Nikula , intel-gfx@lists.freedesktop.org References: <20170202085513.6710-1-chris@chris-wilson.co.uk> <87poj1ylvh.fsf@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87poj1ylvh.fsf@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx] [PATCH v2 1/5] drm/i915: Generate i915_params {} using a macro X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Feb 02, 2017 at 11:37:06AM +0200, Jani Nikula wrote: > On Thu, 02 Feb 2017, Chris Wilson wrote: > > I want to print the struct from the error state and so would like to use > > the existing struct definition as the template ala DEV_INFO* > > > > v2: Use MEMBER() rather than p(). > > > > Signed-off-by: Chris Wilson > > Reviewed-by: Joonas Lahtinen > > I've been telling everyone who complains about testing specific firmware > blob versions to add a module parameter to specify and override the > default filename. AFAICT this series does not make string parameters any > harder, but please do double check. I think they expect a static > allocation for the string buffer too, so the struct assignment should be > fine as well. charp which is the dynamically allocated string might be easier, certainly for 0400 parameters. Hmm. Except for copying into the error state, 0600 charp will take a bit more work (another iterator to kstrdup). diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 86649610b9eb..2d32dacebeb3 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -76,6 +76,13 @@ static void seq_param_uint(struct seq_file *m, const char *name, param_uint x) seq_printf(m, "i915.%s=%u\n", name, x); } +static void seq_param_charp(struct seq_file *m, const char *name, param_charp x) +{ + kernel_param_lock(THIS_MODULE); + seq_printf(m, "i915.%s=%s\n", name, x); + kernel_param_unlock(THIS_MODULE); +} + static int i915_capabilities(struct seq_file *m, void *data) { struct drm_i915_private *dev_priv = node_to_i915(m->private); diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index b8f2b671fc0a..35602935dba8 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -567,6 +567,15 @@ static void err_param_uint(struct drm_i915_error_state_buf *m, err_printf(m, "%s: %u\n", name, x); } +static void err_param_charp(struct drm_i915_error_state_buf *m, + const char *name, + param_charp x) +{ + kernel_param_lock(THIS_MODULE); + err_printf(m, "%s: %s\n", name, x); + kernel_param_unlock(THIS_MODULE); +} + static void err_print_params(struct drm_i915_error_state_buf *m, const struct i915_params *p) { diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index f1fa51190dc6..f9cc170577c2 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -65,6 +65,8 @@ struct i915_params i915 __read_mostly = { .enable_gvt = false, }; +module_param_named_unsafe(my_string, i915.my_string, charp, 0400); + module_param_named(modeset, i915.modeset, int, 0400); MODULE_PARM_DESC(modeset, "Use kernel modesetting [KMS] (0=disable, " diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h index 87ac6ed995d3..bc5aea9e3fb6 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -30,6 +30,7 @@ typedef bool param_bool; typedef int param_int; typedef unsigned int param_uint; +typedef char *param_charp; #define I915_PARAMS_FOR_EACH(func) \ func(param_int, modeset); \ @@ -54,6 +55,7 @@ typedef unsigned int param_uint; func(param_int, mmio_debug); \ func(param_int, edp_vswing); \ func(param_uint, inject_load_failure); \ + func(param_charp, my_string); \ /* leave bools at the end to not create holes */ \ func(param_bool, alpha_support); \ func(param_bool, enable_cmd_parser); \