From: John Crispin Date: Mon, 30 Jul 2018 18:51:56 +0000 (+0200) Subject: brcm2708: fix w1 patch X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5f5d8128815c0624a01e48de25bd5cf1b6ab23ef;p=openwrt%2Fstaging%2Fjow.git brcm2708: fix w1 patch this is now part of generic Signed-off-by: John Crispin --- diff --git a/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch b/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch index 408ac045f7..5a324dde61 100644 --- a/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch +++ b/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch @@ -28,8 +28,10 @@ w1-gpio: Sort out the pullup/parasitic power tangle include/linux/w1-gpio.h | 1 + 5 files changed, 99 insertions(+), 9 deletions(-) ---- a/drivers/w1/masters/w1-gpio.c -+++ b/drivers/w1/masters/w1-gpio.c +Index: linux-4.9.111/drivers/w1/masters/w1-gpio.c +=================================================================== +--- linux-4.9.111.orig/drivers/w1/masters/w1-gpio.c ++++ linux-4.9.111/drivers/w1/masters/w1-gpio.c @@ -23,6 +23,19 @@ #include "../w1.h" #include "../w1_int.h" @@ -94,28 +96,7 @@ w1-gpio: Sort out the pullup/parasitic power tangle pdev->dev.platform_data = pdata; -@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platf - static int w1_gpio_probe(struct platform_device *pdev) - { - struct w1_bus_master *master; -- struct w1_gpio_platform_data *pdata; -+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; - int err; - -- if (of_have_populated_dt()) { -- err = w1_gpio_probe_dt(pdev); -- if (err < 0) -- return err; -+ if(pdata == NULL) { -+ if (of_have_populated_dt()) { -+ err = w1_gpio_probe_dt(pdev); -+ if (err < 0) -+ return err; -+ } - } - - pdata = dev_get_platdata(&pdev->dev); -@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform +@@ -135,6 +162,22 @@ static int w1_gpio_probe(struct platform return -ENOMEM; } @@ -138,7 +119,7 @@ w1-gpio: Sort out the pullup/parasitic power tangle err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); if (err) { dev_err(&pdev->dev, "gpio_request (pin) failed\n"); -@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform +@@ -164,6 +207,14 @@ static int w1_gpio_probe(struct platform master->set_pullup = w1_gpio_set_pullup; } @@ -153,7 +134,7 @@ w1-gpio: Sort out the pullup/parasitic power tangle err = w1_add_master_device(master); if (err) { dev_err(&pdev->dev, "w1_add_master device failed\n"); -@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platfor +@@ -194,6 +245,10 @@ static int w1_gpio_remove(struct platfor w1_remove_master_device(master); @@ -164,8 +145,10 @@ w1-gpio: Sort out the pullup/parasitic power tangle return 0; } ---- a/drivers/w1/w1.h -+++ b/drivers/w1/w1.h +Index: linux-4.9.111/drivers/w1/w1.h +=================================================================== +--- linux-4.9.111.orig/drivers/w1/w1.h ++++ linux-4.9.111/drivers/w1/w1.h @@ -173,6 +173,12 @@ struct w1_bus_master u8 (*set_pullup)(void *, int); @@ -179,8 +162,10 @@ w1-gpio: Sort out the pullup/parasitic power tangle void (*search)(void *, struct w1_master *, u8, w1_slave_found_callback); }; ---- a/drivers/w1/w1_int.c -+++ b/drivers/w1/w1_int.c +Index: linux-4.9.111/drivers/w1/w1_int.c +=================================================================== +--- linux-4.9.111.orig/drivers/w1/w1_int.c ++++ linux-4.9.111/drivers/w1/w1_int.c @@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_m return(-EINVAL); } @@ -202,8 +187,10 @@ w1-gpio: Sort out the pullup/parasitic power tangle /* Lock until the device is added (or not) to w1_masters. */ mutex_lock(&w1_mlock); /* Search for the first available id (starting at 1). */ ---- a/drivers/w1/w1_io.c -+++ b/drivers/w1/w1_io.c +Index: linux-4.9.111/drivers/w1/w1_io.c +=================================================================== +--- linux-4.9.111.orig/drivers/w1/w1_io.c ++++ linux-4.9.111/drivers/w1/w1_io.c @@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_maste static void w1_post_write(struct w1_master *dev) { @@ -230,8 +217,10 @@ w1-gpio: Sort out the pullup/parasitic power tangle dev->pullup_duration = 0; } } ---- a/include/linux/w1-gpio.h -+++ b/include/linux/w1-gpio.h +Index: linux-4.9.111/include/linux/w1-gpio.h +=================================================================== +--- linux-4.9.111.orig/include/linux/w1-gpio.h ++++ linux-4.9.111/include/linux/w1-gpio.h @@ -18,6 +18,7 @@ struct w1_gpio_platform_data { unsigned int pin;