#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/fs.h>
+
#include <asm/uaccess.h>
#include <asm/sections.h>
#include <asm/prom.h>
static unsigned long anslcd_short_delay = 80;
static unsigned long anslcd_long_delay = 3280;
-static volatile unsigned char* anslcd_ptr;
+static volatile unsigned char __iomem *anslcd_ptr;
#undef DEBUG
-static void __pmac
+static void
anslcd_write_byte_ctrl ( unsigned char c )
{
#ifdef DEBUG
}
}
-static void __pmac
+static void
anslcd_write_byte_data ( unsigned char c )
{
out_8(anslcd_ptr + ANSLCD_DATA_IX, c);
udelay(anslcd_short_delay);
}
-static ssize_t __pmac
-anslcd_write( struct file * file, const char * buf,
+static ssize_t
+anslcd_write( struct file * file, const char __user * buf,
size_t count, loff_t *ppos )
{
- const char * p = buf;
+ const char __user *p = buf;
int i;
#ifdef DEBUG
printk(KERN_DEBUG "LCD: write\n");
#endif
- if ( verify_area(VERIFY_READ, buf, count) )
+ if (!access_ok(VERIFY_READ, buf, count))
return -EFAULT;
for ( i = *ppos; count > 0; ++i, ++p, --count )
{
return p - buf;
}
-static int __pmac
+static int
anslcd_ioctl( struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg )
{
- char ch, *temp;
+ char ch, __user *temp;
#ifdef DEBUG
printk(KERN_DEBUG "LCD: ioctl(%d,%d)\n",cmd,arg);
anslcd_write_byte_ctrl ( 0x02 );
return 0;
case ANSLCD_SENDCTRL:
- temp = (char *) arg;
+ temp = (char __user *) arg;
__get_user(ch, temp);
for (; ch; temp++) { /* FIXME: This is ugly, but should work, as a \0 byte is not a valid command code */
anslcd_write_byte_ctrl ( ch );
}
}
-static int __pmac
+static int
anslcd_open( struct inode * inode, struct file * file )
{
return 0;
"* Welcome to *" /* Line #2 */
"********************"; /* Line #4 */
-int __init
+static int __init
anslcd_init(void)
{
int a;
if (strcmp(node->parent->name, "gc"))
return -ENODEV;
- anslcd_ptr = (volatile unsigned char*)ioremap(ANSLCD_ADDR, 0x20);
+ anslcd_ptr = ioremap(ANSLCD_ADDR, 0x20);
retval = misc_register(&anslcd_dev);
if(retval < 0){
return 0;
}
-__initcall(anslcd_init);
+static void __exit
+anslcd_exit(void)
+{
+ misc_deregister(&anslcd_dev);
+ iounmap(anslcd_ptr);
+}
+module_init(anslcd_init);
+module_exit(anslcd_exit);