From patchwork Wed Feb 27 00:37:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 2189951 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 1E048DF215 for ; Wed, 27 Feb 2013 00:40:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UAV4c-0002oU-PB; Wed, 27 Feb 2013 00:40:42 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UAV4b-0002oO-CR for spi-devel-general@lists.sourceforge.net; Wed, 27 Feb 2013 00:40:41 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of atmel.com designates 212.144.249.242 as permitted sender) client-ip=212.144.249.242; envelope-from=wenyou.yang@atmel.com; helo=eusmtp01.atmel.com; Received: from eusmtp01.atmel.com ([212.144.249.242]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) id 1UAV4a-0000jB-8Z for spi-devel-general@lists.sourceforge.net; Wed, 27 Feb 2013 00:40:41 +0000 Received: from apsmtp01.atmel.com (10.168.254.31) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.2.318.4; Wed, 27 Feb 2013 01:40:31 +0100 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.2.318.1; Wed, 27 Feb 2013 08:47:22 +0800 From: Wenyou Yang To: Subject: [PATCH Resend v5 01/16] spi/spi-atmel: fix master->num_chipselect wrongly set. Date: Wed, 27 Feb 2013 08:37:14 +0800 Message-ID: <1361925434-11929-1-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361925297-11854-1-git-send-email-wenyou.yang@atmel.com> References: <1361925297-11854-1-git-send-email-wenyou.yang@atmel.com> MIME-Version: 1.0 X-Spam-Score: -2.2 (--) 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 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1UAV4a-0000jB-8Z Cc: richard.genoud@gmail.com, JM.Lin@atmel.com, nicolas.ferre@atmel.com, linux-kernel@vger.kernel.org, wenyou.yang@atmel.com, spi-devel-general@lists.sourceforge.net, plagnioj@jcrosoft.com 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: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net if the spi property "cs-gpios" is set as below: cs-gpios = <0>, <&pioC 11 0>, <0>, <0>; the master->num_chipselect will wrongly be set to 0, and the spi fail to probe. Signed-off-by: Wenyou Yang Cc: spi-devel-general@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org --- drivers/spi/spi-atmel.c | 2 +- drivers/spi/spi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index ab34497..5bf3786 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -944,7 +944,7 @@ static int atmel_spi_probe(struct platform_device *pdev) master->dev.of_node = pdev->dev.of_node; master->bus_num = pdev->id; - master->num_chipselect = master->dev.of_node ? 0 : 4; + master->num_chipselect = 4; master->setup = atmel_spi_setup; master->transfer = atmel_spi_transfer; master->cleanup = atmel_spi_cleanup; diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 19ee901..d88cbef 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1070,7 +1070,7 @@ static int of_spi_register_master(struct spi_master *master) master->num_chipselect = max(nb, master->num_chipselect); if (nb < 1) - return 0; + nb = master->num_chipselect; cs = devm_kzalloc(&master->dev, sizeof(int) * master->num_chipselect,