From patchwork Mon Feb 25 03:33:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 222823 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3969C2C02AE for ; Mon, 25 Feb 2013 14:34:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2B8E74A0EB; Mon, 25 Feb 2013 04:34:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gQuUCTDDJKEk; Mon, 25 Feb 2013 04:34:31 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 66C584A13A; Mon, 25 Feb 2013 04:34:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6DC894A102 for ; Mon, 25 Feb 2013 04:33:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HSGooo79qMwQ for ; Mon, 25 Feb 2013 04:33:57 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gh0-f202.google.com (mail-gh0-f202.google.com [209.85.160.202]) by theia.denx.de (Postfix) with ESMTPS id 4B26A4A0BF for ; Mon, 25 Feb 2013 04:33:55 +0100 (CET) Received: by mail-gh0-f202.google.com with SMTP id z10so254490ghb.3 for ; Sun, 24 Feb 2013 19:33:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=xYRJ92ypL9wDRqasxpzbRKc6xMdMHOuWnsThtQzmnz0=; b=G8V1WjV0c+qHVIY/EBWEzOw3XGwX7PoxP6FVH/HIydFerqj9zuvnb/vkRXRMsSOBay bn3aLliNTO9k5oH1yk7ht+xwJmvdyZG5rdlDbKB1ODJLA2cBc/MqNwb376dyiUcymbAi 73RcFiDvOnuwSBmnuvfa2aMWGmUp2Zw0rKSREVboVLffUnrXGVocw0rvTnH4Nx97S63u c9XcByrr1OYS+c5KWp4O1D+3r1TwGxPMNGjRdOVz4pIR5IzrEnWFI4ukbA6nqvnLWwSL wgrhIbciF+FTJppWATLU32CptZz7IrESme6+aDZUJ9DjH3kH1GxGQxl8Cn4JxheuFSsw aGDw== X-Received: by 10.100.246.19 with SMTP id t19mr1491369anh.0.1361763233885; Sun, 24 Feb 2013 19:33:53 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id r4si409710ann.2.2013.02.24.19.33.53 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Sun, 24 Feb 2013 19:33:53 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id B52385A4102; Sun, 24 Feb 2013 19:33:53 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 644AF1609DF; Sun, 24 Feb 2013 19:33:53 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Sun, 24 Feb 2013 19:33:12 -0800 Message-Id: <1361763213-31183-3-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1361763213-31183-1-git-send-email-sjg@chromium.org> References: <1361763213-31183-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQnd2jXwR1NWnSRCy4gBdPfpq7R97X+W+T8yqDZsKnn1hGC+MHoKcn/vBMVTC+P3t2AWe8p7eyPdy6WQVsTsKZZB0Jj/0kXPjssT0fkm1FxSyQfIqWJEwokzkUuEwkUZUPtMi9xEK7JcK0QA4zNf+5umImqkUlJEo44p3RAopyGNnTomyN5Tmy6ANAXHyvP2XATiNE+L Cc: Tom Rini Subject: [U-Boot] [PATCH v3 02/22] Update print_buffer() to use const X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The buffer cannot be changed by this function, so change the buffer pointer to a const. This allows callers with const pointer to use the function without a cast. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None include/common.h | 3 ++- lib/display_options.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/common.h b/include/common.h index 4ad17ea..170f439 100644 --- a/include/common.h +++ b/include/common.h @@ -270,7 +270,8 @@ int cpu_init(void); phys_size_t initdram (int); int display_options (void); void print_size(unsigned long long, const char *); -int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen); +int print_buffer(ulong addr, const void *data, uint width, uint count, + uint linelen); /* common/main.c */ void main_loop (void); diff --git a/lib/display_options.c b/lib/display_options.c index 694d2f2..0339970 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -98,7 +98,8 @@ void print_size(unsigned long long size, const char *s) */ #define MAX_LINE_LENGTH_BYTES (64) #define DEFAULT_LINE_LENGTH_BYTES (16) -int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen) +int print_buffer(ulong addr, const void *data, uint width, uint count, + uint linelen) { /* linebuf as a union causes proper alignment */ union linebuf {