From: Ville Syrjälä Date: Wed, 21 Dec 2011 00:01:33 +0000 (+0200) Subject: staging: mrst: psb_gtt: Remove the rw semaphore X-Git-Tag: 2.1b_release~420 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=004ef4fe7c6b152b8100f0b143805039d0b48714;p=kernel%2Fkernel-mfld-blackbay.git staging: mrst: psb_gtt: Remove the rw semaphore The read/write semaphore is only taken in read mode, so it doesn't actually do anything meaningful. Remove it. Signed-off-by: Ville Syrjälä Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/staging/mrst/drv/psb_drv.c b/drivers/staging/mrst/drv/psb_drv.c index 195026b..8e1148b 100644 --- a/drivers/staging/mrst/drv/psb_drv.c +++ b/drivers/staging/mrst/drv/psb_drv.c @@ -948,7 +948,6 @@ static int psb_driver_unload(struct drm_device *dev) if (dev_priv->mmu) { struct psb_gtt *pg = dev_priv->pg; - down_read(&pg->sem); psb_mmu_remove_pfn_sequence( psb_mmu_get_default_pd (dev_priv->mmu), @@ -966,7 +965,6 @@ static int psb_driver_unload(struct drm_device *dev) (dev_priv->mmu), pg->rar_start, pg->rar_stolen_size >> PAGE_SHIFT); - up_read(&pg->sem); psb_mmu_driver_takedown(dev_priv->mmu); dev_priv->mmu = NULL; } @@ -1184,13 +1182,11 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) * Make MSVDX/TOPAZ MMU aware of the CI stolen memory area. */ if (dev_priv->pg->ci_stolen_size != 0) { - down_read(&pg->sem); ret = psb_mmu_insert_pfn_sequence(psb_mmu_get_default_pd (dev_priv->mmu), dev_priv->ci_region_start >> PAGE_SHIFT, pg->mmu_gatt_start + pg->ci_start, pg->ci_stolen_size >> PAGE_SHIFT, 0); - up_read(&pg->sem); if (ret) goto out_err; } @@ -1199,13 +1195,11 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) * Make MSVDX/TOPAZ MMU aware of the rar stolen memory area. */ if (dev_priv->pg->rar_stolen_size != 0) { - down_read(&pg->sem); ret = psb_mmu_insert_pfn_sequence( psb_mmu_get_default_pd(dev_priv->mmu), dev_priv->rar_region_start >> PAGE_SHIFT, pg->mmu_gatt_start + pg->rar_start, pg->rar_stolen_size >> PAGE_SHIFT, 0); - up_read(&pg->sem); if (ret) goto out_err; } diff --git a/drivers/staging/mrst/drv/psb_gtt.c b/drivers/staging/mrst/drv/psb_gtt.c index 73057a6..ed6e5dc 100644 --- a/drivers/staging/mrst/drv/psb_gtt.c +++ b/drivers/staging/mrst/drv/psb_gtt.c @@ -42,7 +42,6 @@ struct psb_gtt *psb_gtt_alloc(struct drm_device *dev) { if (!tmp) return NULL; - init_rwsem(&tmp->sem); tmp->dev = dev; return tmp; @@ -263,7 +262,6 @@ int psb_gtt_insert_pages(struct psb_gtt *pg, struct page **pages, add = desired_tile_stride; row_add = hw_tile_stride; - down_read(&pg->sem); for (i = 0; i < rows; ++i) { cur_page = pg->gtt_map + offset_pages; for (j = 0; j < desired_tile_stride; ++j) { @@ -274,7 +272,6 @@ int psb_gtt_insert_pages(struct psb_gtt *pg, struct page **pages, offset_pages += add; } (void) ioread32(cur_page - 1); - up_read(&pg->sem); return 0; } @@ -287,7 +284,6 @@ static int psb_gtt_insert_phys_addresses(struct psb_gtt *pg, IMG_CPU_PHYADDR *pP uint32_t pte; //printk("Allocatng IMG GTT mem at %x (pages %d)\n",offset_pages,num_pages); - down_read(&pg->sem); cur_page = pg->gtt_map + offset_pages; for (j = 0; j < num_pages; ++j) { @@ -297,14 +293,12 @@ static int psb_gtt_insert_phys_addresses(struct psb_gtt *pg, IMG_CPU_PHYADDR *pP } (void) ioread32(cur_page - 1); - up_read(&pg->sem); - return 0; } int psb_gtt_remove_pages(struct psb_gtt *pg, unsigned offset_pages, unsigned num_pages, unsigned desired_tile_stride, - unsigned hw_tile_stride, int rc_prot) + unsigned hw_tile_stride) { struct drm_psb_private *dev_priv = pg->dev->dev_private; unsigned rows = 1; @@ -324,8 +318,6 @@ int psb_gtt_remove_pages(struct psb_gtt *pg, unsigned offset_pages, add = desired_tile_stride; row_add = hw_tile_stride; - if (rc_prot) - down_read(&pg->sem); for (i = 0; i < rows; ++i) { cur_page = pg->gtt_map + offset_pages; for (j = 0; j < desired_tile_stride; ++j) @@ -334,8 +326,6 @@ int psb_gtt_remove_pages(struct psb_gtt *pg, unsigned offset_pages, offset_pages += add; } (void) ioread32(cur_page - 1); - if (rc_prot) - up_read(&pg->sem); return 0; } @@ -917,7 +907,7 @@ int psb_gtt_unmap_meminfo(struct drm_device *dev, IMG_HANDLE hKernelMemInfo) offset_pages = node->start; pages = node->size; - psb_gtt_remove_pages(pg, offset_pages, pages, 0, 0, 1); + psb_gtt_remove_pages(pg, offset_pages, pages, 0, 0); /*free tt node*/ @@ -1028,7 +1018,7 @@ int psb_gtt_unmap_pvr_memory(struct drm_device *dev, unsigned int hHandle, unsig offset_pages = node->start; pages = node->size; - psb_gtt_remove_pages(pg, offset_pages, pages, 0, 0, 1); + psb_gtt_remove_pages(pg, offset_pages, pages, 0, 0); /*free tt node*/ psb_gtt_mm_free_mem(mm, node); diff --git a/drivers/staging/mrst/drv/psb_gtt.h b/drivers/staging/mrst/drv/psb_gtt.h index 94a74c3..f5eee60 100644 --- a/drivers/staging/mrst/drv/psb_gtt.h +++ b/drivers/staging/mrst/drv/psb_gtt.h @@ -44,7 +44,6 @@ struct psb_gtt { unsigned long ci_stolen_size; unsigned long rar_stolen_size; uint32_t __iomem *gtt_map; - struct rw_semaphore sem; }; struct psb_gtt_mm { @@ -81,8 +80,7 @@ extern int psb_gtt_insert_pages(struct psb_gtt *pg, struct page **pages, extern int psb_gtt_remove_pages(struct psb_gtt *pg, unsigned offset_pages, unsigned num_pages, unsigned desired_tile_stride, - unsigned hw_tile_stride, - int rc_prot); + unsigned hw_tile_stride); extern struct psb_gtt *psb_gtt_alloc(struct drm_device *dev); extern void psb_gtt_takedown(struct psb_gtt *pg, int free); diff --git a/drivers/staging/mrst/imgv/psb_buffer.c b/drivers/staging/mrst/imgv/psb_buffer.c index 6f23df7..8a72a7c 100644 --- a/drivers/staging/mrst/imgv/psb_buffer.c +++ b/drivers/staging/mrst/imgv/psb_buffer.c @@ -250,7 +250,7 @@ static int drm_psb_tbe_unbind(struct ttm_backend *backend) (void) psb_gtt_remove_pages(dev_priv->pg, gatt_p_offset, psb_be->num_pages, psb_be->desired_tile_stride, - psb_be->hw_tile_stride, 0); + psb_be->hw_tile_stride); } psb_mmu_remove_pages(pd, psb_be->offset,