aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_auth.c')
-rw-r--r--drivers/char/drm/drm_auth.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/char/drm/drm_auth.c b/drivers/char/drm/drm_auth.c
index 7f777da872c..dc66cfef7ec 100644
--- a/drivers/char/drm/drm_auth.c
+++ b/drivers/char/drm/drm_auth.c
@@ -128,27 +128,26 @@ static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
128 * Get a unique magic number (ioctl). 128 * Get a unique magic number (ioctl).
129 * 129 *
130 * \param inode device inode. 130 * \param inode device inode.
131 * \param filp file pointer. 131 * \param file_priv DRM file private.
132 * \param cmd command. 132 * \param cmd command.
133 * \param arg pointer to a resulting drm_auth structure. 133 * \param arg pointer to a resulting drm_auth structure.
134 * \return zero on success, or a negative number on failure. 134 * \return zero on success, or a negative number on failure.
135 * 135 *
136 * If there is a magic number in drm_file::magic then use it, otherwise 136 * If there is a magic number in drm_file::magic then use it, otherwise
137 * searches an unique non-zero magic number and add it associating it with \p 137 * searches an unique non-zero magic number and add it associating it with \p
138 * filp. 138 * file_priv.
139 */ 139 */
140int drm_getmagic(struct inode *inode, struct file *filp, 140int drm_getmagic(struct inode *inode, struct drm_file *file_priv,
141 unsigned int cmd, unsigned long arg) 141 unsigned int cmd, unsigned long arg)
142{ 142{
143 static drm_magic_t sequence = 0; 143 static drm_magic_t sequence = 0;
144 static DEFINE_SPINLOCK(lock); 144 static DEFINE_SPINLOCK(lock);
145 struct drm_file *priv = filp->private_data; 145 struct drm_device *dev = file_priv->head->dev;
146 struct drm_device *dev = priv->head->dev;
147 struct drm_auth auth; 146 struct drm_auth auth;
148 147
149 /* Find unique magic */ 148 /* Find unique magic */
150 if (priv->magic) { 149 if (file_priv->magic) {
151 auth.magic = priv->magic; 150 auth.magic = file_priv->magic;
152 } else { 151 } else {
153 do { 152 do {
154 spin_lock(&lock); 153 spin_lock(&lock);
@@ -157,8 +156,8 @@ int drm_getmagic(struct inode *inode, struct file *filp,
157 auth.magic = sequence++; 156 auth.magic = sequence++;
158 spin_unlock(&lock); 157 spin_unlock(&lock);
159 } while (drm_find_file(dev, auth.magic)); 158 } while (drm_find_file(dev, auth.magic));
160 priv->magic = auth.magic; 159 file_priv->magic = auth.magic;
161 drm_add_magic(dev, priv, auth.magic); 160 drm_add_magic(dev, file_priv, auth.magic);
162 } 161 }
163 162
164 DRM_DEBUG("%u\n", auth.magic); 163 DRM_DEBUG("%u\n", auth.magic);
@@ -171,18 +170,17 @@ int drm_getmagic(struct inode *inode, struct file *filp,
171 * Authenticate with a magic. 170 * Authenticate with a magic.
172 * 171 *
173 * \param inode device inode. 172 * \param inode device inode.
174 * \param filp file pointer. 173 * \param file_priv DRM file private.
175 * \param cmd command. 174 * \param cmd command.
176 * \param arg pointer to a drm_auth structure. 175 * \param arg pointer to a drm_auth structure.
177 * \return zero if authentication successed, or a negative number otherwise. 176 * \return zero if authentication successed, or a negative number otherwise.
178 * 177 *
179 * Checks if \p filp is associated with the magic number passed in \arg. 178 * Checks if \p file_priv is associated with the magic number passed in \arg.
180 */ 179 */
181int drm_authmagic(struct inode *inode, struct file *filp, 180int drm_authmagic(struct inode *inode, struct drm_file *file_priv,
182 unsigned int cmd, unsigned long arg) 181 unsigned int cmd, unsigned long arg)
183{ 182{
184 struct drm_file *priv = filp->private_data; 183 struct drm_device *dev = file_priv->head->dev;
185 struct drm_device *dev = priv->head->dev;
186 struct drm_auth auth; 184 struct drm_auth auth;
187 struct drm_file *file; 185 struct drm_file *file;
188 186