From patchwork Thu Jun 23 02:00:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dirk.brandewie@gmail.com X-Patchwork-Id: 907682 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5N20v9d023273 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 23 Jun 2011 02:01:19 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QZZE1-0006IR-Lq; Thu, 23 Jun 2011 02:00:57 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QZZE1-0006IB-3m for spi-devel-general@lists.sourceforge.net; Thu, 23 Jun 2011 02:00:57 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.210.47 as permitted sender) client-ip=209.85.210.47; envelope-from=dirk.brandewie@gmail.com; helo=mail-pz0-f47.google.com; Received: from mail-pz0-f47.google.com ([209.85.210.47]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1QZZE0-0000Zh-Dm for spi-devel-general@lists.sourceforge.net; Thu, 23 Jun 2011 02:00:57 +0000 Received: by mail-pz0-f47.google.com with SMTP id 36so1176396pzk.34 for ; Wed, 22 Jun 2011 19:00:56 -0700 (PDT) Received: by 10.143.68.18 with SMTP id v18mr326779wfk.340.1308794456126; Wed, 22 Jun 2011 19:00:56 -0700 (PDT) Received: from localhost.localdomain (static-50-43-44-248.bvtn.or.frontiernet.net [50.43.44.248]) by mx.google.com with ESMTPS id u6sm846417pbh.80.2011.06.22.19.00.55 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2011 19:00:55 -0700 (PDT) From: dirk.brandewie@gmail.com To: linux-kernel@vger.kernel.org, spi-devel-general@lists.sourceforge.net Subject: [PATCH 10/11] spi-dw: Move checking of max_speed_hz value to be a prerequisite in spi_dw_setup Date: Wed, 22 Jun 2011 19:00:12 -0700 Message-Id: <1308794413-11069-11-git-send-email-dirk.brandewie@gmail.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1308794413-11069-1-git-send-email-dirk.brandewie@gmail.com> References: <1308794413-11069-1-git-send-email-dirk.brandewie@gmail.com> X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is freemail (dirk.brandewie[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL -0.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1QZZE0-0000Zh-Dm Cc: Dirk Brandewie X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 23 Jun 2011 02:01:19 +0000 (UTC) From: Dirk Brandewie Move the check of spi->max_speed_hz to be a prerequisite of spi_dw_setup(). Signed-off-by: Dirk Brandewie --- drivers/spi/spi-dw.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 35b952b..7b3f607 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -634,6 +634,11 @@ static int spi_dw_setup(struct spi_device *spi) if (spi->bits_per_word != 8 && spi->bits_per_word != 16) return -EINVAL; + if (!spi->max_speed_hz) { + dev_err(&spi->dev, "No max speed HZ parameter\n"); + return -EINVAL; + } + /* Only alloc on first setup */ chip = spi_get_ctldata(spi); if (!chip) { @@ -675,10 +680,6 @@ static int spi_dw_setup(struct spi_device *spi) } chip->bits_per_word = spi->bits_per_word; - if (!spi->max_speed_hz) { - dev_err(&spi->dev, "No max speed HZ parameter\n"); - return -EINVAL; - } chip->speed_hz = spi->max_speed_hz; chip->tmode = 0; /* Tx & Rx */