mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] uio: uio_pdrv_genirq: Fixes and support for non-page-aligned memory
@ 2020-07-01 14:56 Esben Haabendal
  2020-07-01 14:56 ` [PATCH 1/3] uio_pdrv_genirq: Remove warning when irq is not specified Esben Haabendal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Esben Haabendal @ 2020-07-01 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

This series inlcudes two fixes for issues when using uio_pdrv_genirq
without device tree, and support for using uio_pdrv_genirq with
non-page-aligned memory resources.

Esben Haabendal (3):
  uio_pdrv_genirq: Remove warning when irq is not specified
  uio_pdrv_genirq: fix use without device tree and no interrupt
  uio_pdrv_genirq: Allow use with non-page-aligned memory resources

 drivers/uio/uio_pdrv_genirq.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

-- 
2.4.11


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] uio_pdrv_genirq: Remove warning when irq is not specified
  2020-07-01 14:56 [PATCH 0/3] uio: uio_pdrv_genirq: Fixes and support for non-page-aligned memory Esben Haabendal
@ 2020-07-01 14:56 ` Esben Haabendal
  2020-07-01 14:56 ` [PATCH 2/3] uio_pdrv_genirq: fix use without device tree and no interrupt Esben Haabendal
  2020-07-01 14:56 ` [PATCH 3/3] uio_pdrv_genirq: Allow use with non-page-aligned memory resources Esben Haabendal
  2 siblings, 0 replies; 4+ messages in thread
From: Esben Haabendal @ 2020-07-01 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, stable

Since e3a3c3a20555 ("UIO: fix uio_pdrv_genirq with device tree but no
interrupt"), the uio_pdrv_genirq has supported use without interrupt,
so the change in 7723f4c5ecdb ("driver core: platform: Add an error
message to") added false warnings for those cases.

Fixes: 7723f4c5ecdb ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Esben Haabendal <esben@geanix.com>
Cc: stable@vger.kernel.org
---
 drivers/uio/uio_pdrv_genirq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index ae319ef3a832..1d69dd49c6d2 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -159,7 +159,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 	priv->pdev = pdev;
 
 	if (!uioinfo->irq) {
-		ret = platform_get_irq(pdev, 0);
+		ret = platform_get_irq_optional(pdev, 0);
 		uioinfo->irq = ret;
 		if (ret == -ENXIO && pdev->dev.of_node)
 			uioinfo->irq = UIO_IRQ_NONE;
-- 
2.4.11


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] uio_pdrv_genirq: fix use without device tree and no interrupt
  2020-07-01 14:56 [PATCH 0/3] uio: uio_pdrv_genirq: Fixes and support for non-page-aligned memory Esben Haabendal
  2020-07-01 14:56 ` [PATCH 1/3] uio_pdrv_genirq: Remove warning when irq is not specified Esben Haabendal
@ 2020-07-01 14:56 ` Esben Haabendal
  2020-07-01 14:56 ` [PATCH 3/3] uio_pdrv_genirq: Allow use with non-page-aligned memory resources Esben Haabendal
  2 siblings, 0 replies; 4+ messages in thread
From: Esben Haabendal @ 2020-07-01 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, stable

While e3a3c3a20555 ("UIO: fix uio_pdrv_genirq with device tree but no
interrupt") added support for using uio_pdrv_genirq for devices without
interrupt for device tree platforms, the removal of uio_pdrv in
26dac3c49d56 ("uio: Remove uio_pdrv and use uio_pdrv_genirq instead")
broke the support for non device tree platforms.

This change fixes this, so that uio_pdrv_genirq can be used without
interrupt on all platforms.

This still leaves the support that uio_pdrv had for custom interrupt
handler lacking, as uio_pdrv_genirq does not handle it (yet).

Fixes: 26dac3c49d56 ("uio: Remove uio_pdrv and use uio_pdrv_genirq instead")
Signed-off-by: Esben Haabendal <esben@geanix.com>
Cc: stable@vger.kernel.org
---
 drivers/uio/uio_pdrv_genirq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index 1d69dd49c6d2..b60173bc93ce 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -161,7 +161,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 	if (!uioinfo->irq) {
 		ret = platform_get_irq_optional(pdev, 0);
 		uioinfo->irq = ret;
-		if (ret == -ENXIO && pdev->dev.of_node)
+		if (ret == -ENXIO)
 			uioinfo->irq = UIO_IRQ_NONE;
 		else if (ret == -EPROBE_DEFER)
 			return ret;
-- 
2.4.11


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] uio_pdrv_genirq: Allow use with non-page-aligned memory resources
  2020-07-01 14:56 [PATCH 0/3] uio: uio_pdrv_genirq: Fixes and support for non-page-aligned memory Esben Haabendal
  2020-07-01 14:56 ` [PATCH 1/3] uio_pdrv_genirq: Remove warning when irq is not specified Esben Haabendal
  2020-07-01 14:56 ` [PATCH 2/3] uio_pdrv_genirq: fix use without device tree and no interrupt Esben Haabendal
@ 2020-07-01 14:56 ` Esben Haabendal
  2 siblings, 0 replies; 4+ messages in thread
From: Esben Haabendal @ 2020-07-01 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

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>
---
 drivers/uio/uio_pdrv_genirq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index b60173bc93ce..86f75a4fe0e3 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;
 	}
-- 
2.4.11


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-01 15:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 14:56 [PATCH 0/3] uio: uio_pdrv_genirq: Fixes and support for non-page-aligned memory Esben Haabendal
2020-07-01 14:56 ` [PATCH 1/3] uio_pdrv_genirq: Remove warning when irq is not specified Esben Haabendal
2020-07-01 14:56 ` [PATCH 2/3] uio_pdrv_genirq: fix use without device tree and no interrupt Esben Haabendal
2020-07-01 14:56 ` [PATCH 3/3] uio_pdrv_genirq: Allow use with non-page-aligned memory resources Esben Haabendal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®