mirror of
https://github.com/bmartini/zynq-axis.git
synced 2024-09-05 19:19:27 +08:00
Add nb of iomem in private data struct
This number can then be used to release the I/O memory regions that have been requested in the probe function. This will thus allow for other types of mappable memory to be exposed by the driver.
This commit is contained in:
parent
72a2c01bfe
commit
e25e752d86
11
dev/axis.c
11
dev/axis.c
@ -28,6 +28,7 @@ struct axis_platdata {
|
||||
spinlock_t lock;
|
||||
unsigned long flags;
|
||||
struct platform_device *pdev;
|
||||
int iomem_nb;
|
||||
};
|
||||
|
||||
/* Bits in axis_platdata.flags */
|
||||
@ -93,7 +94,7 @@ static int axis_probe(struct platform_device *pdev)
|
||||
struct axis_platdata *priv;
|
||||
struct uio_mem *uiomem;
|
||||
int ret = -EINVAL;
|
||||
int nb_mem = 0;
|
||||
int iomem_nb = 0;
|
||||
int i;
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
@ -171,9 +172,10 @@ static int axis_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
++nb_mem;
|
||||
++iomem_nb;
|
||||
++uiomem;
|
||||
}
|
||||
priv->iomem_nb = iomem_nb;
|
||||
|
||||
while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) {
|
||||
uiomem->size = 0;
|
||||
@ -205,7 +207,7 @@ static int axis_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
bad0:
|
||||
uiomem = &uioinfo->mem[0];
|
||||
for (i = 0; i < nb_mem; ++i) {
|
||||
for (i = 0; i < iomem_nb; ++i) {
|
||||
if (uiomem->size != 0) {
|
||||
release_mem_region(uiomem->addr, uiomem->size);
|
||||
}
|
||||
@ -218,9 +220,10 @@ static int axis_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct axis_platdata *priv = platform_get_drvdata(pdev);
|
||||
struct uio_mem *uiomem;
|
||||
int i;
|
||||
|
||||
uiomem = &priv->uioinfo->mem[0];
|
||||
while (uiomem < &priv->uioinfo->mem[MAX_UIO_MAPS]) {
|
||||
for (i = 0; i < priv->iomem_nb; ++i) {
|
||||
if (uiomem->size != 0) {
|
||||
release_mem_region(uiomem->addr, uiomem->size);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user