From patchwork Mon Sep 12 19:07:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9327671 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 E6C4B608A1 for ; Mon, 12 Sep 2016 19:08:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D06E628E91 for ; Mon, 12 Sep 2016 19:08:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C540F28E93; Mon, 12 Sep 2016 19:08:08 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 1B49228E97 for ; Mon, 12 Sep 2016 19:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752107AbcILTIC (ORCPT ); Mon, 12 Sep 2016 15:08:02 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:33040 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758001AbcILTIA (ORCPT ); Mon, 12 Sep 2016 15:08:00 -0400 Received: from debutante.sirena.org.uk ([2a01:348:6:8808:fab::3] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bjWaD-0003BR-5J; Mon, 12 Sep 2016 19:07:59 +0000 Received: from broonie by debutante with local (Exim 4.87) (envelope-from ) id 1bjWaA-0002mk-Da; Mon, 12 Sep 2016 20:07:54 +0100 From: Mark Brown To: Jarkko Nikula Cc: Mark Brown , linux-spi@vger.kernel.org, Mark Brown , Daniel Mack , Haojian Zhuang , Robert Jarzmik In-Reply-To: <20160907140407.17631-3-jarkko.nikula@linux.intel.com> Message-Id: Date: Mon, 12 Sep 2016 20:07:54 +0100 X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Applied "spi: pxa2xx: Remove pointer to chip data from driver data" to the spi tree X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure 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 The patch spi: pxa2xx: Remove pointer to chip data from driver data has been applied to the spi tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 96579a4e56bdecfb4642cfb68eb85d079acb9d28 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Wed, 7 Sep 2016 17:04:07 +0300 Subject: [PATCH] spi: pxa2xx: Remove pointer to chip data from driver data Transfer state machine in this driver does not need to set/unset pointer to chip data between queueing and finalizing message as it is not actually used as a state info itself but just pointer passing. Since this per SPI device specific chip data is already carried in ctldata use that and remove pointer to chip data from driver data. While at it, group initialized variables before uninitialized variables in pump_transfers(). Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- drivers/spi/spi-pxa2xx-dma.c | 3 ++- drivers/spi/spi-pxa2xx.c | 28 +++++++++++++--------------- drivers/spi/spi-pxa2xx.h | 1 - 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index 38efac33da47..04f3eecf5cf3 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -76,7 +76,8 @@ static struct dma_async_tx_descriptor * pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data, enum dma_transfer_direction dir) { - struct chip_data *chip = drv_data->cur_chip; + struct chip_data *chip = + spi_get_ctldata(drv_data->master->cur_msg->spi); struct spi_transfer *xfer = drv_data->cur_transfer; enum dma_slave_buswidth width; struct dma_slave_config cfg; diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index e05af2a94d38..6a0eb32408b6 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -355,10 +355,11 @@ static void lpss_ssp_cs_control(struct driver_data *drv_data, bool enable) static void cs_assert(struct driver_data *drv_data) { - struct chip_data *chip = drv_data->cur_chip; + struct chip_data *chip = + spi_get_ctldata(drv_data->master->cur_msg->spi); if (drv_data->ssp_type == CE4100_SSP) { - pxa2xx_spi_write(drv_data, SSSR, drv_data->cur_chip->frm); + pxa2xx_spi_write(drv_data, SSSR, chip->frm); return; } @@ -378,7 +379,8 @@ static void cs_assert(struct driver_data *drv_data) static void cs_deassert(struct driver_data *drv_data) { - struct chip_data *chip = drv_data->cur_chip; + struct chip_data *chip = + spi_get_ctldata(drv_data->master->cur_msg->spi); if (drv_data->ssp_type == CE4100_SSP) return; @@ -574,13 +576,13 @@ static void giveback(struct driver_data *drv_data) cs_deassert(drv_data); } - drv_data->cur_chip = NULL; spi_finalize_current_message(drv_data->master); } static void reset_sccr1(struct driver_data *drv_data) { - struct chip_data *chip = drv_data->cur_chip; + struct chip_data *chip = + spi_get_ctldata(drv_data->master->cur_msg->spi); u32 sccr1_reg; sccr1_reg = pxa2xx_spi_read(drv_data, SSCR1) & ~drv_data->int_cr1; @@ -904,7 +906,8 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, int rate) { - struct chip_data *chip = drv_data->cur_chip; + struct chip_data *chip = + spi_get_ctldata(drv_data->master->cur_msg->spi); unsigned int clk_div; switch (drv_data->ssp_type) { @@ -934,23 +937,22 @@ static void pump_transfers(unsigned long data) struct driver_data *drv_data = (struct driver_data *)data; struct spi_master *master = drv_data->master; struct spi_message *message = master->cur_msg; + struct chip_data *chip = spi_get_ctldata(message->spi); + u32 dma_thresh = chip->dma_threshold; + u32 dma_burst = chip->dma_burst_size; + u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data); struct spi_transfer *transfer; struct spi_transfer *previous; - struct chip_data *chip; u32 clk_div; u8 bits; u32 speed; u32 cr0; u32 cr1; - u32 dma_thresh = drv_data->cur_chip->dma_threshold; - u32 dma_burst = drv_data->cur_chip->dma_burst_size; - u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data); int err; int dma_mapped; /* Get current state information */ transfer = drv_data->cur_transfer; - chip = drv_data->cur_chip; /* Handle for abort */ if (message->state == ERROR_STATE) { @@ -1150,10 +1152,6 @@ static int pxa2xx_spi_transfer_one_message(struct spi_master *master, struct spi_transfer, transfer_list); - /* prepare to setup the SSP, in pump_transfers, using the per - * chip configuration */ - drv_data->cur_chip = spi_get_ctldata(msg->spi); - /* Mark as busy and launch transfers */ tasklet_schedule(&drv_data->pump_transfers); return 0; diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 4f858664cee1..ae3b15ff6fb2 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -54,7 +54,6 @@ struct driver_data { /* Current message transfer state info */ struct spi_transfer *cur_transfer; - struct chip_data *cur_chip; size_t len; void *tx; void *tx_end;