From patchwork Mon Jun 25 17:32:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10487077 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 076936038C for ; Mon, 25 Jun 2018 17:32:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E53B82841D for ; Mon, 25 Jun 2018 17:32:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA2D628592; Mon, 25 Jun 2018 17:32:47 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 838E02841D for ; Mon, 25 Jun 2018 17:32:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B9996E35F; Mon, 25 Jun 2018 17:32:46 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA4DC6E35A for ; Mon, 25 Jun 2018 17:32:44 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id z137-v6so5204867wmc.0 for ; Mon, 25 Jun 2018 10:32:44 -0700 (PDT) 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=PgFlAfKVRQKUU+xv19EhzuemZRaxZX1DHTbrh3goktU=; b=ZM3DsAk+j9ulJ2WpSAeYW+GYJUlqVAVzGc+Xp554M0iXVY/pJYKIBoPaeQ98Q2tX7l DOZukXjuooHjfjMxRalnNc2zUwN1G8JfW9Jk+B70liL7iyYHUNDfQhB/29o5ZCto40Fz UN9A5S6tmpJFy0d1A2+7FayGWksUcEhyylQ5p0MBArHmAMEtVrnDdxFs3+DlQsCL9hZK Mx+mAAETa78L4Anwz1d7DvCMOKLYoqcM3+GMF19u39r1Ht1pvTRwcnS6g/dig98/iDhQ CtGVVIYJRiumKPuTmOyImvIk6PEUaEogDRVlKc7gZ5jELZrrHUpP9xgtJqsfdOOU9gHF wb1w== X-Gm-Message-State: APt69E2Hqo1YV7t7lRdK+EATp52BigXv432N9IVI538Tj+Q1aJk6SMcv c2UD2ANueu2EfcYnK9pZ6N1nDc6j X-Google-Smtp-Source: AAOMgpdU5d6aAWuV7O8mW1LovrcW9CFRNCM8f0dlVxa1pGdU8PqssA4ntUT+VH4YVGdsvEqh+kvVrw== X-Received: by 2002:a1c:2ed2:: with SMTP id u201-v6mr1730487wmu.10.1529947963452; Mon, 25 Jun 2018 10:32:43 -0700 (PDT) Received: from localhost.localdomain ([95.146.151.144]) by smtp.gmail.com with ESMTPSA id u16-v6sm3762148wrp.44.2018.06.25.10.32.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 10:32:43 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Mon, 25 Jun 2018 18:32:36 +0100 Message-Id: <20180625173237.7930-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [RFC 1/2] drm/i915: Keep a list of probed devices 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0db3c83cce29..8a3ea18d8416 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1207,6 +1207,9 @@ static void i915_driver_cleanup_hw(struct drm_i915_private *dev_priv) i915_ggtt_cleanup_hw(dev_priv); } +DEFINE_MUTEX(i915_driver_list_lock); +LIST_HEAD(i915_driver_list); + /** * i915_driver_register - register the driver with the rest of the system * @dev_priv: device private @@ -1264,6 +1267,11 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) */ if (INTEL_INFO(dev_priv)->num_pipes) drm_kms_helper_poll_init(dev); + + INIT_LIST_HEAD(&dev_priv->driver_list_link); + mutex_lock(&i915_driver_list_lock); + list_add_tail(&dev_priv->driver_list_link, &i915_driver_list); + mutex_unlock(&i915_driver_list_lock); } /** @@ -1275,6 +1283,10 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv) intel_fbdev_unregister(dev_priv); intel_audio_deinit(dev_priv); + mutex_lock(&i915_driver_list_lock); + list_del(&dev_priv->driver_list_link); + mutex_unlock(&i915_driver_list_lock); + /* * After flushing the fbdev (incl. a late async config which will * have delayed queuing of a hotplug event), then flush the hotplug diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 6f08ab310118..685bfdca3a72 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2142,12 +2142,17 @@ struct drm_i915_private { struct i915_pmu pmu; + struct list_head driver_list_link; + /* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch * will be rejected. Instead look for a better place. */ }; +extern struct mutex i915_driver_list_lock; +extern struct list_head i915_driver_list; + static inline struct drm_i915_private *to_i915(const struct drm_device *dev) { return container_of(dev, struct drm_i915_private, drm);