Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68796
b: refs/heads/master
c: 3d06f7a
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Oct 15, 2007
1 parent 3e41be7 commit 18f55bb
Show file tree
Hide file tree
Showing 77 changed files with 2,710 additions and 3,508 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bdc3e603cda3433c2ccc2069d28f7f3cd319cfc6
refs/heads/master: 3d06f7a5f74a813cee817c4b30b5e6f0398da0be
1 change: 0 additions & 1 deletion trunk/arch/powerpc/platforms/ps3/system-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ static void ps3_system_bus_shutdown(struct device *_dev)
static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *env)
{
struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
int i = 0, length = 0;

if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id))
return -ENOMEM;
Expand Down
20 changes: 1 addition & 19 deletions trunk/drivers/char/drm/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,9 @@
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
#endif

#define XFREE86_VERSION(major,minor,patch,snap) \
((major << 16) | (minor << 8) | patch)

#ifndef CONFIG_XFREE86_VERSION
#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0)
#endif

#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
#define DRM_PROC_DEVICES "/proc/devices"
#define DRM_PROC_MISC "/proc/misc"
#define DRM_PROC_DRM "/proc/drm"
#define DRM_DEV_DRM "/dev/drm"
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#define DRM_DEV_UID 0
#define DRM_DEV_GID 0
#endif

#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
#define DRM_MAJOR 226
#define DRM_MAX_MINOR 15
#endif

#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */
Expand Down
237 changes: 125 additions & 112 deletions trunk/drivers/char/drm/drmP.h

Large diffs are not rendered by default.

130 changes: 40 additions & 90 deletions trunk/drivers/char/drm/drm_agpsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* Get AGP information.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a (output) drm_agp_info structure.
* \return zero on success or a negative number on failure.
Expand Down Expand Up @@ -71,20 +71,16 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)

EXPORT_SYMBOL(drm_agp_info);

int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
int drm_agp_info_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_info info;
struct drm_agp_info *info = data;
int err;

err = drm_agp_info(dev, &info);
err = drm_agp_info(dev, info);
if (err)
return err;

if (copy_to_user((struct drm_agp_info __user *) arg, &info, sizeof(info)))
return -EFAULT;
return 0;
}

Expand Down Expand Up @@ -115,20 +111,18 @@ EXPORT_SYMBOL(drm_agp_acquire);
* Acquire the AGP device (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument.
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device hasn't been acquired before and calls
* \c agp_backend_acquire.
*/
int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_file *priv = filp->private_data;

return drm_agp_acquire((struct drm_device *) priv->head->dev);
return drm_agp_acquire((struct drm_device *) file_priv->head->dev);
}

