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: 9797711 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 606D9601C8 for ; Mon, 19 Jun 2017 19:43:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42D4627FA5 for ; Mon, 19 Jun 2017 19:43:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3162628472; Mon, 19 Jun 2017 19:43:00 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0A5327FA5 for ; Mon, 19 Jun 2017 19:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=b4TWgNpP9fWbYC6OWTNUuPc/+M8Pc9uxo8rdOJ5TzJE=; b=T7b1yCuli3k7Ig qcJk77+wTC5qw88YfmNWk3kL70iEmk89QBje/F8zD79JD2FOaeOCMdObs7jy1Uum06QgXGnbZx6Kh 12MqigtPKrSEDic2Eluoga3/tU80XSOpnrFslyfXWhOe8bUT5vA+Xn1V878pcB4bCZueFC7AHJ2f/ SpqxMJKbuH7JejFeE0x0ragnhSEdusNy3apHxKeR8Yki8IS6aCfBJD1rWUxUtYJj12Mto+MO3TxNW QdavSALd1NlpPhLy5gY3cY+A4cihbmjxIN5bIxjMScNecEMwVXImTzweZhmGaYuro7OcGp0nUheaR iSJ1dseUYn8OpoZzxbAQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dN2Zc-0004ir-8Q; Mon, 19 Jun 2017 19:42:56 +0000 Received: from smtprelay0157.hostedemail.com ([216.40.44.157] helo=smtprelay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dN2ZY-0004hQ-4h for linux-arm-kernel@lists.infradead.org; Mon, 19 Jun 2017 19:42:53 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170619_124252_287561_8EF26408 X-CRM114-Status: GOOD ( 13.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 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;   }   }