[Intel-gfx] [PATCH] drm: squash lines for simple wrapper functions
Remove unneeded variables and assignments. Signed-off-by: Masahiro Yamada --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c| 6 +- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c| 6 +- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++- drivers/gpu/drm/i915/i915_drv.c | 8 +--- drivers/gpu/drm/qxl/qxl_draw.c| 7 ++- drivers/gpu/drm/qxl/qxl_release.c | 7 ++- drivers/gpu/drm/radeon/cik.c | 6 +- drivers/gpu/drm/radeon/r100.c | 6 +- drivers/gpu/drm/radeon/r600.c | 6 +- 11 files changed, 17 insertions(+), 68 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index b818461..0d5307a 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -5854,11 +5854,7 @@ static int gfx_v8_0_set_clockgating_state(void *handle, static u32 gfx_v8_0_ring_get_rptr_gfx(struct amdgpu_ring *ring) { - u32 rptr; - - rptr = ring->adev->wb.wb[ring->rptr_offs]; - - return rptr; + return ring->adev->wb.wb[ring->rptr_offs]; } static u32 gfx_v8_0_ring_get_wptr_gfx(struct amdgpu_ring *ring) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index a64715d..b165c78 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c @@ -190,12 +190,8 @@ out: */ static uint32_t sdma_v2_4_ring_get_rptr(struct amdgpu_ring *ring) { - u32 rptr; - /* XXX check if swapping is necessary on BE */ - rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2; - - return rptr; + return ring->adev->wb.wb[ring->rptr_offs] >> 2; } /** diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 653ce5e..cf253b9 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c @@ -335,12 +335,8 @@ out: */ static uint32_t sdma_v3_0_ring_get_rptr(struct amdgpu_ring *ring) { - u32 rptr; - /* XXX check if swapping is necessary on BE */ - rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2; - - return rptr; + return ring->adev->wb.wb[ring->rptr_offs] >> 2; } /** diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 48030f0..d37d112 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -1073,34 +1073,22 @@ void analogix_dp_set_lane3_link_training(struct analogix_dp_device *dp, u32 analogix_dp_get_lane0_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL); } u32 analogix_dp_get_lane1_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL); } u32 analogix_dp_get_lane2_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL); } u32 analogix_dp_get_lane3_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL); } void analogix_dp_reset_macro(struct analogix_dp_device *dp) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 04e4571..302bdcb 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -737,16 +737,13 @@ static void drm_dp_mst_put_payload_id(struct drm_dp_mst_topology_mgr *mgr, static bool check_txmsg_state(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_sideband_msg_tx *txmsg) { - bool ret; - /* * All updates to txmsg->state are protected by mgr->qlock, and the two * cases we check here are terminal states. For those the barriers * provided by the wake_up/wait_event pair are enough. */ - ret = (txmsg->state == DRM_DP_SIDEBAND_TX_RX || - txmsg->state == DRM_DP_SIDEBAND_TX_TIMEOUT); - return ret; + return txmsg->state == DRM_DP_SIDEBAND_TX_RX || + txmsg->state == DRM_DP_SIDEBAND_TX_TIMEOUT; } static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb, diff --gi
Re: [Intel-gfx] [PATCH] drm: squash lines for simple wrapper functions
Am 07.09.2016 um 01:04 schrieb Masahiro Yamada: Remove unneeded variables and assignments. Signed-off-by: Masahiro Yamada Tom StDenis was working on a similar patch for amdgpu as well, please make sure that your work doesn't conflict with his. Apart from that looks good to me. But I would prefer this to be split up per driver, cause I can't really give my rb on this patch when it touches drivers all over the place. On the other hand feel free to add my Acked-by and merge it as general cleanup through Dave directly. Regards, Christian. --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c| 6 +- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c| 6 +- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++- drivers/gpu/drm/i915/i915_drv.c | 8 +--- drivers/gpu/drm/qxl/qxl_draw.c| 7 ++- drivers/gpu/drm/qxl/qxl_release.c | 7 ++- drivers/gpu/drm/radeon/cik.c | 6 +- drivers/gpu/drm/radeon/r100.c | 6 +- drivers/gpu/drm/radeon/r600.c | 6 +- 11 files changed, 17 insertions(+), 68 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index b818461..0d5307a 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -5854,11 +5854,7 @@ static int gfx_v8_0_set_clockgating_state(void *handle, static u32 gfx_v8_0_ring_get_rptr_gfx(struct amdgpu_ring *ring) { - u32 rptr; - - rptr = ring->adev->wb.wb[ring->rptr_offs]; - - return rptr; + return ring->adev->wb.wb[ring->rptr_offs]; } static u32 gfx_v8_0_ring_get_wptr_gfx(struct amdgpu_ring *ring) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index a64715d..b165c78 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c @@ -190,12 +190,8 @@ out: */ static uint32_t sdma_v2_4_ring_get_rptr(struct amdgpu_ring *ring) { - u32 rptr; - /* XXX check if swapping is necessary on BE */ - rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2; - - return rptr; + return ring->adev->wb.wb[ring->rptr_offs] >> 2; } /** diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 653ce5e..cf253b9 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c @@ -335,12 +335,8 @@ out: */ static uint32_t sdma_v3_0_ring_get_rptr(struct amdgpu_ring *ring) { - u32 rptr; - /* XXX check if swapping is necessary on BE */ - rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2; - - return rptr; + return ring->adev->wb.wb[ring->rptr_offs] >> 2; } /** diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 48030f0..d37d112 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -1073,34 +1073,22 @@ void analogix_dp_set_lane3_link_training(struct analogix_dp_device *dp, u32 analogix_dp_get_lane0_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL); } u32 analogix_dp_get_lane1_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL); } u32 analogix_dp_get_lane2_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL); } u32 analogix_dp_get_lane3_link_training(struct analogix_dp_device *dp) { - u32 reg; - - reg = readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL); - return reg; + return readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL); } void analogix_dp_reset_macro(struct analogix_dp_device *dp) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 04e4571..302bdcb 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -737,16 +737,13 @@ static void drm_dp_mst_put_payload_id(struct drm_dp_mst_topology_mgr *mgr, static bool check_txmsg_state(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_sideband_msg_tx *txmsg) { - bool ret; - /* * All updates
Re: [Intel-gfx] [PATCH] drm: squash lines for simple wrapper functions
On Wed, 07 Sep 2016, Masahiro Yamada wrote: > Remove unneeded variables and assignments. > > Signed-off-by: Masahiro Yamada ... > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index 95ddd56..59d029d 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -1361,13 +1361,7 @@ void i915_driver_unload(struct drm_device *dev) > > static int i915_driver_open(struct drm_device *dev, struct drm_file *file) > { > - int ret; > - > - ret = i915_gem_open(dev, file); > - if (ret) > - return ret; > - > - return 0; > + return i915_gem_open(dev, file); > } Seems to me the whole function could be replaced by a direct use of i915_gem_open(). BR, Jani. -- Jani Nikula, Intel Open Source Technology Center ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm: squash lines for simple wrapper functions
Hi Jani, 2016-09-07 17:34 GMT+09:00 Jani Nikula : > On Wed, 07 Sep 2016, Masahiro Yamada wrote: >> Remove unneeded variables and assignments. >> >> Signed-off-by: Masahiro Yamada > > ... > >> diff --git a/drivers/gpu/drm/i915/i915_drv.c >> b/drivers/gpu/drm/i915/i915_drv.c >> index 95ddd56..59d029d 100644 >> --- a/drivers/gpu/drm/i915/i915_drv.c >> +++ b/drivers/gpu/drm/i915/i915_drv.c >> @@ -1361,13 +1361,7 @@ void i915_driver_unload(struct drm_device *dev) >> >> static int i915_driver_open(struct drm_device *dev, struct drm_file *file) >> { >> - int ret; >> - >> - ret = i915_gem_open(dev, file); >> - if (ret) >> - return ret; >> - >> - return 0; >> + return i915_gem_open(dev, file); >> } > > Seems to me the whole function could be replaced by a direct use of > i915_gem_open(). Good catch. Shall I send v2? Or, should it be done in a separate follow-up patch? (I hope you can do it in this case.) -- Best Regards Masahiro Yamada ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm: squash lines for simple wrapper functions
> -Original Message- > From: Masahiro Yamada [mailto:yamada.masah...@socionext.com] > Sent: Tuesday, September 06, 2016 7:04 PM > To: David Airlie; dri-de...@lists.freedesktop.org > Cc: Masahiro Yamada; Gustavo Padovan; Yakir Yang; Huang, Ray; Deucher, > Alexander; Liu, Monk; Zhou, David(ChunMing); Daniel Vetter; Heiko > Stuebner; Huang, JinHuiEric; Cui, Flora; Inki Dae; Krzysztof Kozlowski; Dave > Airlie; Jani Nikula; intel-gfx@lists.freedesktop.org; Frediano Ziglio; Li, > Samuel; > Koenig, Christian; Tomasz Figa; Sumit Semwal; linux-ker...@vger.kernel.org; > StDenis, Tom; Dan Carpenter > Subject: [PATCH] drm: squash lines for simple wrapper functions > > Remove unneeded variables and assignments. > > Signed-off-by: Masahiro Yamada Please split these up per driver. Alex > --- > > drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 +- > drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c| 6 +- > drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c| 6 +- > drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 > drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++- > drivers/gpu/drm/i915/i915_drv.c | 8 +--- > drivers/gpu/drm/qxl/qxl_draw.c| 7 ++- > drivers/gpu/drm/qxl/qxl_release.c | 7 ++- > drivers/gpu/drm/radeon/cik.c | 6 +- > drivers/gpu/drm/radeon/r100.c | 6 +- > drivers/gpu/drm/radeon/r600.c | 6 +- > 11 files changed, 17 insertions(+), 68 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c > b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c > index b818461..0d5307a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c > @@ -5854,11 +5854,7 @@ static int gfx_v8_0_set_clockgating_state(void > *handle, > > static u32 gfx_v8_0_ring_get_rptr_gfx(struct amdgpu_ring *ring) > { > - u32 rptr; > - > - rptr = ring->adev->wb.wb[ring->rptr_offs]; > - > - return rptr; > + return ring->adev->wb.wb[ring->rptr_offs]; > } > > static u32 gfx_v8_0_ring_get_wptr_gfx(struct amdgpu_ring *ring) > diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c > b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c > index a64715d..b165c78 100644 > --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c > +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c > @@ -190,12 +190,8 @@ out: > */ > static uint32_t sdma_v2_4_ring_get_rptr(struct amdgpu_ring *ring) > { > - u32 rptr; > - > /* XXX check if swapping is necessary on BE */ > - rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2; > - > - return rptr; > + return ring->adev->wb.wb[ring->rptr_offs] >> 2; > } > > /** > diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c > b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c > index 653ce5e..cf253b9 100644 > --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c > @@ -335,12 +335,8 @@ out: > */ > static uint32_t sdma_v3_0_ring_get_rptr(struct amdgpu_ring *ring) > { > - u32 rptr; > - > /* XXX check if swapping is necessary on BE */ > - rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2; > - > - return rptr; > + return ring->adev->wb.wb[ring->rptr_offs] >> 2; > } > > /** > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > index 48030f0..d37d112 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > @@ -1073,34 +1073,22 @@ void analogix_dp_set_lane3_link_training(struct > analogix_dp_device *dp, > > u32 analogix_dp_get_lane0_link_training(struct analogix_dp_device *dp) > { > - u32 reg; > - > - reg = readl(dp->reg_base + > ANALOGIX_DP_LN0_LINK_TRAINING_CTL); > - return reg; > + return readl(dp->reg_base + > ANALOGIX_DP_LN0_LINK_TRAINING_CTL); > } > > u32 analogix_dp_get_lane1_link_training(struct analogix_dp_device *dp) > { > - u32 reg; > - > - reg = readl(dp->reg_base + > ANALOGIX_DP_LN1_LINK_TRAINING_CTL); > - return reg; > + return readl(dp->reg_base + > ANALOGIX_DP_LN1_LINK_TRAINING_CTL); > } > > u32 analogix_dp_get_lane2_link_training(struct analogix_dp_device *dp) > { > - u32 reg; > - > - reg = readl(dp->reg_base + > ANALOGIX_DP_LN2_LINK_TRAINING_CTL); > - return reg; > + return readl(dp->reg_base + > ANALOGIX_DP_LN2_LINK_TRAINING_CTL); > } > > u32 analogix_dp_get_lane3_link_training(struct analogix_dp_device *dp) > { > - u32 reg; > - > - reg = readl(dp->reg_base + > ANALOGIX_DP_LN3_LINK_TRAINING_CTL); > - return reg; > + return readl(dp->reg_base + > ANALOGIX_DP_LN3_LINK_TRAINING_CTL); > } > > void analogix_dp_reset_macro(struct analogix_dp_device *dp) > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c > b/drivers/gpu/drm/drm_dp_mst_topology.c > index 04e4571..302bdcb 100644 > --- a/drivers/gp