diff options
author | Ioana Ciornei <ioana.ciornei@nxp.com> | 2018-12-04 14:20:29 +0300 |
---|---|---|
committer | Li Yang <leoyang.li@nxp.com> | 2019-01-08 23:15:37 +0300 |
commit | 991e873223e9bcfaf10a0074eec1507c1ddfb6ab (patch) | |
tree | ee93eb8fabe6540522c803ecf925afded1246d64 /drivers/soc/fsl/dpio/dpio-service.c | |
parent | e181a569d8e52d5a5c91cf2ddc3ebcfb81163887 (diff) | |
download | linux-991e873223e9bcfaf10a0074eec1507c1ddfb6ab.tar.xz |
soc: fsl: dpio: use a cpumask to identify which cpus are unused
The current implementation of the dpio driver uses a static next_cpu
variable to keep track of the index of the next cpu available. This
approach does not handle well unbinding and binding dpio devices in a
random order. For example, unbinding a dpio and then binding it again
with the driver, will generate the below error:
$ echo dpio.5 > /sys/bus/fsl-mc/drivers/fsl_mc_dpio/unbind
$ echo dpio.5 > /sys/bus/fsl-mc/drivers/fsl_mc_dpio/bind
[ 103.946380] fsl_mc_dpio dpio.5: probe failed. Number of DPIOs exceeds
NR_CPUS.
[ 103.955157] fsl_mc_dpio dpio.5: fsl_mc_driver_probe failed: -34
-bash: echo: write error: No such device
Fix this error by keeping a global cpumask of unused cpus that will be
updated at every dpaa2_dpio_[probe,remove].
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Diffstat (limited to 'drivers/soc/fsl/dpio/dpio-service.c')
-rw-r--r-- | drivers/soc/fsl/dpio/dpio-service.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/soc/fsl/dpio/dpio-service.c b/drivers/soc/fsl/dpio/dpio-service.c index ab046f241d32..c02bfb18a1f0 100644 --- a/drivers/soc/fsl/dpio/dpio-service.c +++ b/drivers/soc/fsl/dpio/dpio-service.c @@ -215,6 +215,19 @@ done: } /** + * dpaa2_io_get_cpu() - get the cpu associated with a given DPIO object + * + * @d: the given DPIO object. + * + * Return the cpu associated with the DPIO object + */ +int dpaa2_io_get_cpu(struct dpaa2_io *d) +{ + return d->dpio_desc.cpu; +} +EXPORT_SYMBOL(dpaa2_io_get_cpu); + +/** * dpaa2_io_service_register() - Prepare for servicing of FQDAN or CDAN * notifications on the given DPIO service. * @d: the given DPIO service. |