From: Jani Nikula <jani.nikula@linux.intel.com>
To: Bob Paauwe <bob.j.paauwe@intel.com>,
intel-gfx <intel-gfx@lists.freedesktop.org>
Subject: Re: [RFC 06/12] drm/i915/config: Split out allocation of list nodes.
Date: Fri, 13 Feb 2015 10:15:07 +0200 [thread overview]
Message-ID: <87oaoyrzw4.fsf@intel.com> (raw)
In-Reply-To: <1423784498-11272-7-git-send-email-bob.j.paauwe@intel.com>
On Fri, 13 Feb 2015, Bob Paauwe <bob.j.paauwe@intel.com> wrote:
> We'll reduce some duplicate code if we move the list node allocation
> to its own function when we start processing future config items like
> workaround or vbt information.
Should probably just be part of patch 1.
BR,
Jani.
>
> Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
> ---
> drivers/gpu/drm/i915/intel_config.c | 49 ++++++++++++++++++++++---------------
> 1 file changed, 29 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_config.c b/drivers/gpu/drm/i915/intel_config.c
> index cf7da93..fb495ed 100644
> --- a/drivers/gpu/drm/i915/intel_config.c
> +++ b/drivers/gpu/drm/i915/intel_config.c
> @@ -161,6 +161,21 @@ static bool node_property(struct intel_config_node *n,
> }
>
>
> +static bool alloc_new_node(struct acpi_device *cl, struct list_head *list)
> +{
> + struct intel_config_node *new_node;
> +
> + new_node = kzalloc(sizeof(*new_node), GFP_KERNEL);
> + if (!new_node)
> + return false;
> +
> + new_node->adev = cl;
> + INIT_LIST_HEAD(&new_node->node);
> + list_add_tail(&new_node->node, list);
> +
> + return true;
> +}
> +
> /**
> * intel_config_init -
> *
> @@ -232,26 +247,20 @@ void intel_config_init(struct drm_device *dev)
>
> cname = acpi_device_bid(component);
>
> - list_for_each_entry(cl, &component->children, node) {
> - new_node = kzalloc(sizeof(*new_node), GFP_KERNEL);
> - if (!new_node)
> - goto bail;
> - new_node->adev = cl;
> - INIT_LIST_HEAD(&new_node->node);
> -
> - /* Add to the appropriate list */
> - if (strcmp(cname, i915_COMPONENT_CRTC) == 0) {
> - list_add_tail(&new_node->node,
> - &info->crtc_list);
> - } else if (strcmp(cname, i915_COMPONENT_CONNECTOR) == 0) {
> - list_add_tail(&new_node->node,
> - &info->connector_list);
> - } else if (strcmp(cname, i915_COMPONENT_PLANE) == 0) {
> - list_add_tail(&new_node->node,
> - &info->plane_list);
> - } else {
> - /* unknown component, ignore it */
> - kfree(new_node);
> + if (strcmp(cname, i915_COMPONENT_CRTC) == 0) {
> + list_for_each_entry(cl, &component->children, node) {
> + if (!alloc_new_node(cl, &info->crtc_list))
> + goto bail;
> + }
> + } else if (strcmp(cname, i915_COMPONENT_CONNECTOR) == 0) {
> + list_for_each_entry(cl, &component->children, node) {
> + if (!alloc_new_node(cl, &info->crtc_list))
> + goto bail;
> + }
> + } else if (strcmp(cname, i915_COMPONENT_PLANE) == 0) {
> + list_for_each_entry(cl, &component->children, node) {
> + if (!alloc_new_node(cl, &info->crtc_list))
> + goto bail;
> }
> }
> }
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-02-13 8:14 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 23:41 [RFC 00/12] i915 init-time configuration Bob Paauwe
2015-02-12 23:41 ` [RFC 01/12] drm/i915/config: Initial framework Bob Paauwe
2015-02-13 8:19 ` Jani Nikula
2015-02-24 16:17 ` Daniel Vetter
2015-02-24 17:41 ` Bob Paauwe
2015-02-24 20:47 ` Daniel Vetter
2015-02-12 23:41 ` [RFC 02/12] drm/i915/config: Introduce intel_output_name Bob Paauwe
2015-02-13 8:12 ` Jani Nikula
2015-02-12 23:41 ` [RFC 03/12] drm/i915/config: Add init-time configuration of bits per color Bob Paauwe
2015-02-12 23:41 ` [RFC 04/12] drm/i915/config: Set dp panel fitter property based on init-time config Bob Paauwe
2015-02-12 23:41 ` [RFC 05/12] drm/i915/config: Set general connector properties using config Bob Paauwe
2015-02-12 23:41 ` [RFC 06/12] drm/i915/config: Split out allocation of list nodes Bob Paauwe
2015-02-13 8:15 ` Jani Nikula [this message]
2015-02-12 23:41 ` [RFC 07/12] drm/i915/config: Get workaround information from configuration Bob Paauwe
2015-02-24 13:51 ` Daniel Vetter
2015-02-24 17:54 ` Bob Paauwe
2015-02-12 23:41 ` [RFC 08/12] drm/i915/config: Use workarounds list " Bob Paauwe
2015-02-12 23:41 ` [RFC 09/12] drm/i915/config: Add VBT settings configuration Bob Paauwe
2015-02-24 13:57 ` Daniel Vetter
2015-02-24 18:37 ` Bob Paauwe
2015-02-24 20:52 ` Daniel Vetter
2015-02-24 22:23 ` Bob Paauwe
2015-05-15 9:39 ` Ville Syrjälä
2015-05-20 17:07 ` Bob Paauwe
2015-05-21 8:37 ` Daniel Vetter
2015-05-26 21:20 ` Bob Paauwe
2015-05-27 12:23 ` Daniel Vetter
2015-02-12 23:41 ` [RFC 10/12] drm/i915/config: Introduce a test table and code to make use of it Bob Paauwe
2015-02-12 23:41 ` [RFC 11/12] drm/i915/config: Add workaround properties to ACPI table Bob Paauwe
2015-02-12 23:41 ` [RFC 12/12] drm/i915/config: Add ACPI device examples for VBT configuration Bob Paauwe
2015-02-13 8:08 ` [RFC 00/12] i915 init-time configuration Jani Nikula
2015-02-13 17:17 ` Bob Paauwe
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=87oaoyrzw4.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=bob.j.paauwe@intel.com \
--cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox