From patchwork Sun Nov 13 13:36:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9424829 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 6A06960484 for ; Sun, 13 Nov 2016 13:53:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A61327FAC for ; Sun, 13 Nov 2016 13:53:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CBCB28551; Sun, 13 Nov 2016 13:53:45 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3AC027FAC for ; Sun, 13 Nov 2016 13:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933505AbcKMNxo (ORCPT ); Sun, 13 Nov 2016 08:53:44 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36108 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933365AbcKMNxn (ORCPT ); Sun, 13 Nov 2016 08:53:43 -0500 Received: by mail-wm0-f67.google.com with SMTP id m203so8352147wma.3 for ; Sun, 13 Nov 2016 05:53:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=A7nhsdhaiSzEVR0I2Q1viTOQHFq5ykGVAWzUFXEjEyQ=; b=cL+FxDM4pnZy0pWjGjzuxzZEVmwvCK0Edh6QAozqtTH5cbkHr6TuplPd7DIOLcwKCy 0h+Vb8RYQEKuD3fGvuRl4mxmdgNs2S7mJda9AD+SyQ1vd5YgOS0MPkKvGoBIroCqML62 vGgpX/mnyhvdzy2MwNggMr70sXzUYxwxkemg5Viwm1XnXE4ilNdxYUoESlPf3fD1S+Ri vIOSsII/ETZVdOCnrxMDiktPtLx/jWAc417hhJlwfYY9DmsijzTDXJCNzhzeeQ5ggI6c FGezkG7dagkZVDjrDmTwCt/4k3EU8fqgd/15RXkFHr+V1G/d762gfRCXwVaJpC//rv97 pWeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=A7nhsdhaiSzEVR0I2Q1viTOQHFq5ykGVAWzUFXEjEyQ=; b=giDCINdNAOD8xnf8kgHNGY2MoHQahqK4tywr/LnAFKYLivMQF+JLljzDjYCizTH/3n aOEe2VGlSH9oOA702LZFtxcV5FAsGaVD05nZkSUX8HoJa/5P/2jKHTuzgZchYX0qRCZx A+gmacgueuD3tNX9jZAjK5+ZP4MbtbiQCPXvsavLdjApQIgLl3GqoJf7bYB6MpcLszFY uf5jszEgx5PvzueEcn9c/U16A6NiwTnV3teIjzhDJ/PzIyayOIN53IjsXhPP0Q5UK7Pa FKcAPhvUHyDZug84pU9bJ+cyhFt9ltZ+LNPIQPM7l/mgnrQnySEMnwvSvn/wzwTVIyua 434Q== X-Gm-Message-State: ABUngvdSbM8Gafy2SjMlcVzi+bG3+Sym923VRSyAIqTQgipb+/nJUgsaIXV5tDVIKri/aw== X-Received: by 10.194.113.129 with SMTP id iy1mr16330619wjb.127.1479044478055; Sun, 13 Nov 2016 05:41:18 -0800 (PST) Received: from ?IPv6:2003:62:5f58:9d00:45b5:f382:329:d09c? (p200300625F589D0045B5F3820329D09C.dip0.t-ipconnect.de. [2003:62:5f58:9d00:45b5:f382:329:d09c]) by smtp.googlemail.com with ESMTPSA id i10sm22638800wjd.15.2016.11.13.05.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 05:41:17 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 03/10] spi: fsl-espi: remove remaining usage of struct fsl_spi_platform_data To: Mark Brown References: <882d05f1-a963-c03a-38ae-2dd701f561a6@gmail.com> <46d0ab77-d645-1db3-cca4-99b1b04d599c@gmail.com> Cc: "linux-spi@vger.kernel.org" Message-ID: <75bd88e0-e1bf-9729-6cd0-e88633d940e6@gmail.com> Date: Sun, 13 Nov 2016 14:36:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <46d0ab77-d645-1db3-cca4-99b1b04d599c@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use master->num_chipselect directly instead of pdata->max_chipselect. In this context let of_fsl_espi_get_chipselects return max_chipselect. This change allows us to get rid of struct fsl_spi_platform_data completely in the fsl-espi driver. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-fsl-espi.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index e5d7164..29cd4e0 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -573,9 +573,8 @@ static size_t fsl_espi_max_message_size(struct spi_device *spi) } static int fsl_espi_probe(struct device *dev, struct resource *mem, - unsigned int irq) + unsigned int irq, unsigned int num_cs) { - struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); struct spi_master *master; struct mpc8xxx_spi *mpc8xxx_spi; struct device_node *nc; @@ -597,6 +596,7 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem, master->transfer_one_message = fsl_espi_do_one_msg; master->auto_runtime_pm = true; master->max_message_size = fsl_espi_max_message_size; + master->num_chipselect = num_cs; mpc8xxx_spi = spi_master_get_devdata(master); spin_lock_init(&mpc8xxx_spi->lock); @@ -636,7 +636,7 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem, for_each_available_child_of_node(master->dev.of_node, nc) { /* get chip select */ ret = of_property_read_u32(nc, "reg", &cs); - if (ret || cs >= pdata->max_chipselect) + if (ret || cs >= num_cs) continue; csmode = CSMODE_INIT_VAL; @@ -695,19 +695,16 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem, static int of_fsl_espi_get_chipselects(struct device *dev) { struct device_node *np = dev->of_node; - struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); u32 num_cs; int ret; ret = of_property_read_u32(np, "fsl,espi-num-chipselects", &num_cs); if (ret) { dev_err(dev, "No 'fsl,espi-num-chipselects' property\n"); - return -EINVAL; + return 0; } - pdata->max_chipselect = num_cs; - - return 0; + return num_cs; } static int of_fsl_espi_probe(struct platform_device *ofdev) @@ -715,16 +712,16 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) struct device *dev = &ofdev->dev; struct device_node *np = ofdev->dev.of_node; struct resource mem; - unsigned int irq; + unsigned int irq, num_cs; int ret; ret = of_mpc8xxx_spi_probe(ofdev); if (ret) return ret; - ret = of_fsl_espi_get_chipselects(dev); - if (ret) - return ret; + num_cs = of_fsl_espi_get_chipselects(dev); + if (!num_cs) + return -EINVAL; ret = of_address_to_resource(np, 0, &mem); if (ret) @@ -734,7 +731,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) if (!irq) return -EINVAL; - return fsl_espi_probe(dev, &mem, irq); + return fsl_espi_probe(dev, &mem, irq, num_cs); } static int of_fsl_espi_remove(struct platform_device *dev) @@ -765,7 +762,6 @@ static int of_fsl_espi_suspend(struct device *dev) static int of_fsl_espi_resume(struct device *dev) { - struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); struct spi_master *master = dev_get_drvdata(dev); struct mpc8xxx_spi *mpc8xxx_spi; u32 regval; @@ -780,7 +776,7 @@ static int of_fsl_espi_resume(struct device *dev) fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPIE, 0xffffffff); /* Init eSPI CS mode register */ - for (i = 0; i < pdata->max_chipselect; i++) + for (i = 0; i < master->num_chipselect; i++) fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODEx(i), CSMODE_INIT_VAL);