From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org
Subject: [PATCH] drm: fix sysfs symlinks between driver and module
Date: Fri, 6 Mar 2015 21:58:48 +0900 [thread overview]
Message-ID: <1425646728-7334-1-git-send-email-akinobu.mita@gmail.com> (raw)
When registering drivers, the symlinks for mapping between driver
and module are created in sysfs. But the drm drivers registered
by drm_pci_init() create wrong symlinks, because correct owner
module of pci driver is not passed to pci_register_driver().
For example, the i915 driver creates the following wrong symlinks:
/sys/bus/pci/drivers/i915/module -> ../../../../module/drm
/sys/module/drm/drivers/pci:i915 -> ../../../bus/pci/drivers/i915
With this change, these symlinks are fixed:
/sys/bus/pci/drivers/i915/module -> ../../../../module/i915
/sys/module/i915/drivers/pci:i915 -> ../../../bus/pci/drivers/i915
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/drm_pci.c | 14 +++++++++-----
include/drm/drmP.h | 5 ++++-
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index fd29f03..e093a11 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -318,16 +318,19 @@ err_free:
EXPORT_SYMBOL(drm_get_pci_dev);
/**
- * drm_pci_init - Register matching PCI devices with the DRM subsystem
+ * __drm_pci_init - Register matching PCI devices with the DRM subsystem
* @driver: DRM device driver
* @pdriver: PCI device driver
+ * @owner: owner module of pdriver
+ * @mod_name: module name string
*
* Initializes a drm_device structures, registering the stubs and initializing
* the AGP device.
*
* Return: 0 on success or a negative error code on failure.
*/
-int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
+int __drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver,
+ struct module *owner, const char *mod_name)
{
struct pci_dev *pdev = NULL;
const struct pci_device_id *pid;
@@ -336,7 +339,7 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
DRM_DEBUG("\n");
if (driver->driver_features & DRIVER_MODESET)
- return pci_register_driver(pdriver);
+ return __pci_register_driver(pdriver, owner, mod_name);
/* If not using KMS, fall back to stealth mode manual scanning. */
INIT_LIST_HEAD(&driver->legacy_dev_list);
@@ -404,7 +407,8 @@ EXPORT_SYMBOL(drm_pcie_get_speed_cap_mask);
#else
-int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
+int __drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver,
+ struct module *owner, const char *mod_name)
{
return -1;
}
@@ -425,7 +429,7 @@ int drm_pci_set_unique(struct drm_device *dev,
}
#endif
-EXPORT_SYMBOL(drm_pci_init);
+EXPORT_SYMBOL(__drm_pci_init);
/**
* drm_pci_exit - Unregister matching PCI devices from the DRM subsystem
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e928625..8a06d9d 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1034,7 +1034,10 @@ static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
}
void drm_pci_agp_destroy(struct drm_device *dev);
-extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
+extern int __drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver,
+ struct module *owner, const char *mod_name);
+#define drm_pci_init(driver, pdriver) \
+ __drm_pci_init(driver, pdriver, THIS_MODULE, KBUILD_MODNAME)
extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
#ifdef CONFIG_PCI
extern int drm_get_pci_dev(struct pci_dev *pdev,
--
1.9.1
reply other threads:[~2015-03-06 12:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1425646728-7334-1-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.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