/**
Expand All @@ -149,12 +143,9 @@ int drm_agp_release(struct drm_device * dev)
}
EXPORT_SYMBOL(drm_agp_release);

int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
int drm_agp_release_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;

return drm_agp_release(dev);
}

Expand Down Expand Up @@ -182,24 +173,19 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode)

EXPORT_SYMBOL(drm_agp_enable);

int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_mode mode;

if (copy_from_user(&mode, (struct drm_agp_mode __user *) arg, sizeof(mode)))
return -EFAULT;
struct drm_agp_mode *mode = data;

return drm_agp_enable(dev, mode);
return drm_agp_enable(dev, *mode);
}

/**
* Allocate AGP memory.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv file private pointer.
* \param cmd command.
* \param arg pointer to a drm_agp_buffer structure.
* \return zero on success or a negative number on failure.
Expand Down Expand Up @@ -241,35 +227,13 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
}
EXPORT_SYMBOL(drm_agp_alloc);

int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_buffer request;
struct drm_agp_buffer __user *argp = (void __user *)arg;
int err;

if (copy_from_user(&request, argp, sizeof(request)))
return -EFAULT;

err = drm_agp_alloc(dev, &request);
if (err)
return err;

if (copy_to_user(argp, &request, sizeof(request))) {
struct drm_agp_mem *entry;
list_for_each_entry(entry, &dev->agp->memory, head) {
if (entry->handle == request.handle)
break;
}
list_del(&entry->head);
drm_free_agp(entry->memory, entry->pages);
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
return -EFAULT;
}
int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_agp_buffer *request = data;

return 0;
return drm_agp_alloc(dev, request);
}

/**
Expand Down Expand Up @@ -297,7 +261,7 @@ static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev,
* Unbind AGP memory from the GATT (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_agp_binding structure.
* \return zero on success or a negative number on failure.
Expand All @@ -323,25 +287,20 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
}
EXPORT_SYMBOL(drm_agp_unbind);

int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_binding request;

if (copy_from_user
(&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
return -EFAULT;
int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_agp_binding *request = data;

return drm_agp_unbind(dev, &request);
return drm_agp_unbind(dev, request);
}

/**
* Bind AGP memory into the GATT (ioctl)
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_agp_binding structure.
* \return zero on success or a negative number on failure.
Expand Down Expand Up @@ -372,25 +331,20 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
}
EXPORT_SYMBOL(drm_agp_bind);

int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_binding request;

if (copy_from_user
(&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
return -EFAULT;
int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_agp_binding *request = data;

return drm_agp_bind(dev, &request);
return drm_agp_bind(dev, request);
}

/**
* Free AGP memory (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_agp_buffer structure.
* \return zero on success or a negative number on failure.
Expand Down Expand Up @@ -419,18 +373,14 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
}
EXPORT_SYMBOL(drm_agp_free);

int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_buffer request;

if (copy_from_user
(&request, (struct drm_agp_buffer __user *) arg, sizeof(request)))
return -EFAULT;

return drm_agp_free(dev, &request);
int drm_agp_free_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_agp_buffer *request = data;

return drm_agp_free(dev, request);
}

/**
Expand Down
48 changes: 20 additions & 28 deletions trunk/drivers/char/drm/drm_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,70 +128,62 @@ static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
* Get a unique magic number (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a resulting drm_auth structure.
* \return zero on success, or a negative number on failure.
*
* If there is a magic number in drm_file::magic then use it, otherwise
* searches an unique non-zero magic number and add it associating it with \p
* filp.
* file_priv.
*/
int drm_getmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
static drm_magic_t sequence = 0;
static DEFINE_SPINLOCK(lock);
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_auth auth;
struct drm_auth *auth = data;

/* Find unique magic */
if (priv->magic) {
auth.magic = priv->magic;
if (file_priv->magic) {
auth->magic = file_priv->magic;
} else {
do {
spin_lock(&lock);
if (!sequence)
++sequence; /* reserve 0 */
auth.magic = sequence++;
auth->magic = sequence++;
spin_unlock(&lock);
} while (drm_find_file(dev, auth.magic));
priv->magic = auth.magic;
drm_add_magic(dev, priv, auth.magic);
} while (drm_find_file(dev, auth->magic));
file_priv->magic = auth->magic;
drm_add_magic(dev, file_priv, auth->magic);
}

DRM_DEBUG("%u\n", auth.magic);
if (copy_to_user((struct drm_auth __user *) arg, &auth, sizeof(auth)))
return -EFAULT;
DRM_DEBUG("%u\n", auth->magic);

return 0;
}

/**
* Authenticate with a magic.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_auth structure.
* \return zero if authentication successed, or a negative number otherwise.
*
* Checks if \p filp is associated with the magic number passed in \arg.
* Checks if \p file_priv is associated with the magic number passed in \arg.
*/
int drm_authmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
int drm_authmagic(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_auth auth;
struct drm_auth *auth = data;
struct drm_file *file;

if (copy_from_user(&auth, (struct drm_auth __user *) arg, sizeof(auth)))
return -EFAULT;
DRM_DEBUG("%u\n", auth.magic);
if ((file = drm_find_file(dev, auth.magic))) {
DRM_DEBUG("%u\n", auth->magic);
if ((file = drm_find_file(dev, auth->magic))) {
file->authenticated = 1;
drm_remove_magic(dev, auth.magic);
drm_remove_magic(dev, auth->magic);
return 0;
}
return -EINVAL;
Expand Down
Loading

0 comments on commit 18f55bb

Please sign in to comment.