All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Jordan Crouse <jcrouse@codeaurora.org>
Cc: seanpaul@chromium.org, linux-arm-msm@vger.kernel.org,
	freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	abhinavk@codeaurora.org
Subject: Re: [PATCH 05/11] drm/msm/dpu: Cleanup some container_of helper functions
Date: Thu, 18 Oct 2018 23:49:44 +0200	[thread overview]
Message-ID: <20181018214944.GA6485@ravnborg.org> (raw)
In-Reply-To: <20181018195836.15885-6-jcrouse@codeaurora.org>

Hi Jordan.

> -/**
> - * to_dpu_hw_mixer - convert base object dpu_hw_base to container
> - * @hw: Pointer to base hardware block
> - * return: Pointer to hardware block container
> - */
> -static inline struct dpu_hw_mixer *to_dpu_hw_mixer(struct dpu_hw_blk *hw)
> -{
> -	return container_of(hw, struct dpu_hw_mixer, base);
> -}
This is a nicely documented static inline that when used provides type checks.

>  
> +#define to_dpu_hw_mixer(hw) container_of((hw), struct dpu_hw_mixer, base)
> +
Replaced by an undocumented define without the same obvious typecheck.

This looks like a step backward.


>  /**
>   * _dpu_rm_check_lm_and_get_connected_blks - check if proposed layer mixer meets
>   *	proposed use case requirements, incl. hardwired dependent blocks like
> @@ -566,7 +568,8 @@ static int _dpu_rm_reserve_ctls(
>  
>  	dpu_rm_init_hw_iter(&iter, 0, DPU_HW_BLK_CTL);
>  	while (_dpu_rm_get_hw_locked(rm, &iter)) {
> -		const struct dpu_hw_ctl *ctl = to_dpu_hw_ctl(iter.blk->hw);
> +		const struct dpu_hw_ctl *ctl =
> +			container_of(iter.blk->hw, struct dpu_hw_ctl, base);
And here you have an open coded container_of where there before
was a nice little properly named helper function.

This does not help readability.

Drop the unused stuff, but sometimes small single line helper functions
makes code more readable even if only used once.

	Sam
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-10-18 21:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 19:58 [PATCH 00/11] DPU cleanups Jordan Crouse
     [not found] ` <20181018195836.15885-1-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-18 19:58   ` [PATCH 01/11] drm/msm/dpu: Remove dpu_dbg Jordan Crouse
     [not found]     ` <20181018195836.15885-2-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-19 17:34       ` Bruce Wang
2018-10-19 18:11       ` Bruce Wang
     [not found]         ` <CAA3FfWU-KB=VCmrkriO8M1zdPg9FGO_bii7qjbzGXupapJFF9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-19 19:59           ` Jordan Crouse
2018-10-18 19:58   ` [PATCH 02/11] drm/msm/dpu: Use DEFINE_SHOW_ATTRIBUTE Jordan Crouse
     [not found]     ` <20181018195836.15885-3-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-18 21:43       ` Bruce Wang
2018-10-18 19:58   ` [PATCH 03/11] drm/msm/dpu: Remove dpu_crtc_get_mixer_height Jordan Crouse
     [not found]     ` <20181018195836.15885-4-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-18 21:44       ` Bruce Wang
2018-10-18 19:58   ` [PATCH 04/11] drm/msm/dpu: Remove dpu_crtc_is_enabled() Jordan Crouse
     [not found]     ` <20181018195836.15885-5-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-18 21:45       ` Bruce Wang
2018-10-18 19:58   ` [PATCH 05/11] drm/msm/dpu: Cleanup some container_of helper functions Jordan Crouse
2018-10-18 21:49     ` Sam Ravnborg [this message]
2018-10-18 19:58   ` [PATCH 06/11] drm/msm/dpu: Cleanup callers of dpu_hw_blk_init Jordan Crouse
2018-10-18 21:53     ` Sam Ravnborg
     [not found]       ` <20181018215359.GA5328-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
2018-10-19 17:13         ` Jordan Crouse
2018-10-18 19:58   ` [PATCH 07/11] drm/msm: Make irq_postinstall optional Jordan Crouse
     [not found]     ` <20181018195836.15885-8-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-19 13:56       ` Bruce Wang
2018-10-18 19:58   ` [PATCH 08/11] drm/msm/dpu: Remove dpu_irq and unused functions Jordan Crouse
     [not found]     ` <20181018195836.15885-9-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-19 14:56       ` Bruce Wang
2018-10-18 19:58   ` [PATCH 09/11] drm/msm/dpu: Debugfs related cleanups Jordan Crouse
     [not found]     ` <20181018195836.15885-10-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-22 15:45       ` Bruce Wang
2018-10-18 19:58   ` [PATCH 10/11] drm/msm/dpu: Further cleanups for static inline functions Jordan Crouse
2018-10-18 22:06     ` Sam Ravnborg
     [not found]       ` <20181018220620.GB5328-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
2018-10-19 17:09         ` Jordan Crouse
2018-10-18 19:58   ` [PATCH 11/11] drm/msm/dpu: Clean up dpu_media_info.h " Jordan Crouse
     [not found]     ` <20181018195836.15885-12-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-19 15:10       ` Bruce Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181018214944.GA6485@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=abhinavk@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jcrouse@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.