Skip to content

Commit

Permalink
const: mark struct vm_struct_operations
Browse files Browse the repository at this point in the history
* mark struct vm_area_struct::vm_ops as const
* mark vm_ops in AGP code

But leave TTM code alone, something is fishy there with global vm_ops
being used.

Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and torvalds committed Sep 27, 2009
1 parent 6f50710 commit f0f37e2
Show file tree
Hide file tree
Showing 64 changed files with 83 additions and 83 deletions.
4 changes: 2 additions & 2 deletions arch/ia64/ia32/binfmt_elf32.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ ia32_install_gate_page (struct vm_area_struct *vma, struct vm_fault *vmf)
}


static struct vm_operations_struct ia32_shared_page_vm_ops = {
static const struct vm_operations_struct ia32_shared_page_vm_ops = {
.fault = ia32_install_shared_page
};

static struct vm_operations_struct ia32_gate_page_vm_ops = {
static const struct vm_operations_struct ia32_gate_page_vm_ops = {
.fault = ia32_install_gate_page
};

Expand Down
14 changes: 7 additions & 7 deletions arch/powerpc/platforms/cell/spufs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static int spufs_mem_mmap_access(struct vm_area_struct *vma,
return len;
}

static struct vm_operations_struct spufs_mem_mmap_vmops = {
static const struct vm_operations_struct spufs_mem_mmap_vmops = {
.fault = spufs_mem_mmap_fault,
.access = spufs_mem_mmap_access,
};
Expand Down Expand Up @@ -436,7 +436,7 @@ static int spufs_cntl_mmap_fault(struct vm_area_struct *vma,
return spufs_ps_fault(vma, vmf, 0x4000, SPUFS_CNTL_MAP_SIZE);
}

static struct vm_operations_struct spufs_cntl_mmap_vmops = {
static const struct vm_operations_struct spufs_cntl_mmap_vmops = {
.fault = spufs_cntl_mmap_fault,
};

Expand Down Expand Up @@ -1143,7 +1143,7 @@ spufs_signal1_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif
}

static struct vm_operations_struct spufs_signal1_mmap_vmops = {
static const struct vm_operations_struct spufs_signal1_mmap_vmops = {
.fault = spufs_signal1_mmap_fault,
};

Expand Down Expand Up @@ -1279,7 +1279,7 @@ spufs_signal2_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif
}

static struct vm_operations_struct spufs_signal2_mmap_vmops = {
static const struct vm_operations_struct spufs_signal2_mmap_vmops = {
.fault = spufs_signal2_mmap_fault,
};

Expand Down Expand Up @@ -1397,7 +1397,7 @@ spufs_mss_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return spufs_ps_fault(vma, vmf, 0x0000, SPUFS_MSS_MAP_SIZE);
}

static struct vm_operations_struct spufs_mss_mmap_vmops = {
static const struct vm_operations_struct spufs_mss_mmap_vmops = {
.fault = spufs_mss_mmap_fault,
};

Expand Down Expand Up @@ -1458,7 +1458,7 @@ spufs_psmap_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return spufs_ps_fault(vma, vmf, 0x0000, SPUFS_PS_MAP_SIZE);
}

static struct vm_operations_struct spufs_psmap_mmap_vmops = {
static const struct vm_operations_struct spufs_psmap_mmap_vmops = {
.fault = spufs_psmap_mmap_fault,
};

Expand Down Expand Up @@ -1517,7 +1517,7 @@ spufs_mfc_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return spufs_ps_fault(vma, vmf, 0x3000, SPUFS_MFC_MAP_SIZE);
}

static struct vm_operations_struct spufs_mfc_mmap_vmops = {
static const struct vm_operations_struct spufs_mfc_mmap_vmops = {
.fault = spufs_mfc_mmap_fault,
};

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/pci/i386.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void pcibios_set_master(struct pci_dev *dev)
pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
}

static struct vm_operations_struct pci_mmap_ops = {
static const struct vm_operations_struct pci_mmap_ops = {
.access = generic_access_phys,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/agp/agp.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct agp_bridge_driver {
struct agp_bridge_data {
const struct agp_version *version;
const struct agp_bridge_driver *driver;
struct vm_operations_struct *vm_ops;
const struct vm_operations_struct *vm_ops;
void *previous_size;
void *current_size;
void *dev_private_data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/agp/alpha-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static struct aper_size_info_fixed alpha_core_agp_sizes[] =
{ 0, 0, 0 }, /* filled in by alpha_core_agp_setup */
};

struct vm_operations_struct alpha_core_agp_vm_ops = {
static const struct vm_operations_struct alpha_core_agp_vm_ops = {
.fault = alpha_core_agp_vm_fault,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static inline int private_mapping_ok(struct vm_area_struct *vma)
}
#endif

static struct vm_operations_struct mmap_mem_ops = {
static const struct vm_operations_struct mmap_mem_ops = {
#ifdef CONFIG_HAVE_IOREMAP_PROT
.access = generic_access_phys
#endif
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/mspec.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ mspec_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_NOPAGE;
}

static struct vm_operations_struct mspec_vm_ops = {
static const struct vm_operations_struct mspec_vm_ops = {
.open = mspec_open,
.close = mspec_close,
.fault = mspec_fault,
Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/drm_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,28 +369,28 @@ static int drm_vm_sg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
}

/** AGP virtual memory operations */
static struct vm_operations_struct drm_vm_ops = {
static const struct vm_operations_struct drm_vm_ops = {
.fault = drm_vm_fault,
.open = drm_vm_open,
.close = drm_vm_close,
};

/** Shared virtual memory operations */
static struct vm_operations_struct drm_vm_shm_ops = {
static const struct vm_operations_struct drm_vm_shm_ops = {
.fault = drm_vm_shm_fault,
.open = drm_vm_open,
.close = drm_vm_shm_close,
};

/** DMA virtual memory operations */
static struct vm_operations_struct drm_vm_dma_ops = {
static const struct vm_operations_struct drm_vm_dma_ops = {
.fault = drm_vm_dma_fault,
.open = drm_vm_open,
.close = drm_vm_close,
};

/** Scatter-gather virtual memory operations */
static struct vm_operations_struct drm_vm_sg_ops = {
static const struct vm_operations_struct drm_vm_sg_ops = {
.fault = drm_vm_sg_fault,
.open = drm_vm_open,
.close = drm_vm_close,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/radeon/radeon_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void radeon_ttm_fini(struct radeon_device *rdev)
}

static struct vm_operations_struct radeon_ttm_vm_ops;
static struct vm_operations_struct *ttm_vm_ops = NULL;
static const struct vm_operations_struct *ttm_vm_ops = NULL;

static int radeon_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/ttm/ttm_bo_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static void ttm_bo_vm_close(struct vm_area_struct *vma)
vma->vm_private_data = NULL;
}

static struct vm_operations_struct ttm_bo_vm_ops = {
static const struct vm_operations_struct ttm_bo_vm_ops = {
.fault = ttm_bo_vm_fault,
.open = ttm_bo_vm_open,
.close = ttm_bo_vm_close
Expand Down
2 changes: 1 addition & 1 deletion drivers/ieee1394/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static int dma_region_pagefault(struct vm_area_struct *vma,
return 0;
}

static struct vm_operations_struct dma_region_vm_ops = {
static const struct vm_operations_struct dma_region_vm_ops = {
.fault = dma_region_pagefault,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ehca/ehca_uverbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static void ehca_mm_close(struct vm_area_struct *vma)
vma->vm_start, vma->vm_end, *count);
}

static struct vm_operations_struct vm_ops = {
static const struct vm_operations_struct vm_ops = {
.open = ehca_mm_open,
.close = ehca_mm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ipath/ipath_file_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ static int ipath_file_vma_fault(struct vm_area_struct *vma,
return 0;
}

static struct vm_operations_struct ipath_file_vm_ops = {
static const struct vm_operations_struct ipath_file_vm_ops = {
.fault = ipath_file_vma_fault,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ipath/ipath_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void ipath_vma_close(struct vm_area_struct *vma)
kref_put(&ip->ref, ipath_release_mmap_info);
}

static struct vm_operations_struct ipath_vm_ops = {
static const struct vm_operations_struct ipath_vm_ops = {
.open = ipath_vma_open,
.close = ipath_vma_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/cafe_ccic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ static void cafe_v4l_vm_close(struct vm_area_struct *vma)
mutex_unlock(&sbuf->cam->s_mutex);
}

static struct vm_operations_struct cafe_v4l_vm_ops = {
static const struct vm_operations_struct cafe_v4l_vm_ops = {
.open = cafe_v4l_vm_open,
.close = cafe_v4l_vm_close
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/et61x251/et61x251_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ static void et61x251_vm_close(struct vm_area_struct* vma)
}


static struct vm_operations_struct et61x251_vm_ops = {
static const struct vm_operations_struct et61x251_vm_ops = {
.open = et61x251_vm_open,
.close = et61x251_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void gspca_vm_close(struct vm_area_struct *vma)
frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_MAPPED;
}

static struct vm_operations_struct gspca_vm_ops = {
static const struct vm_operations_struct gspca_vm_ops = {
.open = gspca_vm_open,
.close = gspca_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/meye.c
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ static void meye_vm_close(struct vm_area_struct *vma)
meye.vma_use_count[idx]--;
}

static struct vm_operations_struct meye_vm_ops = {
static const struct vm_operations_struct meye_vm_ops = {
.open = meye_vm_open,
.close = meye_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/sn9c102/sn9c102_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ static void sn9c102_vm_close(struct vm_area_struct* vma)
}


static struct vm_operations_struct sn9c102_vm_ops = {
static const struct vm_operations_struct sn9c102_vm_ops = {
.open = sn9c102_vm_open,
.close = sn9c102_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/stk-webcam.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ static void stk_v4l_vm_close(struct vm_area_struct *vma)
if (sbuf->mapcount == 0)
sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_MAPPED;
}
static struct vm_operations_struct stk_v4l_vm_ops = {
static const struct vm_operations_struct stk_v4l_vm_ops = {
.open = stk_v4l_vm_open,
.close = stk_v4l_vm_close
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/uvc/uvc_v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ static void uvc_vm_close(struct vm_area_struct *vma)
buffer->vma_use_count--;
}

static struct vm_operations_struct uvc_vm_ops = {
static const struct vm_operations_struct uvc_vm_ops = {
.open = uvc_vm_open,
.close = uvc_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/videobuf-dma-contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
}
}

static struct vm_operations_struct videobuf_vm_ops = {
static const struct vm_operations_struct videobuf_vm_ops = {
.open = videobuf_vm_open,
.close = videobuf_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/videobuf-dma-sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ videobuf_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return 0;
}

static struct vm_operations_struct videobuf_vm_ops =
static const struct vm_operations_struct videobuf_vm_ops =
{
.open = videobuf_vm_open,
.close = videobuf_vm_close,
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/videobuf-vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
return;
}

static struct vm_operations_struct videobuf_vm_ops =
static const struct vm_operations_struct videobuf_vm_ops =
{
.open = videobuf_vm_open,
.close = videobuf_vm_close,
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/vino.c
Original file line number Diff line number Diff line change
Expand Up @@ -3857,7 +3857,7 @@ static void vino_vm_close(struct vm_area_struct *vma)
dprintk("vino_vm_close(): count = %d\n", fb->map_count);
}

static struct vm_operations_struct vino_vm_ops = {
static const struct vm_operations_struct vino_vm_ops = {
.open = vino_vm_open,
.close = vino_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/zc0301/zc0301_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ static void zc0301_vm_close(struct vm_area_struct* vma)
}


static struct vm_operations_struct zc0301_vm_ops = {
static const struct vm_operations_struct zc0301_vm_ops = {
.open = zc0301_vm_open,
.close = zc0301_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/zoran/zoran_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,7 @@ zoran_vm_close (struct vm_area_struct *vma)
mutex_unlock(&zr->resource_lock);
}

static struct vm_operations_struct zoran_vm_ops = {
static const struct vm_operations_struct zoran_vm_ops = {
.open = zoran_vm_open,
.close = zoran_vm_close,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/sgi-gru/grufile.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ static struct miscdevice gru_miscdev = {
.fops = &gru_fops,
};

struct vm_operations_struct gru_vm_ops = {
const struct vm_operations_struct gru_vm_ops = {
.close = gru_vma_close,
.fault = gru_fault,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/sgi-gru/grutables.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ static inline int is_kernel_context(struct gru_thread_state *gts)
*/
struct gru_unload_context_req;

extern struct vm_operations_struct gru_vm_ops;
extern const struct vm_operations_struct gru_vm_ops;
extern struct device *grudev;

extern struct gru_vma_data *gru_alloc_vma_data(struct vm_area_struct *vma,
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ sg_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_SIGBUS;
}

static struct vm_operations_struct sg_mmap_vm_ops = {
static const struct vm_operations_struct sg_mmap_vm_ops = {
.fault = sg_vma_fault,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/uio/uio.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return 0;
}

static struct vm_operations_struct uio_vm_ops = {
static const struct vm_operations_struct uio_vm_ops = {
.open = uio_vma_open,
.close = uio_vma_close,
.fault = uio_vma_fault,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/mon/mon_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return 0;
}

static struct vm_operations_struct mon_bin_vm_ops = {
static const struct vm_operations_struct mon_bin_vm_ops = {
.open = mon_bin_vma_open,
.close = mon_bin_vma_close,
.fault = mon_bin_vma_fault,
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/fb_defio.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
return 0;
}

static struct vm_operations_struct fb_deferred_io_vm_ops = {
static const struct vm_operations_struct fb_deferred_io_vm_ops = {
.fault = fb_deferred_io_fault,
.page_mkwrite = fb_deferred_io_mkwrite,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/omap/dispc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ static void mmap_user_close(struct vm_area_struct *vma)
atomic_dec(&dispc.map_count[plane]);
}

static struct vm_operations_struct mmap_user_ops = {
static const struct vm_operations_struct mmap_user_ops = {
.open = mmap_user_open,
.close = mmap_user_close,
};
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
return ret > 0 ? EIO : ret;
}

static struct vm_operations_struct btrfs_file_vm_ops = {
static const struct vm_operations_struct btrfs_file_vm_ops = {
.fault = filemap_fault,
.page_mkwrite = btrfs_page_mkwrite,
};
Expand Down
Loading

0 comments on commit f0f37e2

Please sign in to comment.