lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Feb 2018 16:27:11 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Andrzej Hajda <a.hajda@...sung.com>
Cc:     "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        dri-devel@...ts.freedesktop.org, Inki Dae <inki.dae@...sung.com>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Chanwoo Choi <cw00.choi@...sung.com>,
        Archit Taneja <architt@...eaurora.org>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        linux-samsung-soc@...r.kernel.org, USB <linux-usb@...r.kernel.org>
Subject: Re: [PATCH v4 5/6] extcon: add possibility to get extcon device by OF node

On Wed, Feb 21, 2018 at 10:55 AM, Andrzej Hajda <a.hajda@...sung.com> wrote:
> Since extcon property is not allowed in DT, extcon subsystem requires
> another way to get extcon device. Lets try the simplest approach - get
> edev by of_node.

> +/*
> + * extcon_get_edev_by_of_node - Get the extcon device from devicetree.
> + * @node       : OF node identyfying edev
> + *
> + * Return the pointer of extcon device if success or ERR_PTR(err) if fail.
> + */
> +struct extcon_dev *extcon_get_edev_by_of_node(struct device_node *node)

First of all, the all other similar cases use "_by_node" in the name.
Second, it's not _get_, it's _find_.

> +{
> +       struct extcon_dev *edev;
> +
> +       mutex_lock(&extcon_dev_list_lock);
> +       list_for_each_entry(edev, &extcon_dev_list, entry)
> +               if (edev->dev.parent && edev->dev.parent->of_node == node)
> +                       goto out;
> +       edev = ERR_PTR(-EPROBE_DEFER);
> +out:
> +       mutex_unlock(&extcon_dev_list_lock);
> +
> +       return edev;

Can't it be done using bus_find_device()?

> +}

See good example in i2c-core-of.c

of_find_i2c_adapter_by_node()
of_get_i2c_adapter_by_node()

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