Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2865501imu; Fri, 18 Jan 2019 00:18:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN6eMLRGTmYUp57KoMLrLLUKobeeAQBEeO+7dTMAY45ag0errUPH5bBDtaPztf7FX6BQ51u8 X-Received: by 2002:a63:6906:: with SMTP id e6mr16368739pgc.144.1547799484396; Fri, 18 Jan 2019 00:18:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547799484; cv=none; d=google.com; s=arc-20160816; b=zJHPlqYe0YMi6X52S5pbF1YFVQ4enrVOe3K51aiJeixyXN492PZ5dvDo7ut6nzLyAH sK6Kxc9x5+w5kIy19vFISZhx0v8nd0cQJooHORBq3lBQdMDoyOakZ9mIRHw30KRgOf+v cMkYxkCoOXsmD3csMYgAYHESk58mFacXaiTrmktt2mhiDoJNbGy/d8crFvHxxix9Xnj6 9XrgabT6KYD8eS4bVMkG6yqdnVtehJY464WhHDEKaPqCeY5NXwBxJa0+c3dnE9K2Y1S4 jWfOWyFXKoepjePU7t+081oqRshOImuaXblgBRgbnZvvLlfOCXDtBRJruycLDM4ukyQO xKsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=aGFw01EVh121mfJQ3EGKRmoWYJObAvevYtkQvSAJpHc=; b=N+1GpPES31mrywLJ0ZlUqxb1Bvd2z+auT39AP3CVAiKl9/gUe1e/BDjOap9/6IgPAn wEMkkyM5WEaY2xVw3AjHRBNUViz8pcuxbc5mAxPwXbzydu8iQzikoNXl1YN8Vsd3eBqY N6mZ8mWJthw0z+G8LrsoKNhtashfGpwdHZHehrsP8jBnBEOT5qhrZV55BbSG5HDSJf7E PqbmOpliPGfzjvqT7yjrNEKhZEmuys+1KwGeljpyV02kazjHUPrvHPCWbjZ3H2dlH+oF e3btKiJohwdYBgsV1uAXRUIZeyKGs168se/e5FQjFQ8XcJkMBTqYjP0cg8MhOAodnCdo 0uOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aBrLoI71; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y188si4244931pfb.59.2019.01.18.00.17.48; Fri, 18 Jan 2019 00:18:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aBrLoI71; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727867AbfARIP2 (ORCPT + 99 others); Fri, 18 Jan 2019 03:15:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:40972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbfARIP1 (ORCPT ); Fri, 18 Jan 2019 03:15:27 -0500 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52C382086D; Fri, 18 Jan 2019 08:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547799327; bh=L5T+VUoRVK9QGkhtMHE1r7Lp9r2F5Vdf7brc3Ah+kLk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aBrLoI71wOr5l5G2dA82MZnrl1ntosfb+Npf08AnZNJko/btTHDchck2tlpR4DH9y hmQXPxtFOG1+hpsfgXlRl9T8xyMHFEMBKpCPX5ZfcWx72V73A7JhvPqa36YkcNWCC3 FRqMfy3aa44+FDvg805ZelNeHFTMPcyVe2zTXpoo= Date: Fri, 18 Jan 2019 09:15:17 +0100 From: Boris Brezillon To: Paul Cercueil Cc: Rob Herring , Mark Rutland , Miquel Raynal , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] memory: jz4780-nemc: Reduce size of const array Message-ID: <20190118091518.467087b8@bbrezillon> In-Reply-To: <20190117224550.18043-3-paul@crapouillou.net> References: <20190117224550.18043-1-paul@crapouillou.net> <20190117224550.18043-3-paul@crapouillou.net> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 17 Jan 2019 19:45:49 -0300 Paul Cercueil wrote: > The maximum value found in that array is 15, there's no need to store > these values as uint32_t, a uint8_t is enough. Is it really worth the additional cast you add in the code? > > Signed-off-by: Paul Cercueil > --- > drivers/memory/jz4780-nemc.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c > index bcf06adefc96..ef3f20e46590 100644 > --- a/drivers/memory/jz4780-nemc.c > +++ b/drivers/memory/jz4780-nemc.c > @@ -161,7 +161,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc, > * Conversion of tBP and tAW cycle counts to values supported by the > * hardware (round up to the next supported value). > */ > - static const uint32_t convert_tBP_tAW[] = { > + static const u8 convert_tBP_tAW[] = { > 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, > > /* 11 - 12 -> 12 cycles */ > @@ -232,7 +232,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc, > return false; > } > > - smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT; > + smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TBP_SHIFT; > } > > if (of_property_read_u32(node, "ingenic,nemc-tAW", &val) == 0) { > @@ -244,7 +244,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc, > return false; > } > > - smcr |= convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT; > + smcr |= (u32)convert_tBP_tAW[cycles] << NEMC_SMCR_TAW_SHIFT; > } > > if (of_property_read_u32(node, "ingenic,nemc-tSTRV", &val) == 0) {