Commit ef180d91 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sn: General code clean up of sn/io/io.c

From: Pat Gefre <pfg@sgi.com>

General code clean up of sn/io/io.c
parent a40fe5e4
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <asm/sn/sn_cpuid.h> #include <asm/sn/sn_cpuid.h>
extern xtalk_provider_t hub_provider; extern xtalk_provider_t hub_provider;
extern void hub_intr_init(vertex_hdl_t hubv);
static int force_fire_and_forget = 1; static int force_fire_and_forget = 1;
static int ignore_conveyor_override; static int ignore_conveyor_override;
...@@ -84,7 +83,7 @@ hub_pio_init(vertex_hdl_t hubv) ...@@ -84,7 +83,7 @@ hub_pio_init(vertex_hdl_t hubv)
} }
hub_set_piomode(nasid, HUB_PIO_CONVEYOR); hub_set_piomode(nasid, HUB_PIO_CONVEYOR);
mutex_spinlock_init(&hubinfo->h_bwlock); spin_lock_init(&hubinfo->h_bwlock);
init_waitqueue_head(&hubinfo->h_bwwait); init_waitqueue_head(&hubinfo->h_bwwait);
} }
...@@ -117,7 +116,6 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */ ...@@ -117,7 +116,6 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */
int bigwin, free_bw_index; int bigwin, free_bw_index;
nasid_t nasid; nasid_t nasid;
volatile hubreg_t junk; volatile hubreg_t junk;
unsigned long s;
caddr_t kvaddr; caddr_t kvaddr;
#ifdef PIOMAP_UNC_ACC_SPACE #ifdef PIOMAP_UNC_ACC_SPACE
uint64_t addr; uint64_t addr;
...@@ -165,7 +163,7 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */ ...@@ -165,7 +163,7 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */
*/ */
tryagain: tryagain:
free_bw_index = -1; free_bw_index = -1;
s = mutex_spinlock(&hubinfo->h_bwlock); spin_lock(&hubinfo->h_bwlock);
for (bigwin=0; bigwin < HUB_NUM_BIG_WINDOW; bigwin++) { for (bigwin=0; bigwin < HUB_NUM_BIG_WINDOW; bigwin++) {
bw_piomap = hubinfo_bwin_piomap_get(hubinfo, bigwin); bw_piomap = hubinfo_bwin_piomap_get(hubinfo, bigwin);
...@@ -185,7 +183,7 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */ ...@@ -185,7 +183,7 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */
if ( xtalk_addr == bw_piomap->hpio_xtalk_info.xp_xtalk_addr && if ( xtalk_addr == bw_piomap->hpio_xtalk_info.xp_xtalk_addr &&
widget == bw_piomap->hpio_xtalk_info.xp_target) { widget == bw_piomap->hpio_xtalk_info.xp_target) {
bw_piomap->hpio_holdcnt++; bw_piomap->hpio_holdcnt++;
mutex_spinunlock(&hubinfo->h_bwlock, s); spin_unlock(&hubinfo->h_bwlock);
return(bw_piomap); return(bw_piomap);
} }
} }
...@@ -265,7 +263,7 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */ ...@@ -265,7 +263,7 @@ hub_piomap_alloc(vertex_hdl_t dev, /* set up mapping for this device */
bw_piomap->hpio_flags |= HUB_PIOMAP_IS_VALID; bw_piomap->hpio_flags |= HUB_PIOMAP_IS_VALID;
done: done:
mutex_spinunlock(&hubinfo->h_bwlock, s); spin_unlock(&hubinfo->h_bwlock);
return(bw_piomap); return(bw_piomap);
} }
...@@ -285,7 +283,6 @@ hub_piomap_free(hub_piomap_t hub_piomap) ...@@ -285,7 +283,6 @@ hub_piomap_free(hub_piomap_t hub_piomap)
vertex_hdl_t hubv; vertex_hdl_t hubv;
hubinfo_t hubinfo; hubinfo_t hubinfo;
nasid_t nasid; nasid_t nasid;
unsigned long s;
/* /*
* Small windows are permanently mapped to corresponding widgets, * Small windows are permanently mapped to corresponding widgets,
...@@ -301,7 +298,7 @@ hub_piomap_free(hub_piomap_t hub_piomap) ...@@ -301,7 +298,7 @@ hub_piomap_free(hub_piomap_t hub_piomap)
hubinfo_get(hubv, &hubinfo); hubinfo_get(hubv, &hubinfo);
nasid = hubinfo->h_nasid; nasid = hubinfo->h_nasid;
s = mutex_spinlock(&hubinfo->h_bwlock); spin_lock(&hubinfo->h_bwlock);
/* /*
* If this is the last hold on this mapping, free it. * If this is the last hold on this mapping, free it.
...@@ -319,7 +316,7 @@ hub_piomap_free(hub_piomap_t hub_piomap) ...@@ -319,7 +316,7 @@ hub_piomap_free(hub_piomap_t hub_piomap)
wake_up(&hubinfo->h_bwwait); wake_up(&hubinfo->h_bwwait);
} }
mutex_spinunlock(&hubinfo->h_bwlock, s); spin_unlock(&hubinfo->h_bwlock);
} }
/* /*
...@@ -440,7 +437,7 @@ void ...@@ -440,7 +437,7 @@ void
hub_dmamap_free(hub_dmamap_t hub_dmamap) hub_dmamap_free(hub_dmamap_t hub_dmamap)
{ {
hub_dmamap->hdma_flags &= ~HUB_DMAMAP_IS_VALID; hub_dmamap->hdma_flags &= ~HUB_DMAMAP_IS_VALID;
kern_free(hub_dmamap); kfree(hub_dmamap);
} }
/* /*
...@@ -461,12 +458,9 @@ hub_dmamap_addr( hub_dmamap_t dmamap, /* use these mapping resources */ ...@@ -461,12 +458,9 @@ hub_dmamap_addr( hub_dmamap_t dmamap, /* use these mapping resources */
if (dmamap->hdma_flags & HUB_DMAMAP_USED) { if (dmamap->hdma_flags & HUB_DMAMAP_USED) {
/* If the map is FIXED, re-use is OK. */ /* If the map is FIXED, re-use is OK. */
if (!(dmamap->hdma_flags & HUB_DMAMAP_IS_FIXED)) { if (!(dmamap->hdma_flags & HUB_DMAMAP_IS_FIXED)) {
char name[MAXDEVNAME];
vhdl = dmamap->hdma_xtalk_info.xd_dev; vhdl = dmamap->hdma_xtalk_info.xd_dev;
#if defined(SUPPORT_PRINTING_V_FORMAT) printk(KERN_WARNING "%s: hub_dmamap_addr re-uses dmamap.\n", vertex_to_name(vhdl, name, MAXDEVNAME));
printk(KERN_WARNING "%v: hub_dmamap_addr re-uses dmamap.\n",vhdl);
#else
printk(KERN_WARNING "%p: hub_dmamap_addr re-uses dmamap.\n", (void *)vhdl);
#endif
} }
} else { } else {
dmamap->hdma_flags |= HUB_DMAMAP_USED; dmamap->hdma_flags |= HUB_DMAMAP_USED;
...@@ -494,12 +488,9 @@ hub_dmamap_list(hub_dmamap_t hub_dmamap, /* use these mapping resources */ ...@@ -494,12 +488,9 @@ hub_dmamap_list(hub_dmamap_t hub_dmamap, /* use these mapping resources */
if (hub_dmamap->hdma_flags & HUB_DMAMAP_USED) { if (hub_dmamap->hdma_flags & HUB_DMAMAP_USED) {
/* If the map is FIXED, re-use is OK. */ /* If the map is FIXED, re-use is OK. */
if (!(hub_dmamap->hdma_flags & HUB_DMAMAP_IS_FIXED)) { if (!(hub_dmamap->hdma_flags & HUB_DMAMAP_IS_FIXED)) {
char name[MAXDEVNAME];
vhdl = hub_dmamap->hdma_xtalk_info.xd_dev; vhdl = hub_dmamap->hdma_xtalk_info.xd_dev;
#if defined(SUPPORT_PRINTING_V_FORMAT) printk(KERN_WARNING "%s: hub_dmamap_list re-uses dmamap\n", vertex_to_name(vhdl, name, MAXDEVNAME));
printk(KERN_WARNING "%v: hub_dmamap_list re-uses dmamap\n",vhdl);
#else
printk(KERN_WARNING "%p: hub_dmamap_list re-uses dmamap\n", (void *)vhdl);
#endif
} }
} else { } else {
hub_dmamap->hdma_flags |= HUB_DMAMAP_USED; hub_dmamap->hdma_flags |= HUB_DMAMAP_USED;
...@@ -523,12 +514,9 @@ hub_dmamap_done(hub_dmamap_t hub_dmamap) /* done with these mapping resources */ ...@@ -523,12 +514,9 @@ hub_dmamap_done(hub_dmamap_t hub_dmamap) /* done with these mapping resources */
} else { } else {
/* If the map is FIXED, re-done is OK. */ /* If the map is FIXED, re-done is OK. */
if (!(hub_dmamap->hdma_flags & HUB_DMAMAP_IS_FIXED)) { if (!(hub_dmamap->hdma_flags & HUB_DMAMAP_IS_FIXED)) {
char name[MAXDEVNAME];
vhdl = hub_dmamap->hdma_xtalk_info.xd_dev; vhdl = hub_dmamap->hdma_xtalk_info.xd_dev;
#if defined(SUPPORT_PRINTING_V_FORMAT) printk(KERN_WARNING "%s: hub_dmamap_done already done with dmamap\n", vertex_to_name(vhdl, name, MAXDEVNAME));
printk(KERN_WARNING "%v: hub_dmamap_done already done with dmamap\n",vhdl);
#else
printk(KERN_WARNING "%p: hub_dmamap_done already done with dmamap\n", (void *)vhdl);
#endif
} }
} }
} }
...@@ -599,7 +587,6 @@ void ...@@ -599,7 +587,6 @@ void
hub_provider_startup(vertex_hdl_t hubv) hub_provider_startup(vertex_hdl_t hubv)
{ {
hub_pio_init(hubv); hub_pio_init(hubv);
hub_intr_init(hubv);
} }
/* /*
...@@ -806,4 +793,3 @@ xtalk_provider_t hub_provider = { ...@@ -806,4 +793,3 @@ xtalk_provider_t hub_provider = {
(xtalk_provider_startup_f *) hub_provider_startup, (xtalk_provider_startup_f *) hub_provider_startup,
(xtalk_provider_shutdown_f *) hub_provider_shutdown, (xtalk_provider_shutdown_f *) hub_provider_shutdown,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment