• Horia Geantă's avatar
    crypto: caam - fix JR platform device subsequent (re)creations · ec360607
    Horia Geantă authored
    The way Job Ring platform devices are created and released does not
    allow for multiple create-release cycles.
    
    JR0 Platform device creation error
    JR0 Platform device creation error
    caam 2100000.caam: no queues configured, terminating
    caam: probe of 2100000.caam failed with error -12
    
    The reason is that platform devices are created for each job ring:
    
            for_each_available_child_of_node(nprop, np)
                    if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") ||
                        of_device_is_compatible(np, "fsl,sec4.0-job-ring")) {
                            ctrlpriv->jrpdev[ring] =
                                    of_platform_device_create(np, NULL, dev);
    
    which sets OF_POPULATED on the device node, but then it cleans these up:
    
            /* Remove platform devices for JobRs */
            for (ring = 0; ring < ctrlpriv->total_jobrs; ring++) {
                    if (ctrlpriv->jrpdev[ring])
                            of_device_unregister(ctrlpriv->jrpdev[ring]);
            }
    
    which leaves OF_POPULATED set.
    
    Use of_platform_populate / of_platform_depopulate instead.
    This allows for a bit of driver clean-up, jrpdev is no longer needed.
    
    Logic changes a bit too:
    -exit in case of_platform_populate fails, since currently even QI backend
    depends on JR; true, we no longer support the case when "some" of the JR
    DT nodes are incorrect
    -when cleaning up, caam_remove() would also depopulate RTIC in case
    it would have been populated somewhere else - not the case for now
    
    Cc: <stable@vger.kernel.org>
    Fixes: 313ea293 ("crypto: caam - Add Platform driver for Job Ring")
    Reported-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
    Suggested-by: default avatarRob Herring <robh+dt@kernel.org>
    Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
    Acked-by: default avatarRob Herring <robh@kernel.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    ec360607
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...