From patchwork Mon Jun 16 21:50:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 360253 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 6A88414009C for ; Tue, 17 Jun 2014 07:50:18 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A31F04B712; Mon, 16 Jun 2014 23:50:16 +0200 (CEST) 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 ZQGv1UP8tjhy; Mon, 16 Jun 2014 23:50:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2C3B94B718; Mon, 16 Jun 2014 23:50:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ED0154B718 for ; Mon, 16 Jun 2014 23:50:10 +0200 (CEST) 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 fXG5+nrLuwYm for ; Mon, 16 Jun 2014 23:50:07 +0200 (CEST) X-Greylist: delayed 7059 seconds by postgrey-1.27 at theia; Mon, 16 Jun 2014 23:50:03 CEST 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-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by theia.denx.de (Postfix) with ESMTPS id 1323E4B712 for ; Mon, 16 Jun 2014 23:50:02 +0200 (CEST) Received: by mail-pd0-f177.google.com with SMTP id y10so3339011pdj.8 for ; Mon, 16 Jun 2014 14:50:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=FFaelHqZeOvVTpvCSK8r2pGFnL67ra5sWt8ln6ziFOU=; b=h31oXAytY39/oYaWETgOzp5koncTseJu6hQCXraEWo7EXfwyRqy/7NFrwXmNXkhnsw 6xbr80Q8iRlaUIK5wPnkPZXaXc7eD6Ck84z+QjweBheiWHLYvWR7iqNcFP3lrasFITqd RBoffoE0VTLNrxq1d9TLoBxbl2lE2FtTnhj04TZhDs8qV1lIYgmTfc80SEiZsBVjwCa4 IBYndxL/eGGVPntKr1hM547I+VRr0HW+Rj89eOi2DRtHf4uO4CVKsTyYho0/he+KontY ky3avx8w8G3oO0DRoShgLe0E3JioBtcFRxFshYwIgJuP5/jIOA+Zidja55KwGqbZaeIN 1KPA== X-Gm-Message-State: ALoCoQkL27aphhrntum1o81BcfJD5T7BSKIwyobL06XGAoRc6F4zL7qdlC6xMxl6dymh3317I1tS X-Received: by 10.68.171.229 with SMTP id ax5mr27634888pbc.125.1402955401383; Mon, 16 Jun 2014 14:50:01 -0700 (PDT) Received: from [192.168.0.242] (174-19-177-179.phnx.qwest.net. [174.19.177.179]) by mx.google.com with ESMTPSA id gd7sm74383032pac.34.2014.06.16.14.50.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 14:50:00 -0700 (PDT) Message-ID: <539F6688.1040601@boundarydevices.com> Date: Mon, 16 Jun 2014 14:50:00 -0700 From: Troy Kisky User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jeroen Hofstee References: <1402947663-20632-1-git-send-email-jeroen@myspectrum.nl> <539F4AF6.6030704@boundarydevices.com> <1402951075.2333.22.camel@yellow> In-Reply-To: <1402951075.2333.22.camel@yellow> Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH] video: ipu_disp: squash clang warning 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de On 6/16/2014 1:37 PM, Jeroen Hofstee wrote: > On ma, 2014-06-16 at 12:52 -0700, Troy Kisky wrote: >> On 6/16/2014 12:41 PM, Jeroen Hofstee wrote: >>> Since &rgb2ycbcr_coeff and friends are declared const, but >>> assigned to a void pointer, clang will warn that the const >>> is implicity casted away. Add const to indicate the pointer >>> points to const data to get rid of these warnings. >>> >>> Cc: Stefano Babic >>> Signed-off-by: Jeroen Hofstee >>> --- >>> drivers/video/ipu_disp.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c >>> index cefd2dc..31b5a10 100644 >>> --- a/drivers/video/ipu_disp.c >>> +++ b/drivers/video/ipu_disp.c >>> @@ -33,7 +33,7 @@ enum csc_type_t { >>> >>> struct dp_csc_param_t { >>> int mode; >>> - void *coeff; >>> + void * const coeff; >>> }; >>> >>> #define SYNC_WAVE 0 >>> >> >> Doesn't this says the pointer is constant, not that it points to constant data? >> So, commit log needs updated or >> const void *coeff; > > The reason I wrongly changed it from void const * to void * const was to > circumvent gcc complaining with: > > drivers/video/ipu_disp.c: In function ‘ipu_dp_csc_setup’: > drivers/video/ipu_disp.c:393:8: warning: assignment discards ‘const’ > qualifier from pointer target type [enabled by default] > > This can be solved with: > > @@ -390,7 +390,7 @@ void ipu_dp_csc_setup(int dp, struct dp_csc_param_t > dp_csc_param, > __raw_writel(reg, DP_COM_CONF()); > } > - coeff = dp_csc_param.coeff; > + coeff = (const int (*)[5][3]) dp_csc_param.coeff; > > if (coeff) { > __raw_writel(mask_a((*coeff)[0][0]) | > > > But I am not too happy with that. Happen to know a better way? > > Regards, > Jeroen > I don't know why it gets that warning. The following doesn't. diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c index cefd2dc..209374f 100644 --- a/drivers/video/ipu_disp.c +++ b/drivers/video/ipu_disp.c @@ -31,9 +31,11 @@ enum csc_type_t { CSC_NUM }; +typedef int coeff_t[5][3]; + struct dp_csc_param_t { int mode; - void *coeff; + const coeff_t *coeff; }; #define SYNC_WAVE 0 @@ -381,7 +383,7 @@ void ipu_dp_csc_setup(int dp, struct dp_csc_param_t dp_csc_param, unsigned char srm_mode_update) { u32 reg; - const int (*coeff)[5][3]; + const coeff_t *coeff; if (dp_csc_param.mode >= 0) { reg = __raw_readl(DP_COM_CONF());