From patchwork Mon Jun 19 19:42:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 9797721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 948F5601C8 for ; Mon, 19 Jun 2017 19:48:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78CB428423 for ; Mon, 19 Jun 2017 19:48:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D4A22844C; Mon, 19 Jun 2017 19:48:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C961B28423 for ; Mon, 19 Jun 2017 19:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750916AbdFSTsA (ORCPT ); Mon, 19 Jun 2017 15:48:00 -0400 Received: from smtprelay0237.hostedemail.com ([216.40.44.237]:42473 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750757AbdFSTsA (ORCPT ); Mon, 19 Jun 2017 15:48:00 -0400 X-Greylist: delayed 332 seconds by postgrey-1.27 at vger.kernel.org; Mon, 19 Jun 2017 15:47:59 EDT Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave08.hostedemail.com (Postfix) with ESMTP id 28E1118088C7C for ; Mon, 19 Jun 2017 19:42:28 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 762A01807B536; Mon, 19 Jun 2017 19:42:21 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: earth67_317ae228d3f19 X-Filterd-Recvd-Size: 2588 Received: from XPS-9350 (unknown [47.151.132.55]) (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA; Mon, 19 Jun 2017 19:42:19 +0000 (UTC) Message-ID: <1497901338.8495.50.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 12:42:18 -0700 In-Reply-To: <1497896268-5613-1-git-send-email-aravind.thk@gmail.com> References: <1497896268-5613-1-git-send-email-aravind.thk@gmail.com> X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: --- -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 247f71b02235..3cb8d92ee870 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c @@ -191,7 +191,10 @@ static inline void bcm_spi_writew(struct bcm63xx_spi *bs,  #endif  }   -static const unsigned bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = { +static const struct { + unsigned int speed; + unsigned int index; +} 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;   }   }