fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
Subsystems (2)
PATCH v2 1/1 fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
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.
---
v2:
- Use pci_err() for error reporting instead of printk().
drivers/video/fbdev/cyber2000fb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/video/fbdev/cyber2000fb.c +8 -1
@@ -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" )) { +pci_err (cfb->dev,"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" ); +pci_err (cfb->dev,"cannot map I/O area\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
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Compilation error on SPARC due to referencing a non-existent 'dev' member in 'struct cfb_info' and…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Compilation error on SPARC due to referencing a non-existent 'dev' member in 'struct cfb_info' and incorrect macro usage. --
commit e068b9e9c10bca9b6d3e0df275aaabe32f0555c2
Author: Chintan Patel <[email protected]>
fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
This commit claims the memory resource associated with the Cyber2000 SPARC MMIO aperture before accessing it. It adds calls to request memory regions and attempts to update the error logging.
Quoted 4 lines
drivers/video/fbdev/cyber2000fb.c +0
-0
[ ... ]
drivers/video/fbdev/cyber2000fb.c static int cyberpro_pci_enable_mmio(struct cfb_info *cfb) · line 1625
Quoted 6 lines
drivers/video/fbdev/cyber2000fb.c +2
-0@@ -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" )) { +pci_err (cfb->dev,"cannot reserve I/O area 0x3000000\n" );
[Severity: Low]
Does struct cfb_info have a member named dev? It appears this might cause a build failure on SPARC architectures when compiling cyberpro_pci_enable_mmio due to referencing a non-existent field.
Additionally, does pci_err() expect a struct pci_dev pointer as its first argument rather than a standard struct device pointer?
drivers/video/fbdev/cyber2000fb.c static int cyberpro_pci_enable_mmio(struct cfb_info *cfb) · line 1630
Quoted 6 lines
drivers/video/fbdev/cyber2000fb.c +3
-1+return -EBUSY ; + } iop =ioremap (0x3000000 ,0x5000 );if (iop ==NULL ) { -printk (KERN_ERR "iga5000: cannot map I/O\n" ); +pci_err (cfb->dev,"cannot map I/O area\n" );
[Severity: Low]
This looks like it will encounter the same compilation issue with cfb->dev as the error path above.
Quoted 3 lines
drivers/video/fbdev/cyber2000fb.c +1
-0+release_mem_region (0x3000000 ,0x5000 );return -ENOMEM ; }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1