All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
To: Wolfram Sang <public-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@lo.gmane.org>
Cc: spi-devel-general@lists.sourceforge.net,
	linux-arm <linux-arm-kernel@lists.arm.linux.org.uk>
Subject: Re: [RFC] generic iMX-spi driver
Date: Mon, 23 Feb 2009 10:57:02 +0200	[thread overview]
Message-ID: <49A264DE.8080805@teltonika.lt> (raw)
In-Reply-To: <20090220144126.GA9203@pengutronix.de>

Wolfram Sang wrote:
> @@ -1646,6 +1706,8 @@ static int __exit spi_imx_remove(struct platform_device *pdev)
>  	struct driver_data *drv_data = platform_get_drvdata(pdev);
>  	int irq;
>  	int status = 0;
> +	struct spi_imx_master *platform_info =
> +			(struct spi_imx_master *)pdev->dev.platform_data;
>  
>  	if (!drv_data)
>  		return 0;
> @@ -1659,10 +1721,13 @@ static int __exit spi_imx_remove(struct platform_device *pdev)
>  		return status;
>  	}
>  
> +	if (platform_info->exit)
> +		platform_info->exit(pdev);

platform_info can be NULL here if when declaring platform_device platform data was not set.
In this case you will get crash here.
Should be if (platform_info && platform_info->exit)

> +
>  	/* Reset SPI */
> -	writel(SPI_RESET_START, drv_data->regs + SPI_RESET);
> -	writel(0, drv_data->regs + SPI_RESET);
> +	writel(drv_data->version->reset_val, drv_data->regs + drv_data->version->reset);
>  
> +#ifdef CONFIG_SPI_IMX_DMA
>  	/* Release DMA */
>  	if (drv_data->master_info->enable_dma) {
>  		RSSR(drv_data->rx_channel) = 0;
> @@ -1670,6 +1735,7 @@ static int __exit spi_imx_remove(struct platform_device *pdev)
>  		imx_dma_free(drv_data->tx_channel);
>  		imx_dma_free(drv_data->rx_channel);
>  	}
> +#endif /* DMA */
>  
>  	/* Release IRQ */
>  	irq = platform_get_irq(pdev, 0);
> @@ -1701,8 +1767,7 @@ static void spi_imx_shutdown(struct platform_device *pdev)
>  	struct driver_data *drv_data = platform_get_drvdata(pdev);
>  
>  	/* Reset SPI */
> -	writel(SPI_RESET_START, drv_data->regs + SPI_RESET);
> -	writel(0, drv_data->regs + SPI_RESET);
> +	writel(drv_data->version->reset_val, drv_data->regs + drv_data->version->reset);
>  
>  	dev_dbg(&pdev->dev, "shutdown succeded\n");
>  }
> @@ -1714,12 +1779,20 @@ static int spi_imx_suspend(struct platform_device *pdev, pm_message_t state)
>  	struct driver_data *drv_data = platform_get_drvdata(pdev);
>  	int status = 0;
>  
> +	struct spi_imx_master *platform_info =
> +			(struct spi_imx_master *)pdev->dev.platform_data;
> +
>  	status = stop_queue(drv_data);
>  	if (status != 0) {
>  		dev_warn(&pdev->dev, "suspend cannot stop queue\n");
>  		return status;
>  	}
>  
> +	if (platform_info->exit)
> +		platform_info->exit(pdev);

ditto

> +
> +	clk_disable(drv_data->clk);
> +
>  	dev_dbg(&pdev->dev, "suspended\n");
>  
>  	return 0;
> @@ -1730,6 +1803,14 @@ static int spi_imx_resume(struct platform_device *pdev)
>  	struct driver_data *drv_data = platform_get_drvdata(pdev);
>  	int status = 0;
>  
> +	struct spi_imx_master *platform_info =
> +			(struct spi_imx_master *)pdev->dev.platform_data;
> +
> +	clk_enable(drv_data->clk);
> +
> +	if (platform_info->init)
> +		platform_info->init(pdev);

ditto

> +
>  	/* Start the queue running */
>  	status = start_queue(drv_data);
>  	if (status != 0)


-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

  parent reply	other threads:[~2009-02-23  8:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 14:41 [RFC] generic iMX-spi driver Wolfram Sang
     [not found] ` <20090220144126.GA9203-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-02-20 14:58   ` Wolfram Sang
2009-02-20 15:41   ` Holger Schurig
     [not found]     ` <200902201641.21168.hs4233-x6+DxXLjN1AJvtFkdXX2Hg4jNU5vUVPG@public.gmane.org>
2009-02-26 10:38       ` Wolfram Sang
     [not found]         ` <20090226103844.GB3058-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-02-26 23:26           ` Russell King - ARM Linux
     [not found]             ` <20090226232639.GF5811-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2009-02-27 10:38               ` Wolfram Sang
     [not found]                 ` <20090227103840.GC3481-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-03-02 20:58                   ` Russell King - ARM Linux
     [not found]                     ` <20090302205826.GG25699-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2009-04-30 21:44                       ` Guennadi Liakhovetski
2009-04-30 21:49                         ` Russell King - ARM Linux
     [not found]                         ` <Pine.LNX.4.64.0904302343470.9542-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2009-05-04 16:29                           ` Sascha Hauer
2009-02-23  8:57 ` Paulius Zaleckas [this message]
     [not found]   ` <49A264DE.8080805-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2009-02-26  9:58     ` Wolfram Sang
     [not found]       ` <20090226095825.GA3058-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-02-26 10:07         ` Paulius Zaleckas

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=49A264DE.8080805@teltonika.lt \
    --to=paulius.zaleckas@teltonika.lt \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=public-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@lo.gmane.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.