diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/dts/testcases/tests-phandle.dtsi | 37 | ||||
-rw-r--r-- | arch/arm/boot/dts/testcases/tests.dtsi | 1 | ||||
-rw-r--r-- | arch/arm/boot/dts/versatile-pb.dts | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/reset.c | 43 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/gpio.c | 42 |
5 files changed, 50 insertions, 75 deletions
diff --git a/arch/arm/boot/dts/testcases/tests-phandle.dtsi b/arch/arm/boot/dts/testcases/tests-phandle.dtsi new file mode 100644 index 00000000000..ec0c4e6212c --- /dev/null +++ b/arch/arm/boot/dts/testcases/tests-phandle.dtsi @@ -0,0 +1,37 @@ + +/ { + testcase-data { + phandle-tests { + provider0: provider0 { + #phandle-cells = <0>; + }; + + provider1: provider1 { + #phandle-cells = <1>; + }; + + provider2: provider2 { + #phandle-cells = <2>; + }; + + provider3: provider3 { + #phandle-cells = <3>; + }; + + consumer-a { + phandle-list = <&provider1 1>, + <&provider2 2 0>, + <0>, + <&provider3 4 4 3>, + <&provider2 5 100>, + <&provider0>, + <&provider1 7>; + phandle-list-names = "first", "second", "third"; + + phandle-list-bad-phandle = <12345678 0 0>; + phandle-list-bad-args = <&provider2 1 0>, + <&provider3 0>; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/testcases/tests.dtsi b/arch/arm/boot/dts/testcases/tests.dtsi new file mode 100644 index 00000000000..a7c5067622e --- /dev/null +++ b/arch/arm/boot/dts/testcases/tests.dtsi @@ -0,0 +1 @@ +/include/ "tests-phandle.dtsi" diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts index 8a614e39800..166461073b7 100644 --- a/arch/arm/boot/dts/versatile-pb.dts +++ b/arch/arm/boot/dts/versatile-pb.dts @@ -46,3 +46,5 @@ }; }; }; + +/include/ "testcases/tests.dtsi" diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c index bd8ccab5cef..88a01636f78 100644 --- a/arch/microblaze/kernel/reset.c +++ b/arch/microblaze/kernel/reset.c @@ -19,50 +19,11 @@ static int handle; /* reset pin handle */ static unsigned int reset_val; -static int of_reset_gpio_handle(void) -{ - int ret; /* variable which stored handle reset gpio pin */ - struct device_node *root; /* root node */ - struct device_node *gpio; /* gpio node */ - struct gpio_chip *gc; - u32 flags; - const void *gpio_spec; - - /* find out root node */ - root = of_find_node_by_path("/"); - - /* give me handle for gpio node to be possible allocate pin */ - ret = of_parse_phandles_with_args(root, "hard-reset-gpios", - "#gpio-cells", 0, &gpio, &gpio_spec); - if (ret) { - pr_debug("%s: can't parse gpios property\n", __func__); - goto err0; - } - - gc = of_node_to_gpiochip(gpio); - if (!gc) { - pr_debug("%s: gpio controller %s isn't registered\n", - root->full_name, gpio->full_name); - ret = -ENODEV; - goto err1; - } - - ret = gc->of_xlate(gc, root, gpio_spec, &flags); - if (ret < 0) - goto err1; - - ret += gc->base; -err1: - of_node_put(gpio); -err0: - pr_debug("%s exited with status %d\n", __func__, ret); - return ret; -} - void of_platform_reset_gpio_probe(void) { int ret; - handle = of_reset_gpio_handle(); + handle = of_get_named_gpio(of_find_node_by_path("/"), + "hard-reset-gpios", 0); if (!gpio_is_valid(handle)) { printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n", diff --git a/arch/powerpc/sysdev/qe_lib/gpio.c b/arch/powerpc/sysdev/qe_lib/gpio.c index e23f23cf9f5..521e67a49dc 100644 --- a/arch/powerpc/sysdev/qe_lib/gpio.c +++ b/arch/powerpc/sysdev/qe_lib/gpio.c @@ -139,14 +139,10 @@ struct qe_pin { struct qe_pin *qe_pin_request(struct device_node *np, int index) { struct qe_pin *qe_pin; - struct device_node *gpio_np; struct gpio_chip *gc; struct of_mm_gpio_chip *mm_gc; struct qe_gpio_chip *qe_gc; int err; - int size; - const void *gpio_spec; - const u32 *gpio_cells; unsigned long flags; qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL); @@ -155,45 +151,25 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) return ERR_PTR(-ENOMEM); } - err = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index, - &gpio_np, &gpio_spec); - if (err) { - pr_debug("%s: can't parse gpios property\n", __func__); + err = of_get_gpio(np, index); + if (err < 0) + goto err0; + gc = gpio_to_chip(err); + if (WARN_ON(!gc)) goto err0; - } - if (!of_device_is_compatible(gpio_np, "fsl,mpc8323-qe-pario-bank")) { + if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) { pr_debug("%s: tried to get a non-qe pin\n", __func__); err = -EINVAL; - goto err1; - } - - gc = of_node_to_gpiochip(gpio_np); - if (!gc) { - pr_debug("%s: gpio controller %s isn't registered\n", - np->full_name, gpio_np->full_name); - err = -ENODEV; - goto err1; - } - - gpio_cells = of_get_property(gpio_np, "#gpio-cells", &size); - if (!gpio_cells || size != sizeof(*gpio_cells) || - *gpio_cells != gc->of_gpio_n_cells) { - pr_debug("%s: wrong #gpio-cells for %s\n", - np->full_name, gpio_np->full_name); - err = -EINVAL; - goto err1; + goto err0; } - err = gc->of_xlate(gc, np, gpio_spec, NULL); - if (err < 0) - goto err1; - mm_gc = to_of_mm_gpio_chip(gc); qe_gc = to_qe_gpio_chip(mm_gc); spin_lock_irqsave(&qe_gc->lock, flags); + err -= gc->base; if (test_and_set_bit(QE_PIN_REQUESTED, &qe_gc->pin_flags[err]) == 0) { qe_pin->controller = qe_gc; qe_pin->num = err; @@ -206,8 +182,6 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) if (!err) return qe_pin; -err1: - of_node_put(gpio_np); err0: kfree(qe_pin); pr_debug("%s failed with status %d\n", __func__, err); |