patch-2.3.43 linux/drivers/char/mem.c
Next file: linux/drivers/char/misc.c
Previous file: linux/drivers/char/lp.c
Back to the patch index
Back to the overall index
- Lines: 180
- Date:
Wed Feb 9 18:48:03 2000
- Orig file:
v2.3.42/linux/drivers/char/mem.c
- Orig date:
Fri Jan 28 15:09:07 2000
diff -u --recursive --new-file v2.3.42/linux/drivers/char/mem.c linux/drivers/char/mem.c
@@ -145,11 +145,15 @@
return do_write_mem(file, __va(p), p, buf, count, ppos);
}
+#ifndef pgprot_noncached
+
/*
* This should probably be per-architecture in <asm/pgtable.h>
*/
-static inline unsigned long pgprot_noncached(unsigned long prot)
+static inline pgprot_t pgprot_noncached(pgprot_t _prot)
{
+ unsigned long prot = pgprot_val(_prot);
+
#if defined(__i386__)
/* On PPro and successors, PCD alone doesn't always mean
uncached because of interactions with the MTRRs. PCD | PWT
@@ -173,9 +177,11 @@
prot &= ~(L_PTE_CACHEABLE | L_PTE_BUFFERABLE);
#endif
- return prot;
+ return __pgprot(prot);
}
+#endif /* !pgprot_noncached */
+
/*
* Architectures vary in how they handle caching for addresses
* outside of main memory.
@@ -208,8 +214,7 @@
* done non-cached.
*/
if (noncached_address(offset) || (file->f_flags & O_SYNC))
- pgprot_val(vma->vm_page_prot)
- = pgprot_noncached(pgprot_val(vma->vm_page_prot));
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
/*
* Don't dump addresses that are not real memory to a core file.
@@ -486,87 +491,47 @@
#define open_kmem open_mem
static struct file_operations mem_fops = {
- memory_lseek,
- read_mem,
- write_mem,
- NULL, /* mem_readdir */
- NULL, /* mem_poll */
- NULL, /* mem_ioctl */
- mmap_mem,
- open_mem,
- NULL, /* flush */
- NULL, /* no special release code */
- NULL /* fsync */
+ llseek: memory_lseek,
+ read: read_mem,
+ write: write_mem,
+ mmap: mmap_mem,
+ open: open_mem,
};
static struct file_operations kmem_fops = {
- memory_lseek,
- read_kmem,
- write_kmem,
- NULL, /* kmem_readdir */
- NULL, /* kmem_poll */
- NULL, /* kmem_ioctl */
- mmap_kmem,
- open_kmem,
- NULL, /* flush */
- NULL, /* no special release code */
- NULL /* fsync */
+ llseek: memory_lseek,
+ read: read_kmem,
+ write: write_kmem,
+ mmap: mmap_kmem,
+ open: open_kmem,
};
static struct file_operations null_fops = {
- null_lseek,
- read_null,
- write_null,
- NULL, /* null_readdir */
- NULL, /* null_poll */
- NULL, /* null_ioctl */
- NULL, /* null_mmap */
- NULL, /* no special open code */
- NULL, /* flush */
- NULL, /* no special release code */
- NULL /* fsync */
+ llseek: null_lseek,
+ read: read_null,
+ write: write_null,
};
#if !defined(CONFIG_PPC) && !defined(__mc68000__)
static struct file_operations port_fops = {
- memory_lseek,
- read_port,
- write_port,
- NULL, /* port_readdir */
- NULL, /* port_poll */
- NULL, /* port_ioctl */
- NULL, /* port_mmap */
- open_port,
- NULL, /* flush */
- NULL, /* no special release code */
- NULL /* fsync */
+ llseek: memory_lseek,
+ read: read_port,
+ write: write_port,
+ open: open_port,
};
#endif
static struct file_operations zero_fops = {
- zero_lseek,
- read_zero,
- write_zero,
- NULL, /* zero_readdir */
- NULL, /* zero_poll */
- NULL, /* zero_ioctl */
- mmap_zero,
- NULL, /* no special open code */
- NULL, /* flush */
- NULL /* no special release code */
+ llseek: zero_lseek,
+ read: read_zero,
+ write: write_zero,
+ mmap: mmap_zero,
};
static struct file_operations full_fops = {
- full_lseek,
- read_full,
- write_full,
- NULL, /* full_readdir */
- NULL, /* full_poll */
- NULL, /* full_ioctl */
- NULL, /* full_mmap */
- NULL, /* no special open code */
- NULL, /* flush */
- NULL /* no special release code */
+ llseek: full_lseek,
+ read: read_full,
+ write: write_full,
};
static int memory_open(struct inode * inode, struct file * filp)
@@ -607,17 +572,7 @@
}
static struct file_operations memory_fops = {
- NULL, /* lseek */
- NULL, /* read */
- NULL, /* write */
- NULL, /* readdir */
- NULL, /* poll */
- NULL, /* ioctl */
- NULL, /* mmap */
- memory_open, /* just a selector for the real open */
- NULL, /* flush */
- NULL, /* release */
- NULL /* fsync */
+ open: memory_open, /* just a selector for the real open */
};
int __init chr_dev_init(void)
@@ -630,7 +585,7 @@
usb_init();
#endif
#ifdef CONFIG_I2C
- i2c_init_all();
+ i2c_init_all();
#endif
#if defined (CONFIG_FB)
fbmem_init();
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)