linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	"Uwe Kleine-König"
	<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	"Sascha Hauer" <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 1/7] spi/imx: do not make copy of spi_imx_devtype_data
Date: Thu, 14 Jul 2011 20:53:40 -0600	[thread overview]
Message-ID: <20110715025340.GP2927@ponder.secretlab.ca> (raw)
In-Reply-To: <1310231801-18761-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

On Sun, Jul 10, 2011 at 01:16:35AM +0800, Shawn Guo wrote:
> spi_imx_devtype_data has already been driver private data.  There is
> really no need to make a copy in spi_imx_data.  Instead, a reference
> pointer works perfectly fine.
> 
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

Applied, thanks.

g.

> ---
>  drivers/spi/spi-imx.c |   24 ++++++++++++------------
>  1 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index 69d6dba..1c55dc9 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -96,7 +96,7 @@ struct spi_imx_data {
>  	const void *tx_buf;
>  	unsigned int txfifo; /* number of words pushed in tx FIFO */
>  
> -	struct spi_imx_devtype_data devtype_data;
> +	struct spi_imx_devtype_data *devtype_data;
>  };
>  
>  #define MXC_SPI_BUF_RX(type)						\
> @@ -539,7 +539,7 @@ static void __maybe_unused mx1_reset(struct spi_imx_data *spi_imx)
>   * These version numbers are taken from the Freescale driver.  Unfortunately it
>   * doesn't support i.MX1, so this entry doesn't match the scheme. :-(
>   */
> -static struct spi_imx_devtype_data spi_imx_devtype_data[] __devinitdata = {
> +static struct spi_imx_devtype_data spi_imx_devtype_data[] = {
>  #ifdef CONFIG_SPI_IMX_VER_IMX1
>  	[SPI_IMX_VER_IMX1] = {
>  		.intctrl = mx1_intctrl,
> @@ -607,21 +607,21 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active)
>  
>  static void spi_imx_push(struct spi_imx_data *spi_imx)
>  {
> -	while (spi_imx->txfifo < spi_imx->devtype_data.fifosize) {
> +	while (spi_imx->txfifo < spi_imx->devtype_data->fifosize) {
>  		if (!spi_imx->count)
>  			break;
>  		spi_imx->tx(spi_imx);
>  		spi_imx->txfifo++;
>  	}
>  
> -	spi_imx->devtype_data.trigger(spi_imx);
> +	spi_imx->devtype_data->trigger(spi_imx);
>  }
>  
>  static irqreturn_t spi_imx_isr(int irq, void *dev_id)
>  {
>  	struct spi_imx_data *spi_imx = dev_id;
>  
> -	while (spi_imx->devtype_data.rx_available(spi_imx)) {
> +	while (spi_imx->devtype_data->rx_available(spi_imx)) {
>  		spi_imx->rx(spi_imx);
>  		spi_imx->txfifo--;
>  	}
> @@ -635,12 +635,12 @@ static irqreturn_t spi_imx_isr(int irq, void *dev_id)
>  		/* No data left to push, but still waiting for rx data,
>  		 * enable receive data available interrupt.
>  		 */
> -		spi_imx->devtype_data.intctrl(
> +		spi_imx->devtype_data->intctrl(
>  				spi_imx, MXC_INT_RR);
>  		return IRQ_HANDLED;
>  	}
>  
> -	spi_imx->devtype_data.intctrl(spi_imx, 0);
> +	spi_imx->devtype_data->intctrl(spi_imx, 0);
>  	complete(&spi_imx->xfer_done);
>  
>  	return IRQ_HANDLED;
> @@ -677,7 +677,7 @@ static int spi_imx_setupxfer(struct spi_device *spi,
>  	} else
>  		BUG();
>  
> -	spi_imx->devtype_data.config(spi_imx, &config);
> +	spi_imx->devtype_data->config(spi_imx, &config);
>  
>  	return 0;
>  }
> @@ -696,7 +696,7 @@ static int spi_imx_transfer(struct spi_device *spi,
>  
>  	spi_imx_push(spi_imx);
>  
> -	spi_imx->devtype_data.intctrl(spi_imx, MXC_INT_TE);
> +	spi_imx->devtype_data->intctrl(spi_imx, MXC_INT_TE);
>  
>  	wait_for_completion(&spi_imx->xfer_done);
>  
> @@ -811,7 +811,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
>  	init_completion(&spi_imx->xfer_done);
>  
>  	spi_imx->devtype_data =
> -		spi_imx_devtype_data[pdev->id_entry->driver_data];
> +		&spi_imx_devtype_data[pdev->id_entry->driver_data];
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!res) {
> @@ -854,9 +854,9 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
>  	clk_enable(spi_imx->clk);
>  	spi_imx->spi_clk = clk_get_rate(spi_imx->clk);
>  
> -	spi_imx->devtype_data.reset(spi_imx);
> +	spi_imx->devtype_data->reset(spi_imx);
>  
> -	spi_imx->devtype_data.intctrl(spi_imx, 0);
> +	spi_imx->devtype_data->intctrl(spi_imx, 0);
>  
>  	ret = spi_bitbang_start(&spi_imx->bitbang);
>  	if (ret) {
> -- 
> 1.7.4.1
> 

  parent reply	other threads:[~2011-07-15  2:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-09 17:16 [PATCH v2 0/7] Add device tree support for imx spi driver Shawn Guo
     [not found] ` <1310231801-18761-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-09 17:16   ` [PATCH v2 1/7] spi/imx: do not make copy of spi_imx_devtype_data Shawn Guo
2011-07-11  7:15     ` Lothar Waßmann
     [not found]       ` <19994.41750.920408.162356-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
2011-07-11  7:31         ` Uwe Kleine-König
2011-07-11  7:49           ` Lothar Waßmann
2011-07-11  7:35       ` Shawn Guo
     [not found]         ` <20110711073523.GA19105-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-11  7:32           ` Lothar Waßmann
     [not found]     ` <1310231801-18761-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15  2:53       ` Grant Likely [this message]
2011-07-09 17:16   ` [PATCH v2 2/7] spi/imx: use mx21 to name SPI_IMX_VER_0_0 function and macro Shawn Guo
     [not found]     ` <1310231801-18761-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-11  7:35       ` Uwe Kleine-König
     [not found]         ` <20110711073523.GB13840-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-07-15  2:53           ` Grant Likely
2011-07-09 17:16   ` [PATCH v2 3/7] spi/imx: do not use spi_imx2_3 to name SPI_IMX_VER_2_3 " Shawn Guo
     [not found]     ` <1310231801-18761-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15  2:53       ` Grant Likely
2011-07-09 17:16   ` [PATCH v2 4/7] spi/imx: merge type SPI_IMX_VER_0_7 into SPI_IMX_VER_0_4 Shawn Guo
     [not found]     ` <1310231801-18761-5-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-11  7:38       ` Uwe Kleine-König
2011-07-09 17:16   ` [PATCH v2 5/7] spi/imx: use soc name in spi device type naming scheme Shawn Guo
     [not found]     ` <1310231801-18761-6-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15  2:53       ` Grant Likely
2011-07-09 17:16   ` [PATCH v2 6/7] spi/imx: copy gpio number passed by platform data into driver private data Shawn Guo
     [not found]     ` <1310231801-18761-7-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-11  7:45       ` Uwe Kleine-König
2011-07-09 17:16   ` [PATCH v2 7/7] spi/imx: add device tree probe support Shawn Guo
     [not found]     ` <1310231801-18761-8-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15  2:53       ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110715025340.GP2927@ponder.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).