Skip to content

Commit

Permalink
Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/airlied/drm-2.6
  • Loading branch information
Linus Torvalds committed Feb 2, 2006
2 parents 0271fc2 + 30e2fb1 commit cf41f8a
Show file tree
Hide file tree
Showing 28 changed files with 248 additions and 175 deletions.
17 changes: 7 additions & 10 deletions drivers/char/drm/ati_pcigart.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@ static void *drm_ati_alloc_pcigart_table(void)
int i;
DRM_DEBUG("%s\n", __FUNCTION__);

address = __get_free_pages(GFP_KERNEL, ATI_PCIGART_TABLE_ORDER);
address = __get_free_pages(GFP_KERNEL | __GFP_COMP,
ATI_PCIGART_TABLE_ORDER);
if (address == 0UL) {
return 0;
return NULL;
}

page = virt_to_page(address);

for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) {
get_page(page);
for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++)
SetPageReserved(page);
}

DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address);
return (void *)address;
Expand All @@ -83,10 +82,8 @@ static void drm_ati_free_pcigart_table(void *address)

page = virt_to_page((unsigned long)address);

for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) {
__put_page(page);
for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++)
ClearPageReserved(page);
}

free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER);
}
Expand Down Expand Up @@ -127,7 +124,7 @@ int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
if (gart_info->gart_table_location == DRM_ATI_GART_MAIN
&& gart_info->addr) {
drm_ati_free_pcigart_table(gart_info->addr);
gart_info->addr = 0;
gart_info->addr = NULL;
}

return 1;
Expand Down Expand Up @@ -168,7 +165,7 @@ int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
if (bus_address == 0) {
DRM_ERROR("unable to map PCIGART pages!\n");
drm_ati_free_pcigart_table(address);
address = 0;
address = NULL;
goto done;
}
} else {
Expand Down
5 changes: 3 additions & 2 deletions drivers/char/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include <linux/smp_lock.h> /* For (un)lock_kernel */
#include <linux/mm.h>
#include <linux/cdev.h>
#include <linux/mutex.h>
#if defined(__alpha__) || defined(__powerpc__)
#include <asm/pgtable.h> /* For pte_wrprotect */
#endif
Expand Down Expand Up @@ -623,7 +624,7 @@ typedef struct drm_device {
/** \name Locks */
/*@{ */
spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
struct semaphore struct_sem; /**< For others */
struct mutex struct_mutex; /**< For others */
/*@} */

/** \name Usage Counters */
Expand Down Expand Up @@ -658,7 +659,7 @@ typedef struct drm_device {
/*@{ */
drm_ctx_list_t *ctxlist; /**< Linked list of context handles */
int ctx_count; /**< Number of context handles */
struct semaphore ctxlist_sem; /**< For ctxlist */
struct mutex ctxlist_mutex; /**< For ctxlist */

drm_map_t **context_sareas; /**< per-context SAREA's */
int max_context;
Expand Down
20 changes: 10 additions & 10 deletions drivers/char/drm/drm_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static int drm_hash_magic(drm_magic_t magic)
* \param magic magic number.
*
* Searches in drm_device::magiclist within all files with the same hash key
* the one with matching magic number, while holding the drm_device::struct_sem
* the one with matching magic number, while holding the drm_device::struct_mutex
* lock.
*/
static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
Expand All @@ -65,14 +65,14 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
drm_magic_entry_t *pt;
int hash = drm_hash_magic(magic);

down(&dev->struct_sem);
mutex_lock(&dev->struct_mutex);
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
if (pt->magic == magic) {
retval = pt->priv;
break;
}
}
up(&dev->struct_sem);
mutex_unlock(&dev->struct_mutex);
return retval;
}

Expand All @@ -85,7 +85,7 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
*
* Creates a drm_magic_entry structure and appends to the linked list
* associated the magic number hash key in drm_device::magiclist, while holding
* the drm_device::struct_sem lock.
* the drm_device::struct_mutex lock.
*/
static int drm_add_magic(drm_device_t * dev, drm_file_t * priv,
drm_magic_t magic)
Expand All @@ -104,15 +104,15 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv,
entry->priv = priv;
entry->next = NULL;

down(&dev->struct_sem);
mutex_lock(&dev->struct_mutex);
if (dev->magiclist[hash].tail) {
dev->magiclist[hash].tail->next = entry;
dev->magiclist[hash].tail = entry;
} else {
dev->magiclist[hash].head = entry;
dev->magiclist[hash].tail = entry;
}
up(&dev->struct_sem);
mutex_unlock(&dev->struct_mutex);

return 0;
}
Expand All @@ -124,7 +124,7 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv,
* \param magic magic number.
*
* Searches and unlinks the entry in drm_device::magiclist with the magic
* number hash key, while holding the drm_device::struct_sem lock.
* number hash key, while holding the drm_device::struct_mutex lock.
*/
static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
{
Expand All @@ -135,7 +135,7 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
DRM_DEBUG("%d\n", magic);
hash = drm_hash_magic(magic);

down(&dev->struct_sem);
mutex_lock(&dev->struct_mutex);
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
if (pt->magic == magic) {
if (dev->magiclist[hash].head == pt) {
Expand All @@ -147,11 +147,11 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
if (prev) {
prev->next = pt->next;
}
up(&dev->struct_sem);
mutex_unlock(&dev->struct_mutex);
return 0;
}
}
up(&dev->struct_sem);
mutex_unlock(&dev->struct_mutex);

drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);

Expand Down
Loading

0 comments on commit cf41f8a

Please sign in to comment.