• Tony Lindgren's avatar
    of/platform: Allow secondary compatible match in of_dev_lookup · fc5cf80a
    Tony Lindgren authored
    We currently try to match of_dev_auxdata based on compatible,
    IO address, and device name. But in some cases we have multiple
    instances of drivers that can use the same auxdata.
    
    Let's add an additional secondary lookup for generic compatible
    match for auxdata if no device specific match is found. This does
    not change the existing matching, and still allows adding device
    specific auxdata.
    
    This simplifies things as specifying the IO address and device
    name is prone errors as it requires maintaining an in kernel
    database for each SoC.
    
    To specify a generic match, all that is needed is to add a
    OF_DEV_AUXDATA entry with no device instance specified:
    
    OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
    
    As the auxdata is already initialized only for the booted SoC,
    there's not much of a chance of getting things wrong.
    
    Let's also fix two checkpatch warnings while at it to add a
    space before parenthesis in the for loop, and remove a comparison
    to NULL by using !auxdata->compatible.
    Acked-by: default avatarRob Herring <robh@kernel.org>
    Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
    fc5cf80a
platform.c 17 KB