1
0

0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From d9c8bc8c1408f3e8529db6e4e04017b4c579c342 Mon Sep 17 00:00:00 2001
  2. From: Pawel Dembicki <paweldembicki@gmail.com>
  3. Date: Sun, 18 Feb 2018 17:08:04 +0100
  4. Subject: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio
  5. In devices, where fdt is used, is impossible to apply platform data
  6. without proper fdt node.
  7. This patch allow to use platform data in devices with fdt.
  8. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
  9. ---
  10. drivers/w1/masters/w1-gpio.c | 7 +++----
  11. 1 file changed, 3 insertions(+), 4 deletions(-)
  12. --- a/drivers/w1/masters/w1-gpio.c
  13. +++ b/drivers/w1/masters/w1-gpio.c
  14. @@ -113,17 +113,16 @@ static int w1_gpio_probe_dt(struct platf
  15. static int w1_gpio_probe(struct platform_device *pdev)
  16. {
  17. struct w1_bus_master *master;
  18. - struct w1_gpio_platform_data *pdata;
  19. + struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
  20. int err;
  21. - if (of_have_populated_dt()) {
  22. + if (of_have_populated_dt() && !pdata) {
  23. err = w1_gpio_probe_dt(pdev);
  24. if (err < 0)
  25. return err;
  26. + pdata = dev_get_platdata(&pdev->dev);
  27. }
  28. - pdata = dev_get_platdata(&pdev->dev);
  29. -
  30. if (!pdata) {
  31. dev_err(&pdev->dev, "No configuration data\n");
  32. return -ENXIO;