patch-2.1.63 linux/drivers/char/pcwd.c

Next file: linux/drivers/char/radio.c
Previous file: linux/drivers/char/nvram.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.62/linux/drivers/char/pcwd.c linux/drivers/char/pcwd.c
@@ -29,6 +29,7 @@
  * 961118	Changed some verbiage on some of the output, tidied up
  *		code bits, and added compatibility to 2.1.x.
  * 970912       Enabled board on open and disable on close.
+ * 971107       Took account of recent VFS changes (broke read).
  */
 
 #include <linux/module.h>
@@ -222,7 +223,7 @@
 }
 
 static int pcwd_ioctl(struct inode *inode, struct file *file,
-	unsigned int cmd, unsigned long arg)
+		      unsigned int cmd, unsigned long arg)
 {
 	int i, cdat, rv;
 	static struct watchdog_info ident=
@@ -359,8 +360,12 @@
 	return 0;
 }
 
-static long pcwd_write(struct inode *inode, struct file *file, const char *buf, unsigned long len)
+static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
+			  loff_t *ppos)
 {
+	/*  Can't seek (pwrite) on this device  */
+	if (ppos != &file->f_pos)
+		return -ESPIPE;
 	if (len)
 	{
 		pcwd_send_heartbeat();
@@ -381,13 +386,16 @@
 	return(0);
 }
 
-static long pcwd_read(struct inode *inode, struct file *file, char *buf,
-	unsigned long count)
+static ssize_t pcwd_read(struct file *file, char *buf, size_t count,
+			 loff_t *ppos)
 {
 	unsigned short c = inb(current_readport);
 	unsigned char cp;
 
-	switch(MINOR(inode->i_rdev)) 
+	/*  Can't seek (pread) on this device  */
+	if (ppos != &file->f_pos)
+		return -ESPIPE;
+	switch(MINOR(file->f_dentry->d_inode->i_rdev)) 
 	{
 		case TEMP_MINOR:
 			cp = c;
@@ -489,11 +497,16 @@
 	pcwd_read,	/* Read */
 	pcwd_write,	/* Write */
 	NULL,		/* Readdir */
-	NULL,		/* Select */
+	NULL,		/* Poll */
 	pcwd_ioctl,	/* IOctl */
 	NULL,		/* MMAP */
 	pcwd_open,	/* Open */
-	pcwd_close	/* Close */
+	pcwd_close,	/* Release */
+	NULL,           /* Fsync */
+	NULL,           /* Fasync */
+	NULL,           /* CheckMediaChange */
+	NULL,           /* Revalidate */
+	NULL,           /* Lock */
 };
 
 static struct miscdevice pcwd_miscdev = {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov