Rikard Falkeborn
2021-Feb-09 23:48 UTC
[Nouveau] [PATCH 0/3] drm/ttm: constify static vm_operations_structs
Constify a few static vm_operations_struct that are never modified. Their only usage is to assign their address to the vm_ops field in the vm_area_struct, which is a pointer to const vm_operations_struct. Make them const to allow the compiler to put them in read-only memory. With this series applied, all static struct vm_operations_struct in the kernel tree are const. Rikard Falkeborn (3): drm/amdgpu/ttm: constify static vm_operations_struct drm/radeon/ttm: constify static vm_operations_struct drm/nouveau/ttm: constify static vm_operations_struct drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.30.0
Rikard Falkeborn
2021-Feb-09 23:48 UTC
[Nouveau] [PATCH 1/3] drm/amdgpu/ttm: constify static vm_operations_struct
The only usage of amdgpu_ttm_vm_ops is to assign its address to the vm_ops field in the vm_area_struct struct. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 29cfb0809634..a785acc09f20 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -2002,7 +2002,7 @@ static vm_fault_t amdgpu_ttm_fault(struct vm_fault *vmf) return ret; } -static struct vm_operations_struct amdgpu_ttm_vm_ops = { +static const struct vm_operations_struct amdgpu_ttm_vm_ops = { .fault = amdgpu_ttm_fault, .open = ttm_bo_vm_open, .close = ttm_bo_vm_close, -- 2.30.0
Rikard Falkeborn
2021-Feb-09 23:48 UTC
[Nouveau] [PATCH 2/3] drm/radeon/ttm: constify static vm_operations_struct
The only usage of radeon_ttm_vm_ops is to assign its address to the vm_ops field in the vm_area_struct struct. Make it const to allow the compiler to put it in read-only memory Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com> --- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index c45e919e03c5..5fc8bae401af 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -835,7 +835,7 @@ static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf) return ret; } -static struct vm_operations_struct radeon_ttm_vm_ops = { +static const struct vm_operations_struct radeon_ttm_vm_ops = { .fault = radeon_ttm_fault, .open = ttm_bo_vm_open, .close = ttm_bo_vm_close, -- 2.30.0
Rikard Falkeborn
2021-Feb-09 23:48 UTC
[Nouveau] [PATCH 3/3] drm/nouveau/ttm: constify static vm_operations_struct
The only usage of nouveau_ttm_vm_ops is to assign its address to the vm_ops field in the vm_area_struct struct. Make it const to allow the compiler to put it in read-only memory Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com> --- drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index 495288182c2d..b81ae90b8449 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c @@ -154,7 +154,7 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf) return ret; } -static struct vm_operations_struct nouveau_ttm_vm_ops = { +static const struct vm_operations_struct nouveau_ttm_vm_ops = { .fault = nouveau_ttm_fault, .open = ttm_bo_vm_open, .close = ttm_bo_vm_close, -- 2.30.0
Christian König
2021-Feb-10 07:45 UTC
[Nouveau] [PATCH 0/3] drm/ttm: constify static vm_operations_structs
Reviewed-by: Christian K?nig <christian.koenig at amd.com> for the series. Am 10.02.21 um 00:48 schrieb Rikard Falkeborn:> Constify a few static vm_operations_struct that are never modified. Their > only usage is to assign their address to the vm_ops field in the > vm_area_struct, which is a pointer to const vm_operations_struct. Make them > const to allow the compiler to put them in read-only memory. > > With this series applied, all static struct vm_operations_struct in the > kernel tree are const. > > Rikard Falkeborn (3): > drm/amdgpu/ttm: constify static vm_operations_struct > drm/radeon/ttm: constify static vm_operations_struct > drm/nouveau/ttm: constify static vm_operations_struct > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- > drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +- > drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) >