From patchwork Fri Oct 13 19:54:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10005845 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 A1D2260325 for ; Fri, 13 Oct 2017 20:07:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 940BF29157 for ; Fri, 13 Oct 2017 20:07:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88DDF29164; Fri, 13 Oct 2017 20:07:33 +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 3988929157 for ; Fri, 13 Oct 2017 20:07:33 +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=Moh3IoDkzbGbur/PEjBU8DVCEWG5JpTpZiKlvuoHdAU=; b=ADyhKLYmtbWoVX +7WFEDPGeDYYViMrfZ4fTr/MMWgbv9mp55ODX3RaxOotWq26fEfunKNak8/PYpIGCwlN8JWaZnkHt KwtBVTLX9Oo2jbnj8Q8wNAWiy94NbXN5afVcIlDMiDLGErjPwtN12TQmrmVuRCVXFel+hSJ4jcgRZ ZyCMTz5lEtMNCIC1f9oikVj7zq5E8F+2WcOFQSQHuyN2iZRWnzdLR/6nBhOrNuWFedbOon7Ho0oA5 ug38qkVOJorW+kQZI4xjA+zweuQxgKT0AxLIq10YngA/XLhHQKb+3pZxbTncAqHAu0uEYCmI2kWoH CS6UWBlhBkArGdrFyruw==; 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 1e36F2-0001Y1-3h; Fri, 13 Oct 2017 20:07:32 +0000 Received: from mail-by2nam03on0136.outbound.protection.outlook.com ([104.47.42.136] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e3631-0003E7-If for linux-arm-kernel@lists.infradead.org; Fri, 13 Oct 2017 19:55: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=4Jc/NB2RzQ4S15UhWwZKkH6xxK2SpNYxkG0yJC10jPo=; b=T7iEttIAfPOqUoFdOACKqyKn5YbonMtRQDGt4jf+FMB/MzC0qsL2UegrNAsBoFNqOk8aY6v637aRH/IhzRhkSPvm3t7HhGW65sc6CBlsnhKwIe9B1qSR1WY9bH+z1OzWbxLJTu6Jp5QHE5ZP6NV8NsBIXXDjaRxHHn5DW8w+ODM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; Received: from impinj.com (216.243.31.162) by BN6PR06MB2803.namprd06.prod.outlook.com (10.175.127.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 13 Oct 2017 19:54:42 +0000 From: Trent Piepho To: linux-spi , linux-arm-kernel Subject: [PATCH 3/4] spi: imx: Don't require platform data chipselect array Date: Fri, 13 Oct 2017 12:54:09 -0700 Message-Id: <20171013195410.30767-3-tpiepho@impinj.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013195410.30767-1-tpiepho@impinj.com> References: <20171013195410.30767-1-tpiepho@impinj.com> MIME-Version: 1.0 X-Originating-IP: [216.243.31.162] X-ClientProxiedBy: MWHPR21CA0064.namprd21.prod.outlook.com (10.172.93.154) To BN6PR06MB2803.namprd06.prod.outlook.com (10.175.127.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57a36b3d-56f8-4a50-1e2f-08d512743f9d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR06MB2803; X-Microsoft-Exchange-Diagnostics: 1; BN6PR06MB2803; 3:IU6RP3wlILoW0WU4jxtoaUeOSvOUydArWzYIzxNUsy3hYkCPFxKPUEaAo7iVyDBJSZhX9naMIHPZZMC66NDefAY2KegoURV4nVhCZgluYSiGvlRiAOd7cGLvPwWOxLYWOGm2MprfoQl1zlNz1zmbXp/vZZAVcWRW3c62GoaJJTi4tOMkzZrr1H1pdvOJ4fZdEjiS5uG6ipsKGyAPLW4Xqd2ELdxVTrqoCAZjX9e3vK+ycDCN627U/otyqHMSyRoj; 25:5DMAjIBUV4vV1HLAHRdN8TIC1AkNZrO+X39BHiXyZAe3zZKURiYxHlDmfwGlFBGLBKjPldCYczXyjvb8mH0r+4WkNz4pyMUbBVuM3PPhHCAavbr0rf1rskFdvjGfywnjcSVHHomjEnZ7Gtrg0D3HDTs1u8vlaA5aBkXszvj+pXlEc6hnpfIoJIG8Y0UJTdfBBzK1d8hVtJCkW2J0R/WrYviszGywwz89HS3DA7iyjsIW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x8ZyAr8TRYgsR7Or0twagxMn5ThD0ZD93fqpaRD56k26KBpOWUHv/7AIqDXdjFXjlff+eZyFkwajraTvCZwfkbuEVvfSl+wbo4xpBFU X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR06MB2803; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR06MB2803; X-Forefront-PRVS: 04599F3534 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(346002)(39830400002)(376002)(199003)(189002)(47776003)(6666003)(107886003)(8656003)(4326008)(53936002)(21086003)(68736007)(66066001)(2906002)(5003940100001)(2950100002)(3846002)(1076002)(69596002)(33646002)(6116002)(8676002)(105586002)(55016002)(189998001)(106356001)(48376002)(478600001)(50466002)(110136005)(50986999)(97736004)(76176999)(5660300001)(54906003)(50226002)(16586007)(81166006)(8936002)(316002)(305945005)(16526018)(86362001)(7736002)(25786009)(101416001)(36756003)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR06MB2803; H:impinj.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN6PR06MB2803; 23:VQp6PutCfPnB+LNhiAoh3s2NquucxcHX0s234tQYI?= =?us-ascii?Q?nK5Iht80Q4YWO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Dv3gFqFPC7KxLTi2nIdP/mHend7L8OGSfmPYTMggWDFEppPYLeNLz+44BYdWAFQSBPAbXpaVa2OUxeEe5CUu1ZHkTahGwY4nLaX5gCE2y0JBt1B46iC5BTSG7lGhtCxFoFk8XgtxbrpxAYIVRasB9YrrUAsziGCj6JZBvqejE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2017 19:54:42.8685 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2803 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171013_125507_975048_9D1191AE X-CRM114-Status: GOOD ( 10.94 ) 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 , Shawn Guo , Greg Ungerer , 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. 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 fea46cbf458a..3a2c34522655 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1364,13 +1364,15 @@ static int spi_imx_probe(struct platform_device *pdev) 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]; + } } spi_imx->bitbang.chipselect = spi_imx_chipselect;