diff mbox series

[PATCHv2,2/7] drm/omap: avoid copy in mgr_fld_read/write

Message ID 20190930103840.18970-3-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Headers show
Series drm/omap: misc improvements | expand

Commit Message

Tomi Valkeinen Sept. 30, 2019, 10:38 a.m. UTC
Avoid unnecessary copy in mgr_fld_read/write by taking a pointer to the
reg_resc and using that.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart Oct. 4, 2019, 7:02 a.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Mon, Sep 30, 2019 at 01:38:35PM +0300, Tomi Valkeinen wrote:
> Avoid unnecessary copy in mgr_fld_read/write by taking a pointer to the
> reg_resc and using that.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/omapdrm/dss/dispc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 0dc0272569f6..3c9315b17ef2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -365,17 +365,17 @@ static inline u32 dispc_read_reg(struct dispc_device *dispc, u16 idx)
>  static u32 mgr_fld_read(struct dispc_device *dispc, enum omap_channel channel,
>  			enum mgr_reg_fields regfld)
>  {
> -	const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld];
> +	const struct dispc_reg_field *rfld = &mgr_desc[channel].reg_desc[regfld];
>  
> -	return REG_GET(dispc, rfld.reg, rfld.high, rfld.low);
> +	return REG_GET(dispc, rfld->reg, rfld->high, rfld->low);
>  }
>  
>  static void mgr_fld_write(struct dispc_device *dispc, enum omap_channel channel,
>  			  enum mgr_reg_fields regfld, int val)
>  {
> -	const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld];
> +	const struct dispc_reg_field *rfld = &mgr_desc[channel].reg_desc[regfld];
>  
> -	REG_FLD_MOD(dispc, rfld.reg, val, rfld.high, rfld.low);
> +	REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
>  }
>  
>  static int dispc_get_num_ovls(struct dispc_device *dispc)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 0dc0272569f6..3c9315b17ef2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -365,17 +365,17 @@  static inline u32 dispc_read_reg(struct dispc_device *dispc, u16 idx)
 static u32 mgr_fld_read(struct dispc_device *dispc, enum omap_channel channel,
 			enum mgr_reg_fields regfld)
 {
-	const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld];
+	const struct dispc_reg_field *rfld = &mgr_desc[channel].reg_desc[regfld];
 
-	return REG_GET(dispc, rfld.reg, rfld.high, rfld.low);
+	return REG_GET(dispc, rfld->reg, rfld->high, rfld->low);
 }
 
 static void mgr_fld_write(struct dispc_device *dispc, enum omap_channel channel,
 			  enum mgr_reg_fields regfld, int val)
 {
-	const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld];
+	const struct dispc_reg_field *rfld = &mgr_desc[channel].reg_desc[regfld];
 
-	REG_FLD_MOD(dispc, rfld.reg, val, rfld.high, rfld.low);
+	REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
 }
 
 static int dispc_get_num_ovls(struct dispc_device *dispc)