From patchwork Mon Dec 19 10:42:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: swati.dhingra@intel.com X-Patchwork-Id: 9480903 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 D5D4D607FF for ; Tue, 20 Dec 2016 00:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA3A52849D for ; Tue, 20 Dec 2016 00:50:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD8AA284CA; Tue, 20 Dec 2016 00:50:36 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable 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 57F582849D for ; Tue, 20 Dec 2016 00:50:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 728EA6E82D; Tue, 20 Dec 2016 00:50:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 205556E5AB; Mon, 19 Dec 2016 10:36:07 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 19 Dec 2016 02:36:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,373,1477983600"; d="scan'208";a="204458257" Received: from swati-desktop.iind.intel.com ([10.223.82.38]) by fmsmga004.fm.intel.com with ESMTP; 19 Dec 2016 02:36:04 -0800 From: swati.dhingra@intel.com To: intel-gfx@lists.freedesktop.org Subject: [RFC 3/4] drm: Create driver specific root directory inside drmfs Date: Mon, 19 Dec 2016 16:12:25 +0530 Message-Id: <1482144146-31605-4-git-send-email-swati.dhingra@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482144146-31605-1-git-send-email-swati.dhingra@intel.com> References: <1482144146-31605-1-git-send-email-swati.dhingra@intel.com> X-Mailman-Approved-At: Tue, 20 Dec 2016 00:50:01 +0000 Cc: Daniel Vetter , Swati Dhingra , dri-devel@lists.freedesktop.org, Sourab Gupta , Jon Bloomfield , Akash Goel X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sourab Gupta A driver specific directory is created inside drmfs root, and dentry of this directory is saved for subsequent use by the driver (e.g. i915). The driver can then create files/directories inside this root directory directly. In case of i915 driver, the top directory is created at '/sys/kernel/drm/i915'. Signed-off-by: Sourab Gupta Signed-off-by: Swati Dhingra --- drivers/gpu/drm/drm_drv.c | 6 ++++++ include/drm/drm_drv.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 298013c..4c32cf8 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -671,6 +671,11 @@ EXPORT_SYMBOL(drm_dev_unref); int drm_dev_register(struct drm_device *dev, unsigned long flags) { int ret; + struct dentry *drmfs_root; + + drmfs_root = drmfs_create_dir(dev->driver->name, NULL); + if (!IS_ERR(drmfs_root)) + dev->driver->drmfs_root = drmfs_root; mutex_lock(&drm_global_mutex); @@ -742,6 +747,7 @@ void drm_dev_unregister(struct drm_device *dev) drm_minor_unregister(dev, DRM_MINOR_PRIMARY); drm_minor_unregister(dev, DRM_MINOR_RENDER); drm_minor_unregister(dev, DRM_MINOR_CONTROL); + drmfs_remove(dev->driver->drmfs_root); } EXPORT_SYMBOL(drm_dev_unregister); diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index c4fc495..d646296 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -405,6 +405,9 @@ struct drm_driver { /* List of devices hanging off this driver with stealth attach. */ struct list_head legacy_dev_list; + + /* drmfs parent directory dentry for this driver */ + struct dentry *drmfs_root; }; extern __printf(6, 7)