diff options
author | Thierry Reding <treding@nvidia.com> | 2014-05-19 07:39:07 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-06-05 17:14:38 -0400 |
commit | c6a1af8a1621913e2658eaff419bab7028b2c42c (patch) | |
tree | 2f50b904d0eed18320c56d81e0338a789fcd8708 /drivers/gpu/drm/drm_pci.c | |
parent | ca8e2ad71013049bc88a10b11d83712bfe56cdd4 (diff) |
drm: Add device registration documentation
Describe how devices are registered using the drm_*_init() functions.
Adding this to docbook requires a largish set of changes to the comments
in drm_{pci,usb,platform}.c since they are doxygen-style rather than
proper kernel-doc and therefore mess with the docbook generation.
While at it, mark usage of drm_put_dev() as discouraged in favour of
calling drm_dev_unregister() and drm_dev_unref() directly.
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/drm_pci.c')
-rw-r--r-- | drivers/gpu/drm/drm_pci.c | 80 |
1 files changed, 38 insertions, 42 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index d237de36a07a..020cfd934854 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -1,17 +1,3 @@ | |||
1 | /* drm_pci.h -- PCI DMA memory management wrappers for DRM -*- linux-c -*- */ | ||
2 | /** | ||
3 | * \file drm_pci.c | ||
4 | * \brief Functions and ioctls to manage PCI memory | ||
5 | * | ||
6 | * \warning These interfaces aren't stable yet. | ||
7 | * | ||
8 | * \todo Implement the remaining ioctl's for the PCI pools. | ||
9 | * \todo The wrappers here are so thin that they would be better off inlined.. | ||
10 | * | ||
11 | * \author José Fonseca <jrfonseca@tungstengraphics.com> | ||
12 | * \author Leif Delgass <ldelgass@retinalburn.net> | ||
13 | */ | ||
14 | |||
15 | /* | 1 | /* |
16 | * Copyright 2003 José Fonseca. | 2 | * Copyright 2003 José Fonseca. |
17 | * Copyright 2003 Leif Delgass. | 3 | * Copyright 2003 Leif Delgass. |
@@ -42,12 +28,14 @@ | |||
42 | #include <linux/export.h> | 28 | #include <linux/export.h> |
43 | #include <drm/drmP.h> | 29 | #include <drm/drmP.h> |
44 | 30 | ||
45 | /**********************************************************************/ | ||
46 | /** \name PCI memory */ | ||
47 | /*@{*/ | ||
48 | |||
49 | /** | 31 | /** |
50 | * \brief Allocate a PCI consistent memory block, for DMA. | 32 | * drm_pci_alloc - Allocate a PCI consistent memory block, for DMA. |
33 | * @dev: DRM device | ||
34 | * @size: size of block to allocate | ||
35 | * @align: alignment of block | ||
36 | * | ||
37 | * Return: A handle to the allocated memory block on success or NULL on | ||
38 | * failure. | ||
51 | */ | 39 | */ |
52 | drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) | 40 | drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) |
53 | { | 41 | { |
@@ -88,8 +76,8 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali | |||
88 | 76 | ||
89 | EXPORT_SYMBOL(drm_pci_alloc); | 77 | EXPORT_SYMBOL(drm_pci_alloc); |
90 | 78 | ||
91 | /** | 79 | /* |
92 | * \brief Free a PCI consistent memory block without freeing its descriptor. | 80 | * Free a PCI consistent memory block without freeing its descriptor. |
93 | * | 81 | * |
94 | * This function is for internal use in the Linux-specific DRM core code. | 82 | * This function is for internal use in the Linux-specific DRM core code. |
95 | */ | 83 | */ |
@@ -111,7 +99,9 @@ void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) | |||
111 | } | 99 | } |
112 | 100 | ||
113 | /** | 101 | /** |
114 | * \brief Free a PCI consistent memory block | 102 | * drm_pci_free - Free a PCI consistent memory block |
103 | * @dev: DRM device | ||
104 | * @dmah: handle to memory block | ||
115 | */ | 105 | */ |
116 | void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) | 106 | void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) |
117 | { | 107 | { |
@@ -226,17 +216,16 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) | |||
226 | } | 216 | } |
227 | 217 | ||
228 | /** | 218 | /** |
229 | * Get interrupt from bus id. | 219 | * drm_irq_by_busid - Get interrupt from bus ID |
230 | * | 220 | * @dev: DRM device |
231 | * \param inode device inode. | 221 | * @data: IOCTL parameter pointing to a drm_irq_busid structure |
232 | * \param file_priv DRM file private. | 222 | * @file_priv: DRM file private. |
233 | * \param cmd command. | ||
234 | * \param arg user argument, pointing to a drm_irq_busid structure. | ||
235 | * \return zero on success or a negative number on failure. | ||
236 | * | 223 | * |
237 | * Finds the PCI device with the specified bus id and gets its IRQ number. | 224 | * Finds the PCI device with the specified bus id and gets its IRQ number. |
238 | * This IOCTL is deprecated, and will now return EINVAL for any busid not equal | 225 | * This IOCTL is deprecated, and will now return EINVAL for any busid not equal |
239 | * to that of the device that this DRM instance attached to. | 226 | * to that of the device that this DRM instance attached to. |
227 | * | ||
228 | * Return: 0 on success or a negative error code on failure. | ||
240 | */ | 229 | */ |
241 | int drm_irq_by_busid(struct drm_device *dev, void *data, | 230 | int drm_irq_by_busid(struct drm_device *dev, void *data, |
242 | struct drm_file *file_priv) | 231 | struct drm_file *file_priv) |
@@ -285,15 +274,16 @@ static struct drm_bus drm_pci_bus = { | |||
285 | }; | 274 | }; |
286 | 275 | ||
287 | /** | 276 | /** |
288 | * Register. | 277 | * drm_get_pci_dev - Register a PCI device with the DRM subsystem |
289 | * | 278 | * @pdev: PCI device |
290 | * \param pdev - PCI device structure | 279 | * @ent: entry from the PCI ID table that matches @pdev |
291 | * \param ent entry from the PCI ID table with device type flags | 280 | * @driver: DRM device driver |
292 | * \return zero on success or a negative number on failure. | ||
293 | * | 281 | * |
294 | * Attempt to gets inter module "drm" information. If we are first | 282 | * Attempt to gets inter module "drm" information. If we are first |
295 | * then register the character device and inter module information. | 283 | * then register the character device and inter module information. |
296 | * Try and register, if we fail to register, backout previous work. | 284 | * Try and register, if we fail to register, backout previous work. |
285 | * | ||
286 | * Return: 0 on success or a negative error code on failure. | ||
297 | */ | 287 | */ |
298 | int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | 288 | int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, |
299 | struct drm_driver *driver) | 289 | struct drm_driver *driver) |
@@ -346,15 +336,14 @@ err_free: | |||
346 | EXPORT_SYMBOL(drm_get_pci_dev); | 336 | EXPORT_SYMBOL(drm_get_pci_dev); |
347 | 337 | ||
348 | /** | 338 | /** |
349 | * PCI device initialization. Called direct from modules at load time. | 339 | * drm_pci_init - Register matching PCI devices with the DRM subsystem |
340 | * @driver: DRM device driver | ||
341 | * @pdriver: PCI device driver | ||
350 | * | 342 | * |
351 | * \return zero on success or a negative number on failure. | 343 | * Initializes a drm_device structures, registering the stubs and initializing |
344 | * the AGP device. | ||
352 | * | 345 | * |
353 | * Initializes a drm_device structures,registering the | 346 | * Return: 0 on success or a negative error code on failure. |
354 | * stubs and initializing the AGP device. | ||
355 | * | ||
356 | * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and | ||
357 | * after the initialization for driver customization. | ||
358 | */ | 347 | */ |
359 | int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) | 348 | int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) |
360 | { | 349 | { |
@@ -458,7 +447,14 @@ int drm_pci_set_unique(struct drm_device *dev, | |||
458 | 447 | ||
459 | EXPORT_SYMBOL(drm_pci_init); | 448 | EXPORT_SYMBOL(drm_pci_init); |
460 | 449 | ||
461 | /*@}*/ | 450 | /** |
451 | * drm_pci_exit - Unregister matching PCI devices from the DRM subsystem | ||
452 | * @driver: DRM device driver | ||
453 | * @pdriver: PCI device driver | ||
454 | * | ||
455 | * Unregisters one or more devices matched by a PCI driver from the DRM | ||
456 | * subsystem. | ||
457 | */ | ||
462 | void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver) | 458 | void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver) |
463 | { | 459 | { |
464 | struct drm_device *dev, *tmp; | 460 | struct drm_device *dev, *tmp; |