diff options
Diffstat (limited to 'drivers/spi/spi-s3c64xx.c')
-rw-r--r-- | drivers/spi/spi-s3c64xx.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 0e2a02228d5e..1a81c90a4a71 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -835,9 +835,7 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( | |||
835 | return ERR_PTR(-EINVAL); | 835 | return ERR_PTR(-EINVAL); |
836 | } | 836 | } |
837 | 837 | ||
838 | for_each_child_of_node(slave_np, data_np) | 838 | data_np = of_get_child_by_name(slave_np, "controller-data"); |
839 | if (!strcmp(data_np->name, "controller-data")) | ||
840 | break; | ||
841 | if (!data_np) { | 839 | if (!data_np) { |
842 | dev_err(&spi->dev, "child node 'controller-data' not found\n"); | 840 | dev_err(&spi->dev, "child node 'controller-data' not found\n"); |
843 | return ERR_PTR(-EINVAL); | 841 | return ERR_PTR(-EINVAL); |
@@ -847,6 +845,7 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( | |||
847 | if (!cs) { | 845 | if (!cs) { |
848 | dev_err(&spi->dev, "could not allocate memory for controller" | 846 | dev_err(&spi->dev, "could not allocate memory for controller" |
849 | " data\n"); | 847 | " data\n"); |
848 | of_node_put(data_np); | ||
850 | return ERR_PTR(-ENOMEM); | 849 | return ERR_PTR(-ENOMEM); |
851 | } | 850 | } |
852 | 851 | ||
@@ -855,11 +854,13 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( | |||
855 | dev_err(&spi->dev, "chip select gpio is not specified or " | 854 | dev_err(&spi->dev, "chip select gpio is not specified or " |
856 | "invalid\n"); | 855 | "invalid\n"); |
857 | kfree(cs); | 856 | kfree(cs); |
857 | of_node_put(data_np); | ||
858 | return ERR_PTR(-EINVAL); | 858 | return ERR_PTR(-EINVAL); |
859 | } | 859 | } |
860 | 860 | ||
861 | of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay); | 861 | of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay); |
862 | cs->fb_delay = fb_delay; | 862 | cs->fb_delay = fb_delay; |
863 | of_node_put(data_np); | ||
863 | return cs; | 864 | return cs; |
864 | } | 865 | } |
865 | 866 | ||
@@ -976,7 +977,8 @@ err_msgq: | |||
976 | spi_set_ctldata(spi, NULL); | 977 | spi_set_ctldata(spi, NULL); |
977 | 978 | ||
978 | err_gpio_req: | 979 | err_gpio_req: |
979 | kfree(cs); | 980 | if (spi->dev.of_node) |
981 | kfree(cs); | ||
980 | 982 | ||
981 | return err; | 983 | return err; |
982 | } | 984 | } |
@@ -1409,7 +1411,7 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) | |||
1409 | #ifdef CONFIG_PM | 1411 | #ifdef CONFIG_PM |
1410 | static int s3c64xx_spi_suspend(struct device *dev) | 1412 | static int s3c64xx_spi_suspend(struct device *dev) |
1411 | { | 1413 | { |
1412 | struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); | 1414 | struct spi_master *master = dev_get_drvdata(dev); |
1413 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); | 1415 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); |
1414 | 1416 | ||
1415 | spi_master_suspend(master); | 1417 | spi_master_suspend(master); |
@@ -1428,7 +1430,7 @@ static int s3c64xx_spi_suspend(struct device *dev) | |||
1428 | 1430 | ||
1429 | static int s3c64xx_spi_resume(struct device *dev) | 1431 | static int s3c64xx_spi_resume(struct device *dev) |
1430 | { | 1432 | { |
1431 | struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); | 1433 | struct spi_master *master = dev_get_drvdata(dev); |
1432 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); | 1434 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); |
1433 | struct s3c64xx_spi_info *sci = sdd->cntrlr_info; | 1435 | struct s3c64xx_spi_info *sci = sdd->cntrlr_info; |
1434 | 1436 | ||
@@ -1452,7 +1454,7 @@ static int s3c64xx_spi_resume(struct device *dev) | |||
1452 | #ifdef CONFIG_PM_RUNTIME | 1454 | #ifdef CONFIG_PM_RUNTIME |
1453 | static int s3c64xx_spi_runtime_suspend(struct device *dev) | 1455 | static int s3c64xx_spi_runtime_suspend(struct device *dev) |
1454 | { | 1456 | { |
1455 | struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); | 1457 | struct spi_master *master = dev_get_drvdata(dev); |
1456 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); | 1458 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); |
1457 | 1459 | ||
1458 | clk_disable(sdd->clk); | 1460 | clk_disable(sdd->clk); |
@@ -1463,7 +1465,7 @@ static int s3c64xx_spi_runtime_suspend(struct device *dev) | |||
1463 | 1465 | ||
1464 | static int s3c64xx_spi_runtime_resume(struct device *dev) | 1466 | static int s3c64xx_spi_runtime_resume(struct device *dev) |
1465 | { | 1467 | { |
1466 | struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); | 1468 | struct spi_master *master = dev_get_drvdata(dev); |
1467 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); | 1469 | struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); |
1468 | 1470 | ||
1469 | clk_enable(sdd->src_clk); | 1471 | clk_enable(sdd->src_clk); |