diff options
author | Esben Haabendal <esben@geanix.com> | 2020-07-01 17:56:59 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-03 12:01:50 +0300 |
commit | 7aca462b133300c16213e214bb96e516f1f2784e (patch) | |
tree | 52f190a96b58323f6a6f446cafe9ecaaac209b44 /drivers/uio/uio_pdrv_genirq.c | |
parent | 52f944ee5d39b6b93797480f9181d3d40ed0d07b (diff) | |
download | linux-7aca462b133300c16213e214bb96e516f1f2784e.tar.xz |
uio_pdrv_genirq: Allow use with non-page-aligned memory resources
Similar to the changes made in 270579d95f82 ("uio_mf624: Align memory
regions to page size and set correct offsets"), this will allow
uio_pdrv_genirq devices to expose memory regions that is not page-aligned,
requiring the users to respect the offset sysfs attribute (as implemented
in libuio).
Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/r/20200701145659.3978-4-esben@geanix.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio/uio_pdrv_genirq.c')
-rw-r--r-- | drivers/uio/uio_pdrv_genirq.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index ae319ef3a832..11e11df0daf8 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c @@ -187,8 +187,10 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) } uiomem->memtype = UIO_MEM_PHYS; - uiomem->addr = r->start; - uiomem->size = resource_size(r); + uiomem->addr = r->start & PAGE_MASK; + uiomem->offs = r->start & ~PAGE_MASK; + uiomem->size = (uiomem->offs + resource_size(r) + + PAGE_SIZE - 1) & PAGE_MASK; uiomem->name = r->name; ++uiomem; } |