From patchwork Tue Oct 31 19:49:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10035305 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 9AC2B602B5 for ; Tue, 31 Oct 2017 19:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A49A28A98 for ; Tue, 31 Oct 2017 19:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D49A28B05; Tue, 31 Oct 2017 19:51:32 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED 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 EC05B28A98 for ; Tue, 31 Oct 2017 19:51:31 +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: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dAXBZYfNIgf8XXaGFqI0rUKAW43EQLQAHF+JzUAjbBw=; b=i+fCk1QF2Q4ser bytmio3c+AczQhxxbzbXlQrvaOG4PtNp7bmPLyGHZ1QpqPUIg40XyRNu6ecN175RZ2nviHZD0UHeg 0lbQAQhCEefcFPYCIY6fXDljEvIRyAWw3ypV6HllEdk1Ao+wDR43W26NinPAES/f2iDfYG5u6TQU4 a+fkkIm0rs3NBQZQJ85+16oPPL9WFDDWtLeOOzGuWyIdjazn01BFPLbZHygKGEVWpVRECoqV9bDbD sM5pbBPDGSrgQHoSOMv2eGkv8oHJpFYwMKQg8zDVwDjg4zMkcu0AnnTWyuXaACxdfPmVpLcjPbjDF CXB31RLG1vg+2QQX3YEg==; 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 1e9cZP-0000E5-2f; Tue, 31 Oct 2017 19:51:31 +0000 Received: from mail-by2nam03on0725.outbound.protection.outlook.com ([2a01:111:f400:fe4a::725] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e9cY5-0006OG-6o for linux-arm-kernel@lists.infradead.org; Tue, 31 Oct 2017 19:50:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.onmicrosoft.com; s=selector1-impinj-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=m0tCcE9gsZjuqTl6avmTxNs5FSqi4rspflBFktuikGw=; b=mI55abIAc+t1lfXJxrekealfxgm8RIGK3sbmuu5nmCFeX9bAeB1fkIOEGJvgS5JAe8/gb2Q0kJQcTB9+QdvXpnEQjar/XNf+RPwX37p7zPq034D75x18Q+GA8r0KNsJr+QVKhaQ0F0DAO6WmAYWYQhfl+5jwqaQymCILubEgCn8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; Received: from impinj.com (216.243.31.162) by CY4PR06MB2808.namprd06.prod.outlook.com (10.175.118.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Tue, 31 Oct 2017 19:49:33 +0000 From: Trent Piepho To: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 3/4] spi: imx: Don't require platform data chipselect array Date: Tue, 31 Oct 2017 12:49:06 -0700 Message-Id: <20171031194907.29108-4-tpiepho@impinj.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171031194907.29108-1-tpiepho@impinj.com> References: <20171031194907.29108-1-tpiepho@impinj.com> MIME-Version: 1.0 X-Originating-IP: [216.243.31.162] X-ClientProxiedBy: MWHPR22CA0020.namprd22.prod.outlook.com (10.172.163.158) To CY4PR06MB2808.namprd06.prod.outlook.com (10.175.118.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3effb44-55df-4053-da2e-08d52098829b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(2017052603238); SRVR:CY4PR06MB2808; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2808; 3:GlxUcbgtYL31LiALe4Rt6zHt7mat6X7clI/QbewmFMfCfne2Lq8MwE7r62mXcQoirW0cyY2SvDudE8xX/Y/P6swuw+XNKlmgasyqvF0WHFpNwlGayqsqLRDP5Kg1HH9zIhC4iMryAk4oL2mxfZarF7ucnqPOaA2LtM05RfovDiakcNVh4jqDn8RivkNDYBZ0XjMoG+bxFftBUDwnDZpVYQ96bDhqZCd3C0mymBBrzvTcwe71+vD9FQHjjOjyhKWV; 25:YxfOklCa4ZcaF0qXINR5MzXFfeggdIMXUr1YEkowedUeNwumEZBQBO5L8HR2LWtRNyLM1DHTWFx+D/PE8XUX9/z2oFnx1yAzdtLeFE28ux61ZHelFrJkaXV26t4tDquGJH+pB7/nlF5s3EZsUXQi9etGBhbmKKYyNSQsNYRTNzYkV9qPDLmdA9ndbWUAxDv84COCeIrrFxrb5AAd5Us1r+Lxmhw99EYMeOcMNpFuXNsU3tiy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oCQXjAAp9tF3/yb3eDKSbswEWh+i7tO7BzC41jHZiujozoEkVfgxln2VNO8sfxk7Pmly4wret3H88al0XTGO7lFlcnTds1FSLlmPvS6dpX0hmTty6K1F5xE5fO0qSSW6HkUjIFtyqOq0ahFjfhOKxw00A+sQdx4OjEh1Czr5UWLIxX80wBKXa6R6n X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231020)(100000703101)(100105400095)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR06MB2808; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR06MB2808; X-Forefront-PRVS: 04772EA191 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(39830400002)(189002)(199003)(97736004)(53936002)(478600001)(86362001)(76176999)(101416001)(50466002)(50986999)(48376002)(69596002)(1076002)(25786009)(66066001)(81166006)(106356001)(8676002)(33646002)(105586002)(6116002)(3846002)(4326008)(36756003)(81156014)(2906002)(189998001)(8936002)(55016002)(68736007)(50226002)(2950100002)(16526018)(21086003)(305945005)(5660300001)(16586007)(47776003)(316002)(6666003)(54906003)(5003940100001)(7736002)(8656006); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR06MB2808; H:impinj.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;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Jx9Z2PolGBKFX5Sqzlko5LzT91lPJ0kGu+fwKfK1UeUjSJGh0HiqdHq4/ZD5NXNspye8vjUv2AMkYvYV/KXrYa0GvUZLGZY8RUQQPiXPMtkdmI4235H0zZ6rhZQOEVh8McyEfWg3FiwSLOe5SMiOto6SWYUPCDau8lfnsj9SvcNxq7Ze7mky1eLlYotcLi18SobbQtGTSA4WFCUGRB/BSTBSAO0JQCk3kgF2H SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2017 19:49:33.6006 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3effb44-55df-4053-da2e-08d52098829b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR06MB2808 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171031_125009_407775_D2F581ED X-CRM114-Status: GOOD ( 11.35 ) 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: Fabio Estevam , Mark Brown , Shawn Guo , Sascha Hauer , Trent Piepho 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 If the array is not present, assume all chip selects are native. This is the standard behavior for SPI masters configured via the device tree and the behavior of this driver as well when it is configured via device tree. This reduces platform data vs DT differences and allows most of the platform data based boards to remove their chip select arrays. CC: Shawn Guo CC: Sascha Hauer CC: Fabio Estevam CC: Mark Brown Signed-off-by: Trent Piepho --- drivers/spi/spi-imx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index ad54f8258513..5caa6c9524fa 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1526,13 +1526,15 @@ static int spi_imx_probe(struct platform_device *pdev) /* Get number of chip selects, either platform data or OF */ if (mxc_platform_info) { master->num_chipselect = mxc_platform_info->num_chipselect; - master->cs_gpios = devm_kzalloc(&master->dev, - sizeof(int) * master->num_chipselect, GFP_KERNEL); - if (!master->cs_gpios) - return -ENOMEM; - - for (i = 0; i < master->num_chipselect; i++) - master->cs_gpios[i] = mxc_platform_info->chipselect[i]; + if (mxc_platform_info->chipselect) { + master->cs_gpios = devm_kzalloc(&master->dev, + sizeof(int) * master->num_chipselect, GFP_KERNEL); + if (!master->cs_gpios) + return -ENOMEM; + + for (i = 0; i < master->num_chipselect; i++) + master->cs_gpios[i] = mxc_platform_info->chipselect[i]; + } } else { u32 num_cs;