mirror of https://gitee.com/openkylin/linux.git
spi: fsl-lpspi: Fix problematic dev_set_drvdata call
The original code already set controller as drvdata: platform_set_drvdata(pdev, controller); But commit944c01a889
("spi: lpspi: enable runtime pm for lpspi") added dev_set_drvdata(&pdev->dev, fsl_lpspi); so fsl_lpspi_remove() will get wrong pointer by platform_get_drvdata(). Fixes:944c01a889
("spi: lpspi: enable runtime pm for lpspi") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
9d8371e287
commit
6599be346d
|
@ -788,9 +788,12 @@ static irqreturn_t fsl_lpspi_isr(int irq, void *dev_id)
|
||||||
|
|
||||||
static int fsl_lpspi_runtime_resume(struct device *dev)
|
static int fsl_lpspi_runtime_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct fsl_lpspi_data *fsl_lpspi = dev_get_drvdata(dev);
|
struct spi_controller *controller = dev_get_drvdata(dev);
|
||||||
|
struct fsl_lpspi_data *fsl_lpspi;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
fsl_lpspi = spi_controller_get_devdata(controller);
|
||||||
|
|
||||||
ret = clk_prepare_enable(fsl_lpspi->clk_per);
|
ret = clk_prepare_enable(fsl_lpspi->clk_per);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -806,7 +809,10 @@ static int fsl_lpspi_runtime_resume(struct device *dev)
|
||||||
|
|
||||||
static int fsl_lpspi_runtime_suspend(struct device *dev)
|
static int fsl_lpspi_runtime_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct fsl_lpspi_data *fsl_lpspi = dev_get_drvdata(dev);
|
struct spi_controller *controller = dev_get_drvdata(dev);
|
||||||
|
struct fsl_lpspi_data *fsl_lpspi;
|
||||||
|
|
||||||
|
fsl_lpspi = spi_controller_get_devdata(controller);
|
||||||
|
|
||||||
clk_disable_unprepare(fsl_lpspi->clk_per);
|
clk_disable_unprepare(fsl_lpspi->clk_per);
|
||||||
clk_disable_unprepare(fsl_lpspi->clk_ipg);
|
clk_disable_unprepare(fsl_lpspi->clk_ipg);
|
||||||
|
@ -853,7 +859,6 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
fsl_lpspi = spi_controller_get_devdata(controller);
|
fsl_lpspi = spi_controller_get_devdata(controller);
|
||||||
fsl_lpspi->dev = &pdev->dev;
|
fsl_lpspi->dev = &pdev->dev;
|
||||||
dev_set_drvdata(&pdev->dev, fsl_lpspi);
|
|
||||||
fsl_lpspi->is_slave = of_property_read_bool((&pdev->dev)->of_node,
|
fsl_lpspi->is_slave = of_property_read_bool((&pdev->dev)->of_node,
|
||||||
"spi-slave");
|
"spi-slave");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue