Skip to content

Commit 9182ee2

Browse files
IoanaCiorneiLi Yang
authored andcommitted
soc: fsl: dpio: keep a per dpio device MC portal
At the moment, the dpio-driver allocates an MC portal at probe time and frees it right after usage. The same thing happens on the remove path. This behavior could lead to scenarios where an MC portal is available for use at probing but not longer free on the remove path which could lead to unproper unbind of resources. Change the driver's behavior in such a way that an MC portal is allocated at probe and kept until the DPIO device is removed. This will ensure that at any time after a DPIO device was successfully probed, all its dependencies will be met. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
1 parent 11c8bac commit 9182ee2

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

‎drivers/soc/fsl/dpio/dpio-driver.c‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
187187
dev_dbg(dev, " receives_notifications = %d\n",
188188
desc.receives_notifications);
189189
dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
190-
fsl_mc_portal_free(dpio_dev->mc_io);
191190

192191
return 0;
193192

@@ -229,12 +228,6 @@ static int dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev)
229228
cpu = dpaa2_io_get_cpu(priv->io);
230229
cpumask_set_cpu(cpu, cpus_unused_mask);
231230

232-
err = fsl_mc_portal_allocate(dpio_dev, 0, &dpio_dev->mc_io);
233-
if (err) {
234-
dev_err(dev, "MC portal allocation failed\n");
235-
goto err_mcportal;
236-
}
237-
238231
err = dpio_open(dpio_dev->mc_io, 0, dpio_dev->obj_desc.id,
239232
&dpio_dev->mc_handle);
240233
if (err) {
@@ -252,7 +245,7 @@ static int dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev)
252245

253246
err_open:
254247
fsl_mc_portal_free(dpio_dev->mc_io);
255-
err_mcportal:
248+
256249
return err;
257250
}
258251

0 commit comments

Comments
 (0)