Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH] fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
@ 2026-06-11  3:52 Chintan Patel
  2026-06-12 21:33 ` Helge Deller
  0 siblings, 1 reply; 3+ messages in thread
From: Chintan Patel @ 2026-06-11  3:52 UTC (permalink / raw)
  To: linux; +Cc: deller, tzimmermann, linux-fbdev, dri-devel, Chintan Patel

Claim the memory resource associated with the Cyber2000 SPARC MMIO
aperture before accessing it.

This is part of the effort to request memory regions in fbdev drivers.

Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
 drivers/video/fbdev/cyber2000fb.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c
index 2d12f8e96c7e..16ed56180ce2 100644
--- a/drivers/video/fbdev/cyber2000fb.c
+++ b/drivers/video/fbdev/cyber2000fb.c
@@ -47,6 +47,7 @@
 #include <linux/io.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+#include <linux/ioport.h>
 
 #ifdef __arm__
 #include <asm/mach-types.h>
@@ -1620,9 +1621,14 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
 	 */
 	unsigned char __iomem *iop;
 
+	if (!request_mem_region(0x3000000, 0x5000, "cyber2000fb iop")) {
+		printk(KERN_ERR "iga5000: cannot reserve I/O area 0x3000000\n");
+		return -EBUSY;
+	}
 	iop = ioremap(0x3000000, 0x5000);
 	if (iop == NULL) {
 		printk(KERN_ERR "iga5000: cannot map I/O\n");
+		release_mem_region(0x3000000, 0x5000);
 		return -ENOMEM;
 	}
 
@@ -1633,6 +1639,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
 	writeb(EXT_BIU_MISC_LIN_ENABLE, iop + 0x3cf);
 
 	iounmap(iop);
+	release_mem_region(0x3000000, 0x5000);
 #else
 	/*
 	 * Most other machine types are "normal", so
-- 
2.43.0


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

* Re: [PATCH] fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
  2026-06-11  3:52 [PATCH] fbdev: claim Cyber2000 SPARC I/O aperture before ioremap Chintan Patel
@ 2026-06-12 21:33 ` Helge Deller
  2026-06-13  2:28   ` Chintan Patel
  0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2026-06-12 21:33 UTC (permalink / raw)
  To: Chintan Patel; +Cc: linux-fbdev, dri-devel, linux

On 6/11/26 05:52, Chintan Patel wrote:
> Claim the memory resource associated with the Cyber2000 SPARC MMIO
> aperture before accessing it.
> 
> This is part of the effort to request memory regions in fbdev drivers.
> 
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
> ---
>   drivers/video/fbdev/cyber2000fb.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c
> index 2d12f8e96c7e..16ed56180ce2 100644
> --- a/drivers/video/fbdev/cyber2000fb.c
> +++ b/drivers/video/fbdev/cyber2000fb.c
> @@ -47,6 +47,7 @@
>   #include <linux/io.h>
>   #include <linux/i2c.h>
>   #include <linux/i2c-algo-bit.h>
> +#include <linux/ioport.h>
>   
>   #ifdef __arm__
>   #include <asm/mach-types.h>
> @@ -1620,9 +1621,14 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
>   	 */
>   	unsigned char __iomem *iop;
>   
> +	if (!request_mem_region(0x3000000, 0x5000, "cyber2000fb iop")) {
> +		printk(KERN_ERR "iga5000: cannot reserve I/O area 0x3000000\n");

pci_err() or pr_err() please.

> +		return -EBUSY;
> +	}
>   	iop = ioremap(0x3000000, 0x5000);
>   	if (iop == NULL) {
>   		printk(KERN_ERR "iga5000: cannot map I/O\n");

while at it, use pci_err() here too then.

Helge

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

* Re: [PATCH] fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
  2026-06-12 21:33 ` Helge Deller
@ 2026-06-13  2:28   ` Chintan Patel
  0 siblings, 0 replies; 3+ messages in thread
From: Chintan Patel @ 2026-06-13  2:28 UTC (permalink / raw)
  To: Helge Deller; +Cc: linux-fbdev, dri-devel, linux


>>        */
>>       unsigned char __iomem *iop;
>> +    if (!request_mem_region(0x3000000, 0x5000, "cyber2000fb iop")) {
>> +        printk(KERN_ERR "iga5000: cannot reserve I/O area 0x3000000\n");
> 
> pci_err() or pr_err() please.
> 
>> +        return -EBUSY;
>> +    }
>>       iop = ioremap(0x3000000, 0x5000);
>>       if (iop == NULL) {
>>           printk(KERN_ERR "iga5000: cannot map I/O\n");
> 
> while at it, use pci_err() here too then.
> 
> Helge

Hi Helge,

I initially left the existing printk() usage unchanged to keep the patch
focused on the memory resource reservation change and avoid unrelated
churn. Since you've suggested updating the error reporting as well, I'll
switch both messages to pci_err() in v2.

Thanks for the review.

Regards,
Chintan

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

end of thread, other threads:[~2026-06-13  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11  3:52 [PATCH] fbdev: claim Cyber2000 SPARC I/O aperture before ioremap Chintan Patel
2026-06-12 21:33 ` Helge Deller
2026-06-13  2:28   ` Chintan Patel

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