From: Aivils S. <ai...@us...> - 2004-04-30 09:43:39
|
Update of /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/pci In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29648/ruby-2.6/drivers/pci Modified Files: proc.c Log Message: uh back to 2.6.5 Index: proc.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/pci/proc.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- proc.c 30 Apr 2004 09:32:47 -0000 1.3 +++ proc.c 30 Apr 2004 09:43:28 -0000 1.4 @@ -16,13 +16,15 @@ #include <asm/uaccess.h> #include <asm/byteorder.h> +#define PCI_CFG_SPACE_SIZE 256 + static int proc_initialized; /* = 0 */ //from xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h -#define PCI_CMD_STAT_REG 0x04 -#define PCI_CMD_IO_ENABLE 0x01 -#define PCI_CMD_MEM_ENABLE 0x02 -#define PCI_CMD_MASTER_ENABLE 0x04 +#define PCI_CMD_STAT_REG 0x04 +#define PCI_CMD_IO_ENABLE 0x01 +#define PCI_CMD_MEM_ENABLE 0x02 +#define PCI_CMD_MASTER_ENABLE 0x04 static int pci_hackvideo=0; @@ -30,9 +32,8 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) { loff_t new = -1; - struct inode *inode = file->f_dentry->d_inode; - down(&inode->i_sem); + down(&file->f_dentry->d_inode->i_sem); switch (whence) { case 0: new = off; @@ -41,15 +42,15 @@ new = file->f_pos + off; break; case 2: - new = inode->i_size + off; + new = PCI_CFG_SPACE_SIZE + off; break; } - if (new < 0 || new > inode->i_size) - new = -EINVAL; - else - file->f_pos = new; - up(&inode->i_sem); - return new; + if (new < 0 || new > PCI_CFG_SPACE_SIZE) + new = -EINVAL; + else + file->f_pos = new; + up(&file->f_dentry->d_inode->i_sem); + return new; } static ssize_t @@ -68,7 +69,7 @@ */ if (capable(CAP_SYS_ADMIN)) - size = dev->cfg_size; + size = PCI_CFG_SPACE_SIZE; else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) size = 128; else @@ -141,21 +142,20 @@ const struct proc_dir_entry *dp = PDE(ino); struct pci_dev *dev = dp->data; int pos = *ppos; - int size = dev->cfg_size; int cnt; - if (pci_hackvideo && (pos == PCI_CMD_STAT_REG) && - (buf[0] <= PCI_CMD_MASTER_ENABLE) && - ((dev->class>>8) == 0x0300 || - (dev->class>>8) == 0x0400 || - (dev->class>>8) == 0x0000 ) ) - return -EINVAL; - if (pos >= size) + if (pci_hackvideo && (pos == PCI_CMD_STAT_REG) && + (buf[0] <= PCI_CMD_MASTER_ENABLE) && + ((dev->class>>8) == 0x0300 || + (dev->class>>8) == 0x0400 || + (dev->class>>8) == 0x0000 ) ) + return -EINVAL; + if (pos >= PCI_CFG_SPACE_SIZE) return 0; - if (nbytes >= size) - nbytes = size; - if (pos + nbytes > size) - nbytes = size - pos; + if (nbytes >= PCI_CFG_SPACE_SIZE) + nbytes = PCI_CFG_SPACE_SIZE; + if (pos + nbytes > PCI_CFG_SPACE_SIZE) + nbytes = PCI_CFG_SPACE_SIZE - pos; cnt = nbytes; if (!access_ok(VERIFY_READ, buf, cnt)) @@ -417,7 +417,7 @@ return -ENOMEM; e->proc_fops = &proc_bus_pci_operations; e->data = dev; - e->size = dev->cfg_size; + e->size = PCI_CFG_SPACE_SIZE; return 0; } |