patch-2.3.99-pre7 linux/drivers/video/clgenfb.c

Next file: linux/drivers/video/fbcon.c
Previous file: linux/drivers/video/aty128fb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre6/linux/drivers/video/clgenfb.c linux/drivers/video/clgenfb.c
@@ -1,7 +1,7 @@
 /*
  * drivers/video/clgenfb.c - driver for Cirrus Logic chipsets
  *
- * Copyright 1999 Jeff Garzik <jgarzik@mandrakesoft.com>
+ * Copyright 1999,2000 Jeff Garzik <jgarzik@mandrakesoft.com>
  *
  * Contributors (thanks, all!)
  *
@@ -31,9 +31,10 @@
  *
  */
 
-#define CLGEN_VERSION "1.9.4.5"
+#define CLGEN_VERSION "1.9.6"
 
 #include <linux/config.h>
+#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -73,27 +74,6 @@
 
 /*****************************************************************
  *
- * compatibility with older kernel versions
- *
- */
-
-#ifndef LINUX_VERSION_CODE
-#include <linux/version.h>
-#endif
-
-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
-#endif
-
-#ifndef PCI_DEVICE_ID_CIRRUS_5462
-#define PCI_DEVICE_ID_CIRRUS_5462      0x00d0
-#endif
-
-
-
-
-/*****************************************************************
- *
  * debugging and utility macros
  *
  */
@@ -139,8 +119,6 @@
 #define MAX_NUM_BOARDS 7
 
 
-
-
 /*****************************************************************
  *
  * chipset information
@@ -161,7 +139,6 @@
 } clgen_board_t;
 
 
-
 /*
  * per-board-type information, used for enumerating and abstracting
  * chip-specific information
@@ -311,7 +288,6 @@
 #endif /* CONFIG_PCI */
 
 
-
 #ifdef CONFIG_ZORRO
 static const struct {
 	clgen_board_t btype;
@@ -495,10 +471,6 @@
 int clgenfb_init (void);
 int clgenfb_setup (char *options);
 
-#ifdef MODULE
-static void clgenfb_cleanup (struct clgenfb_info *info);
-#endif
-
 static int clgenfb_open (struct fb_info *info, int user);
 static int clgenfb_release (struct fb_info *info, int user);
 static int clgenfb_ioctl (struct inode *inode, struct file *file,
@@ -2592,7 +2564,10 @@
 	iounmap (info->fbmem);
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,13)
 	release_mem_region(info->fbmem_phys, info->size);
+
+#if 0 /* if system didn't claim this region, we would... */
 	release_mem_region(0xA0000, 65535);
+#endif
 	if (release_io_ports)
 		release_region(0x3C0, 32);
 #endif
@@ -2678,17 +2653,19 @@
 
 	if (!request_mem_region(board_addr, board_size, "clgenfb")) {
 		pci_write_config_word (pdev, PCI_COMMAND, tmp16);
-		printk(KERN_ERR "clgen: cannot reserve region 0x%lu, abort\n",
+		printk(KERN_ERR "clgen: cannot reserve region 0x%lx, abort\n",
 		       board_addr);
 		return -1;
 	}
+#if 0 /* if the system didn't claim this region, we would... */
 	if (!request_mem_region(0xA0000, 65535, "clgenfb")) {
 		pci_write_config_word (pdev, PCI_COMMAND, tmp16);
-		printk(KERN_ERR "clgen: cannot reserve region 0x%lu, abort\n",
+		printk(KERN_ERR "clgen: cannot reserve region 0x%lx, abort\n",
 		       0xA0000L);
 		release_mem_region(board_addr, board_size);
 		return -1;
 	}
+#endif
 	if (request_region(0x3C0, 32, "clgenfb"))
 		release_io_ports = 1;
 
@@ -2784,7 +2761,7 @@
 	info->board_size = board_size = z->resource.end-z->resource.start+1;
 
 	if (!request_mem_region(board_addr, board_size, "clgenfb")) {
-		printk(KERN_ERR "clgen: cannot reserve region 0x%lu, abort\n",
+		printk(KERN_ERR "clgen: cannot reserve region 0x%lx, abort\n",
 		       board_addr);
 		return -1;
 	}
@@ -2932,25 +2909,15 @@
 #if defined(CONFIG_FB_OF)
 int __init clgen_of_init (struct device_node *dp)
 {
-	int rc;
-	
-	DPRINTK ("ENTER\n");
-
-	rc = clgenfb_init ();
-
-	DPRINTK ("EXIT, returning %d\n", rc);
-
-	return rc;
+	return clgenfb_init ();
 }
 #endif				/* CONFIG_FB_OF */
 
 
-
     /*
      *  Cleanup (only needed for module)
      */
-#ifdef MODULE
-static void clgenfb_cleanup (struct clgenfb_info *info)
+static void __exit clgenfb_cleanup (struct clgenfb_info *info)
 {
 	DPRINTK ("ENTER\n");
 
@@ -2967,9 +2934,6 @@
 
 	DPRINTK ("EXIT\n");
 }
-#endif
-
-
 
 
 #ifndef MODULE
@@ -2999,33 +2963,14 @@
 #endif
 
 
-
-
-
     /*
      *  Modularization
      */
 
-#ifdef MODULE
-MODULE_AUTHOR("Copyright 1999 Jeff Garzik <jgarzik@mandrakesoft.com>");
+MODULE_AUTHOR("Copyright 1999,2000 Jeff Garzik <jgarzik@mandrakesoft.com>");
 MODULE_DESCRIPTION("Accelerated FBDev driver for Cirrus Logic chips");
 
-int init_module (void)
-{
-#if defined(CONFIG_FB_OF)
-/* Nothing to do, must be called from offb */
-	return 0;
-#else
-	int i;
-	
-	DPRINTK ("ENTER\n");
-	i = clgenfb_init ();
-	DPRINTK ("EXIT\n");
-	return i;
-#endif
-}
-
-void cleanup_module (void)
+static void __exit clgenfb_exit (void)
 {
 	DPRINTK ("ENTER\n");
 
@@ -3034,7 +2979,10 @@
 	DPRINTK ("EXIT\n");
 }
 
-#endif				/* MODULE */
+#ifdef MODULE
+module_init(clgenfb_init);
+#endif
+module_exit(clgenfb_exit);
 
 
 /**********************************************************************/
@@ -3144,7 +3092,6 @@
 }
 
 
-
 /*** WSFR() - write to the "special function register" (SFR) ***/
 static void WSFR (struct clgenfb_info *fb_info, unsigned char val)
 {
@@ -3193,7 +3140,6 @@
 }
 
 
-
 #if 0
 /*** RClut - read CLUT entry (range 0..63) ***/
 static void RClut (struct clgenfb_info *fb_info, unsigned char regnum, unsigned char *red,
@@ -3322,6 +3268,7 @@
 	DPRINTK ("EXIT\n");
 }
 
+
 /*******************************************************************
 	clgen_RectFill()
 
@@ -3402,6 +3349,7 @@
 	DPRINTK ("EXIT\n");
 }
 
+
 /**************************************************************************
  * bestclock() - determine closest possible clock lower(?) than the
  * desired pixel clock
@@ -3478,10 +3426,6 @@
 }
 
 
-
-
-
-
 /* -------------------------------------------------------------------------
  *
  * debugging functions
@@ -3518,7 +3462,6 @@
 }
 
 
-
 /**
  * clgen_dbg_print_regs
  * @base: If using newmmio, the newmmio base address, otherwise %NULL
@@ -3566,9 +3509,6 @@
 }
 
 
-
-
-
 /**
  * clgen_dump
  * @clgeninfo:
@@ -3583,7 +3523,6 @@
 }
 
 
-
 /**
  * clgen_dbg_reg_dump
  * @base: If using newmmio, the newmmio base address, otherwise %NULL
@@ -3685,5 +3624,5 @@
 	DPRINTK ("\n");
 }
 
-
 #endif				/* CLGEN_DEBUG */
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)