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] [day] [month] [year] [list]
Date:   Tue, 20 Sep 2022 14:16:40 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Jianqun Xu <jay.xu@...k-chips.com>
Cc:     brgl@...ev.pl, andriy.shevchenko@...ux.intel.com,
        linux-gpio@...r.kernel.or, linux-kernel@...r.kernel.org,
        linux-gpio@...r.kernel.org
Subject: Re: [PATCH] gpiolib: make gpiochip_find_by_name to be common function

On Tue, Sep 20, 2022 at 3:09 AM Jianqun Xu <jay.xu@...k-chips.com> wrote:

> Move find_chip_by_name from gpiolib to the gpio/driver.h, also rename to
> gpiochip_find_by_name, make it to be a common function.
>
> Signed-off-by: Jianqun Xu <jay.xu@...k-chips.com>

It feels like you are reimplementing component_match_add() and
component_master_add_with_match().

This is infrastructure from <linux/component.h> that make a device
initialize (bind) and probe subdrivers from a master driver.

See for example in drivers/gpu/drm/vc4/vc4_drv.c:

static struct platform_driver *const component_drivers[] = {
        &vc4_hvs_driver,
        &vc4_hdmi_driver,
        &vc4_vec_driver,
        &vc4_dpi_driver,
        &vc4_dsi_driver,
        &vc4_txp_driver,
        &vc4_crtc_driver,
        &vc4_v3d_driver,
};

static int vc4_platform_drm_probe(struct platform_device *pdev)
{
        struct component_match *match = NULL;
        struct device *dev = &pdev->dev;

        vc4_match_add_drivers(dev, &match,
                              component_drivers, ARRAY_SIZE(component_drivers));

        return component_master_add_with_match(dev, &vc4_drm_ops, match);
}

This will let each driver bind individually, then the probe calls will be
orchestrated by the component_master_add_with_match(): the master
probes first then each subdriver (hvs, hdmi etc).

This makes it possible to control dependencies in componsite
(componentized) drivers, as you pin controller and GPIO controllers.

I used this for example in a charging driver with dependencies in
drivers/power/supply/ab8500_charger.c and in some DRM drivers.

Yours,
Linus Walleij

Powered by blists - more mailing lists