From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751839AbdFSUHN (ORCPT ); Mon, 19 Jun 2017 16:07:13 -0400 Received: from smtprelay0082.hostedemail.com ([216.40.44.82]:41224 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751062AbdFSUHL (ORCPT ); Mon, 19 Jun 2017 16:07:11 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:960:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3867:3871:3872:4321:5007:10004:10400:10848:11026:11232:11473:11658:11783:11914:12043:12296:12438:12555:12740:12895:12986:13069:13311:13357:13439:13894:14181:14659:14721:21080:21324:21627:30054:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: veil30_78a65763f474a X-Filterd-Recvd-Size: 2634 Message-ID: <1497902827.8495.52.camel@perches.com> Subject: Re: [PATCH v2] spi/bcm63xx: Fix checkpatch warnings From: Joe Perches To: Aravind Thokala , Mark Brown , Florian Fainelli Cc: bcm-kernel-feedback-list@broadcom.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 19 Jun 2017 13:07:07 -0700 In-Reply-To: <1497901338.8495.50.camel@perches.com> References: <1497896268-5613-1-git-send-email-aravind.thk@gmail.com> <1497901338.8495.50.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2017-06-19 at 12:42 -0700, Joe Perches wrote: > On Mon, 2017-06-19 at 23:47 +0530, Aravind Thokala wrote: > > This patch fixes the checkpatch.pl warnings on the driver > > file. > [] > > diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c > > [] > > @@ -191,7 +191,7 @@ static inline void bcm_spi_writew(struct bcm63xx_spi *bs, > > #endif > > } > > > > -static const unsigned bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = { > > +static const unsigned int bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = { > > { 20000000, SPI_CLK_20MHZ }, > > { 12500000, SPI_CLK_12_50MHZ }, > > { 6250000, SPI_CLK_6_250MHZ }, > > It's probably better to change this array into a struct > to make the indexing more obvious. > > Also the SPI_CLK_MASK uses are a bit obscure. > > Perhaps: > --- > diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c [] > -static const unsigned bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = { > +static const struct { > + unsigned int speed; > + unsigned int index; Maybe index should be u8 as the one use it's assigned to is also u8 > +} bcm63xx_spi_freq_table[] = { >   { 20000000, SPI_CLK_20MHZ }, >   { 12500000, SPI_CLK_12_50MHZ }, >   {  6250000, SPI_CLK_6_250MHZ }, > @@ -213,8 +216,8 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi, >   >   /* Find the closest clock configuration */ >   for (i = 0; i < SPI_CLK_MASK; i++) { > - if (t->speed_hz >= bcm63xx_spi_freq_table[i][0]) { > - clk_cfg = bcm63xx_spi_freq_table[i][1]; > + if (t->speed_hz >= bcm63xx_spi_freq_table[i].speed) { > + clk_cfg = bcm63xx_spi_freq_table[i].index; >   break; >   } >   } >