From patchwork Tue Feb 6 14:12:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10203133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F2F566020F for ; Tue, 6 Feb 2018 14:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAF3A2883B for ; Tue, 6 Feb 2018 14:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF9A62886C; Tue, 6 Feb 2018 14:12:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8FB7F2883B for ; Tue, 6 Feb 2018 14:12:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01E086E46B; Tue, 6 Feb 2018 14:12:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 32DC06E466; Tue, 6 Feb 2018 14:12:47 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id b21so4104478wme.4; Tue, 06 Feb 2018 06:12:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=h4dIH/C67Uz4CS6uBnevo5ut5FjRJCDg825Ssw1XD6U=; b=uTLQFY5bI12lqGaC5jMwi3J0VA1PYwlIt8sWWbVxqdcSMK94w3qqGKhHtlK/HGxL/H ySZ1TQqUrqVMEEXnP3j4TnBdt2gvz7zJPFV/mrWadBN+W6e0aTwX423Tm4Cwe2nlTD2G nU4oMMpIZaW//fSgj7jgARNruL3b+2DtmpQpn53tzRzpsFUDxEtaM1lLfKzWB4MwBeuH WkFmZajYbLwoLIBEnhqmJfmC2JjvrDUZt+fmg3j1PhT7UFpjylsZMN/HdwYip6M3/cRI 35QOlSpp8fNdqyahSV7MZ8GLSjtfyY1IddUGSDPKE3V7NEUpsreRa8/QcYMMRdKsj6o+ KDpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=h4dIH/C67Uz4CS6uBnevo5ut5FjRJCDg825Ssw1XD6U=; b=XqLn+WMcxCfPC2VGOTfOlP3BRHKsKFmX46Y8NdbZK/Vykj5I0LbQ0yjMTTsqp5qVHS 22l5Dplvb+kt2i31dAO6RbdWxUxNzgiu8MILkMqIsdZBs6gPF7KU1Gw+jkAij+EqUvSN lIg3oQA55GccQM8+QtCjKOIjPL/A3iVpvcVPM5HMOMRs9mGXzluzbXV0BWISnLmtIQFq I5MAoUHxZ27srr/gmGhFH5Fj9L4rjzJVkw5euHgzBZV2W/vOiCWQsfYx4qTOCIIcGqTY RO8E/UHKWjPWuwp8Dwx2aspdFF/BgIQrK8kTVBI5hBocXd+Gn/bm1dtkPhAcPSSokTvX XQPw== X-Gm-Message-State: APf1xPBagOFwy2+AbIpZR3xWGCA1ebnU4LPj29QJzed0IwUDFLaGaCgb X/VoT+oaYuP2Uq0T4FlsWtA= X-Google-Smtp-Source: AH8x225YUF7glOIsYnRXknK4ADvL1b+kZDfyFuv2WYtdf10kbgaiBVOLpYb3Cp3YkUWrOt61eY4y+A== X-Received: by 10.28.70.196 with SMTP id t187mr1813231wma.129.1517926365798; Tue, 06 Feb 2018 06:12:45 -0800 (PST) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id h194sm38978479wma.8.2018.02.06.06.12.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 06:12:44 -0800 (PST) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Tue, 6 Feb 2018 15:12:37 +0100 Message-Id: <20180206141239.993-1-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.3 Subject: [Intel-gfx] [PATCH v4 1/3] drm/i915: Add intel_bios_cleanup() function X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Add an intel_bios_cleanup() function to act as counterpart of intel_bios_init() and move the cleanup of vbt related resources there, putting it in the same file as the allocation. Signed-off-by: Hans de Goede Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/i915_drv.c | 14 +------------- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_bios.c | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e9f1daf258fe..7f094bbc2a7f 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1446,19 +1446,7 @@ void i915_driver_unload(struct drm_device *dev) intel_modeset_cleanup(dev); - /* - * free the memory space allocated for the child device - * config parsed from VBT - */ - if (dev_priv->vbt.child_dev && dev_priv->vbt.child_dev_num) { - kfree(dev_priv->vbt.child_dev); - dev_priv->vbt.child_dev = NULL; - dev_priv->vbt.child_dev_num = 0; - } - kfree(dev_priv->vbt.sdvo_lvds_vbt_mode); - dev_priv->vbt.sdvo_lvds_vbt_mode = NULL; - kfree(dev_priv->vbt.lfp_lvds_vbt_mode); - dev_priv->vbt.lfp_lvds_vbt_mode = NULL; + intel_bios_cleanup(dev_priv); vga_switcheroo_unregister_client(pdev); vga_client_register(pdev, NULL, NULL, NULL); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index d6b5ac2a563d..1cccea1b87bc 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3675,6 +3675,7 @@ extern void intel_i2c_reset(struct drm_i915_private *dev_priv); /* intel_bios.c */ void intel_bios_init(struct drm_i915_private *dev_priv); +void intel_bios_cleanup(struct drm_i915_private *dev_priv); bool intel_bios_is_valid_vbt(const void *buf, size_t size); bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv); bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin); diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 4e74aa2f16bc..f9550507bb9f 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c @@ -1610,6 +1610,27 @@ void intel_bios_init(struct drm_i915_private *dev_priv) pci_unmap_rom(pdev, bios); } +/** + * intel_bios_cleanup - Free any resources allocated by intel_bios_init() + * @dev_priv: i915 device instance + */ +void intel_bios_cleanup(struct drm_i915_private *dev_priv) +{ + /* + * free the memory space allocated for the child device + * config parsed from VBT + */ + if (dev_priv->vbt.child_dev && dev_priv->vbt.child_dev_num) { + kfree(dev_priv->vbt.child_dev); + dev_priv->vbt.child_dev = NULL; + dev_priv->vbt.child_dev_num = 0; + } + kfree(dev_priv->vbt.sdvo_lvds_vbt_mode); + dev_priv->vbt.sdvo_lvds_vbt_mode = NULL; + kfree(dev_priv->vbt.lfp_lvds_vbt_mode); + dev_priv->vbt.lfp_lvds_vbt_mode = NULL; +} + /** * intel_bios_is_tv_present - is integrated TV present in VBT * @dev_priv: i915 device instance