Re: [PATCH 1/2] gpio: mockup: Allow probing from device tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vincent,

looping in Bartosz here too.

On Wed, Sep 5, 2018 at 3:26 PM Vincent Whitchurch
<vincent.whitchurch@xxxxxxxx> wrote:
>
> Allow the mockup driver to be probed via the device tree, allowing it to
> be used to configure and test higher level drivers like the leds-gpio
> driver and corresponding userspace before actual hardware is available.
>
> The mockup debugfs interface can be used to inject events, and actions
> on the GPIO can be traced with ftrace.
>
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@xxxxxxxx>

As stated on the bindings, this looks generally helpful.

The code looks fine, would be good if Bartosz could test the patch
with his test setup so we know we don't regress anything.

Nitpicky comments below.

> -       struct gpio_mockup_platform_data *pdata;
> +       struct device_node *node = pdev->dev.of_node;

I usually just call it "np" (node pointer).

> +       if (node) {
> +               u32 nr_gpios;
> +               int ret;
> +
> +               ret = of_property_read_u32(node, "nr-gpios", &nr_gpios);

This we change to ngpios per the standard bindings.

> +               if (ret)
> +                       return ret;
> +
> +               base = -1;
> +               ngpio = nr_gpios;
> +               name = pdev->name;

Maybe of_node_full_name(node) is more helpful? (I'm not sure.)

Yours,
Linus Walleij



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux