From patchwork Tue Sep 8 17:13:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 7142881 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EE7A99F326 for ; Tue, 8 Sep 2015 17:22:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B9B9208D6 for ; Tue, 8 Sep 2015 17:22:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0923F20671 for ; Tue, 8 Sep 2015 17:22:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 98B936E42B; Tue, 8 Sep 2015 10:22:21 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E43C6E1A4 for ; Tue, 8 Sep 2015 10:22:20 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 08 Sep 2015 10:22:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,491,1437462000"; d="scan'208";a="557696186" Received: from otc-vmt1.isw.intel.com ([10.237.224.80]) by FMSMGA003.fm.intel.com with ESMTP; 08 Sep 2015 10:22:19 -0700 From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Tue, 8 Sep 2015 18:13:04 +0100 Message-Id: <1441732384-11633-2-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441732384-11633-1-git-send-email-thomas.wood@intel.com> References: <1441732384-11633-1-git-send-email-thomas.wood@intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH i-g-t 2/2] null_state_gen: add const to intel_batch_state_copy data 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The data is not modified by the function and is often declared const. Signed-off-by: Thomas Wood --- tools/null_state_gen/intel_batchbuffer.c | 6 +++--- tools/null_state_gen/intel_batchbuffer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/null_state_gen/intel_batchbuffer.c b/tools/null_state_gen/intel_batchbuffer.c index 5aa980e..2ead22e 100644 --- a/tools/null_state_gen/intel_batchbuffer.c +++ b/tools/null_state_gen/intel_batchbuffer.c @@ -202,7 +202,7 @@ uint32_t intel_batch_state_alloc(struct intel_batchbuffer *batch, unsigned bytes } uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch, - void *d, unsigned bytes, + const void *d, unsigned bytes, unsigned align, const char *str) { @@ -217,10 +217,10 @@ uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch, for (i = 0; i < dwords; i++) { char offsetinside[80]; - uint32_t *s; + const uint32_t *s; sprintf(offsetinside, "%s: 0x%x", str, i * 4); - s = (uint32_t *)(uint8_t *)d + i; + s = (const uint32_t *)(const uint8_t *)d + i; bb_area_emit(batch->state, *s, STATE, offsetinside); } diff --git a/tools/null_state_gen/intel_batchbuffer.h b/tools/null_state_gen/intel_batchbuffer.h index 2919e87..771d1c8 100644 --- a/tools/null_state_gen/intel_batchbuffer.h +++ b/tools/null_state_gen/intel_batchbuffer.h @@ -80,7 +80,7 @@ struct intel_batchbuffer *intel_batchbuffer_create(void); #define OUT_STATE_OFFSET(offset) bb_area_emit(batch->state, offset, STATE_OFFSET, #offset) #define OUT_STATE_STRUCT(name, align) intel_batch_state_copy(batch, &name, sizeof(name), align, #name " " #align) -uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch, void *d, unsigned bytes, unsigned align, +uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch, const void *d, unsigned bytes, unsigned align, const char *name); uint32_t intel_batch_state_alloc(struct intel_batchbuffer *batch, unsigned bytes, unsigned align, const char *name);