diff options
Diffstat (limited to 'drivers/gpu/drm/drm_client.c')
-rw-r--r-- | drivers/gpu/drm/drm_client.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index baff50a4c234..df31c3815092 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c | |||
@@ -63,20 +63,21 @@ static void drm_client_close(struct drm_client_dev *client) | |||
63 | EXPORT_SYMBOL(drm_client_close); | 63 | EXPORT_SYMBOL(drm_client_close); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * drm_client_new - Create a DRM client | 66 | * drm_client_init - Initialise a DRM client |
67 | * @dev: DRM device | 67 | * @dev: DRM device |
68 | * @client: DRM client | 68 | * @client: DRM client |
69 | * @name: Client name | 69 | * @name: Client name |
70 | * @funcs: DRM client functions (optional) | 70 | * @funcs: DRM client functions (optional) |
71 | * | 71 | * |
72 | * This initialises the client and opens a &drm_file. Use drm_client_add() to complete the process. | ||
72 | * The caller needs to hold a reference on @dev before calling this function. | 73 | * The caller needs to hold a reference on @dev before calling this function. |
73 | * The client is freed when the &drm_device is unregistered. See drm_client_release(). | 74 | * The client is freed when the &drm_device is unregistered. See drm_client_release(). |
74 | * | 75 | * |
75 | * Returns: | 76 | * Returns: |
76 | * Zero on success or negative error code on failure. | 77 | * Zero on success or negative error code on failure. |
77 | */ | 78 | */ |
78 | int drm_client_new(struct drm_device *dev, struct drm_client_dev *client, | 79 | int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, |
79 | const char *name, const struct drm_client_funcs *funcs) | 80 | const char *name, const struct drm_client_funcs *funcs) |
80 | { | 81 | { |
81 | int ret; | 82 | int ret; |
82 | 83 | ||
@@ -95,10 +96,6 @@ int drm_client_new(struct drm_device *dev, struct drm_client_dev *client, | |||
95 | if (ret) | 96 | if (ret) |
96 | goto err_put_module; | 97 | goto err_put_module; |
97 | 98 | ||
98 | mutex_lock(&dev->clientlist_mutex); | ||
99 | list_add(&client->list, &dev->clientlist); | ||
100 | mutex_unlock(&dev->clientlist_mutex); | ||
101 | |||
102 | drm_dev_get(dev); | 99 | drm_dev_get(dev); |
103 | 100 | ||
104 | return 0; | 101 | return 0; |
@@ -109,13 +106,33 @@ err_put_module: | |||
109 | 106 | ||
110 | return ret; | 107 | return ret; |
111 | } | 108 | } |
112 | EXPORT_SYMBOL(drm_client_new); | 109 | EXPORT_SYMBOL(drm_client_init); |
110 | |||
111 | /** | ||
112 | * drm_client_add - Add client to the device list | ||
113 | * @client: DRM client | ||
114 | * | ||
115 | * Add the client to the &drm_device client list to activate its callbacks. | ||
116 | * @client must be initialized by a call to drm_client_init(). After | ||
117 | * drm_client_add() it is no longer permissible to call drm_client_release() | ||
118 | * directly (outside the unregister callback), instead cleanup will happen | ||
119 | * automatically on driver unload. | ||
120 | */ | ||
121 | void drm_client_add(struct drm_client_dev *client) | ||
122 | { | ||
123 | struct drm_device *dev = client->dev; | ||
124 | |||
125 | mutex_lock(&dev->clientlist_mutex); | ||
126 | list_add(&client->list, &dev->clientlist); | ||
127 | mutex_unlock(&dev->clientlist_mutex); | ||
128 | } | ||
129 | EXPORT_SYMBOL(drm_client_add); | ||
113 | 130 | ||
114 | /** | 131 | /** |
115 | * drm_client_release - Release DRM client resources | 132 | * drm_client_release - Release DRM client resources |
116 | * @client: DRM client | 133 | * @client: DRM client |
117 | * | 134 | * |
118 | * Releases resources by closing the &drm_file that was opened by drm_client_new(). | 135 | * Releases resources by closing the &drm_file that was opened by drm_client_init(). |
119 | * It is called automatically if the &drm_client_funcs.unregister callback is _not_ set. | 136 | * It is called automatically if the &drm_client_funcs.unregister callback is _not_ set. |
120 | * | 137 | * |
121 | * This function should only be called from the unregister callback. An exception | 138 | * This function should only be called from the unregister callback. An exception |