mirror of https://gitee.com/openkylin/linux.git
nubus: Clean up whitespace
Signed-off-by: Finn Thain <fthain@telegraphics.com.au> [geert: rebased] Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
parent
71ae40e4cf
commit
f42e555096
|
@ -73,6 +73,7 @@ struct nubus_board* nubus_boards;
|
|||
static inline int not_useful(void *p, int map)
|
||||
{
|
||||
unsigned long pv = (unsigned long)p;
|
||||
|
||||
pv &= 3;
|
||||
if (map & (1 << pv))
|
||||
return 0;
|
||||
|
@ -85,8 +86,7 @@ static unsigned long nubus_get_rom(unsigned char **ptr, int len, int map)
|
|||
unsigned long v = 0;
|
||||
unsigned char *p = *ptr;
|
||||
|
||||
while(len)
|
||||
{
|
||||
while (len) {
|
||||
v <<= 8;
|
||||
while (not_useful(p, map))
|
||||
p++;
|
||||
|
@ -104,13 +104,10 @@ static void nubus_rewind(unsigned char **ptr, int len, int map)
|
|||
/* Sanity check */
|
||||
if (len > 65536)
|
||||
pr_err("rewind of 0x%08x!\n", len);
|
||||
while(len)
|
||||
{
|
||||
do
|
||||
{
|
||||
while (len) {
|
||||
do {
|
||||
p--;
|
||||
}
|
||||
while(not_useful(p, map));
|
||||
} while (not_useful(p, map));
|
||||
len--;
|
||||
}
|
||||
*ptr = p;
|
||||
|
@ -119,10 +116,10 @@ static void nubus_rewind(unsigned char **ptr, int len, int map)
|
|||
static void nubus_advance(unsigned char **ptr, int len, int map)
|
||||
{
|
||||
unsigned char *p = *ptr;
|
||||
|
||||
if (len > 65536)
|
||||
pr_err("advance of 0x%08x!\n", len);
|
||||
while(len)
|
||||
{
|
||||
while (len) {
|
||||
while (not_useful(p, map))
|
||||
p++;
|
||||
p++;
|
||||
|
@ -165,6 +162,7 @@ static inline void *nubus_rom_addr(int slot)
|
|||
static unsigned char *nubus_dirptr(const struct nubus_dirent *nd)
|
||||
{
|
||||
unsigned char *p = nd->base;
|
||||
|
||||
/* Essentially, just step over the bytelanes using whatever
|
||||
offset we might have found */
|
||||
nubus_move(&p, nubus_expand32(nd->data), nd->mask);
|
||||
|
@ -180,8 +178,8 @@ void nubus_get_rsrc_mem(void *dest, const struct nubus_dirent* dirent,
|
|||
{
|
||||
unsigned char *t = (unsigned char *)dest;
|
||||
unsigned char *p = nubus_dirptr(dirent);
|
||||
while(len)
|
||||
{
|
||||
|
||||
while (len) {
|
||||
*t++ = nubus_get_rom(&p, 1, dirent->mask);
|
||||
len--;
|
||||
}
|
||||
|
@ -193,8 +191,8 @@ void nubus_get_rsrc_str(void *dest, const struct nubus_dirent* dirent,
|
|||
{
|
||||
unsigned char *t = (unsigned char *)dest;
|
||||
unsigned char *p = nubus_dirptr(dirent);
|
||||
while(len)
|
||||
{
|
||||
|
||||
while (len) {
|
||||
*t = nubus_get_rom(&p, 1, dirent->mask);
|
||||
if (!*t++)
|
||||
break;
|
||||
|
@ -256,6 +254,7 @@ EXPORT_SYMBOL(nubus_get_subdir);
|
|||
int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent)
|
||||
{
|
||||
u32 resid;
|
||||
|
||||
if (nd->done)
|
||||
return -1;
|
||||
|
||||
|
@ -266,8 +265,7 @@ int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent)
|
|||
resid = nubus_get_rom(&nd->ptr, 4, nd->mask);
|
||||
|
||||
/* EOL marker, as per the Apple docs */
|
||||
if((resid&0xff000000) == 0xff000000)
|
||||
{
|
||||
if ((resid & 0xff000000) == 0xff000000) {
|
||||
/* Mark it as done */
|
||||
nd->done = 1;
|
||||
return -1;
|
||||
|
@ -286,7 +284,6 @@ int nubus_rewinddir(struct nubus_dir* dir)
|
|||
{
|
||||
dir->ptr = dir->base;
|
||||
dir->done = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(nubus_rewinddir);
|
||||
|
@ -294,20 +291,15 @@ EXPORT_SYMBOL(nubus_rewinddir);
|
|||
/* Driver interface functions, more or less like in pci.c */
|
||||
|
||||
struct nubus_dev*
|
||||
nubus_find_device(unsigned short category,
|
||||
unsigned short type,
|
||||
unsigned short dr_hw,
|
||||
unsigned short dr_sw,
|
||||
nubus_find_device(unsigned short category, unsigned short type,
|
||||
unsigned short dr_hw, unsigned short dr_sw,
|
||||
const struct nubus_dev *from)
|
||||
{
|
||||
struct nubus_dev* itor =
|
||||
from ? from->next : nubus_devices;
|
||||
struct nubus_dev *itor = from ? from->next : nubus_devices;
|
||||
|
||||
while (itor) {
|
||||
if (itor->category == category
|
||||
&& itor->type == type
|
||||
&& itor->dr_hw == dr_hw
|
||||
&& itor->dr_sw == dr_sw)
|
||||
if (itor->category == category && itor->type == type &&
|
||||
itor->dr_hw == dr_hw && itor->dr_sw == dr_sw)
|
||||
return itor;
|
||||
itor = itor->next;
|
||||
}
|
||||
|
@ -316,16 +308,13 @@ nubus_find_device(unsigned short category,
|
|||
EXPORT_SYMBOL(nubus_find_device);
|
||||
|
||||
struct nubus_dev*
|
||||
nubus_find_type(unsigned short category,
|
||||
unsigned short type,
|
||||
nubus_find_type(unsigned short category, unsigned short type,
|
||||
const struct nubus_dev *from)
|
||||
{
|
||||
struct nubus_dev* itor =
|
||||
from ? from->next : nubus_devices;
|
||||
struct nubus_dev *itor = from ? from->next : nubus_devices;
|
||||
|
||||
while (itor) {
|
||||
if (itor->category == category
|
||||
&& itor->type == type)
|
||||
if (itor->category == category && itor->type == type)
|
||||
return itor;
|
||||
itor = itor->next;
|
||||
}
|
||||
|
@ -334,11 +323,9 @@ nubus_find_type(unsigned short category,
|
|||
EXPORT_SYMBOL(nubus_find_type);
|
||||
|
||||
struct nubus_dev*
|
||||
nubus_find_slot(unsigned int slot,
|
||||
const struct nubus_dev* from)
|
||||
nubus_find_slot(unsigned int slot, const struct nubus_dev *from)
|
||||
{
|
||||
struct nubus_dev* itor =
|
||||
from ? from->next : nubus_devices;
|
||||
struct nubus_dev *itor = from ? from->next : nubus_devices;
|
||||
|
||||
while (itor) {
|
||||
if (itor->board->slot == slot)
|
||||
|
@ -414,6 +401,7 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev,
|
|||
case NUBUS_RESID_MEMINFO:
|
||||
{
|
||||
unsigned long meminfo[2];
|
||||
|
||||
nubus_get_rsrc_mem(&meminfo, ent, 8);
|
||||
pr_info(" memory: [ 0x%08lx 0x%08lx ]\n",
|
||||
meminfo[0], meminfo[1]);
|
||||
|
@ -422,6 +410,7 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev,
|
|||
case NUBUS_RESID_ROMINFO:
|
||||
{
|
||||
unsigned long rominfo[2];
|
||||
|
||||
nubus_get_rsrc_mem(&rominfo, ent, 8);
|
||||
pr_info(" ROM: [ 0x%08lx 0x%08lx ]\n",
|
||||
rominfo[0], rominfo[1]);
|
||||
|
@ -455,8 +444,7 @@ static int __init nubus_show_private_resource(struct nubus_dev* dev,
|
|||
}
|
||||
|
||||
static struct nubus_dev * __init
|
||||
nubus_get_functional_resource(struct nubus_board* board,
|
||||
int slot,
|
||||
nubus_get_functional_resource(struct nubus_board *board, int slot,
|
||||
const struct nubus_dirent *parent)
|
||||
{
|
||||
struct nubus_dir dir;
|
||||
|
@ -480,13 +468,12 @@ static struct nubus_dev* __init
|
|||
dev->directory = dir.base;
|
||||
dev->board = board;
|
||||
|
||||
while (nubus_readdir(&dir, &ent) != -1)
|
||||
{
|
||||
switch(ent.type)
|
||||
{
|
||||
while (nubus_readdir(&dir, &ent) != -1) {
|
||||
switch (ent.type) {
|
||||
case NUBUS_RESID_TYPE:
|
||||
{
|
||||
unsigned short nbtdata[4];
|
||||
|
||||
nubus_get_rsrc_mem(nbtdata, &ent, 8);
|
||||
dev->category = nbtdata[0];
|
||||
dev->type = nbtdata[1];
|
||||
|
@ -508,6 +495,7 @@ static struct nubus_dev* __init
|
|||
use this :-) */
|
||||
struct nubus_dir drvr_dir;
|
||||
struct nubus_dirent drvr_ent;
|
||||
|
||||
nubus_get_subdir(&ent, &drvr_dir);
|
||||
nubus_readdir(&drvr_dir, &drvr_ent);
|
||||
dev->driver = nubus_dirptr(&drvr_ent);
|
||||
|
@ -550,6 +538,7 @@ static int __init nubus_get_vidnames(struct nubus_board* board,
|
|||
{
|
||||
struct nubus_dir dir;
|
||||
struct nubus_dirent ent;
|
||||
|
||||
/* FIXME: obviously we want to put this in a header file soon */
|
||||
struct vidmode {
|
||||
u32 size;
|
||||
|
@ -564,8 +553,7 @@ static int __init nubus_get_vidnames(struct nubus_board* board,
|
|||
pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
|
||||
__func__, parent->base, dir.base);
|
||||
|
||||
while(nubus_readdir(&dir, &ent) != -1)
|
||||
{
|
||||
while (nubus_readdir(&dir, &ent) != -1) {
|
||||
struct vidmode mode;
|
||||
u32 size;
|
||||
|
||||
|
@ -600,8 +588,7 @@ static int __init nubus_get_icon(struct nubus_board* board,
|
|||
for (y = 0; y < 32; y++) {
|
||||
pr_info(" ");
|
||||
for (x = 0; x < 32; x++) {
|
||||
if (icon[y*4 + x/8]
|
||||
& (0x80 >> (x%8)))
|
||||
if (icon[y * 4 + x / 8] & (0x80 >> (x % 8)))
|
||||
pr_cont("*");
|
||||
else
|
||||
pr_cont(" ");
|
||||
|
@ -624,8 +611,7 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board,
|
|||
pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
|
||||
__func__, parent->base, dir.base);
|
||||
|
||||
while(nubus_readdir(&dir, &ent) != -1)
|
||||
{
|
||||
while (nubus_readdir(&dir, &ent) != -1) {
|
||||
char name[64];
|
||||
|
||||
/* These are all strings, we think */
|
||||
|
@ -647,8 +633,7 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot,
|
|||
pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
|
||||
__func__, parent->base, dir.base);
|
||||
|
||||
while(nubus_readdir(&dir, &ent) != -1)
|
||||
{
|
||||
while (nubus_readdir(&dir, &ent) != -1) {
|
||||
switch (ent.type) {
|
||||
case NUBUS_RESID_TYPE:
|
||||
{
|
||||
|
@ -788,7 +773,6 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)
|
|||
{
|
||||
struct nubus_board *board;
|
||||
struct nubus_board **boardp;
|
||||
|
||||
unsigned char *rp;
|
||||
unsigned long dpat;
|
||||
struct nubus_dir dir;
|
||||
|
@ -871,6 +855,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)
|
|||
while (nubus_readdir(&dir, &ent) != -1) {
|
||||
struct nubus_dev *dev;
|
||||
struct nubus_dev **devp;
|
||||
|
||||
dev = nubus_get_functional_resource(board, slot, &ent);
|
||||
if (dev == NULL)
|
||||
continue;
|
||||
|
@ -880,14 +865,16 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)
|
|||
board->first_dev = dev;
|
||||
|
||||
/* Put it on the global NuBus device chain. Keep entries in order. */
|
||||
for (devp=&nubus_devices; *devp!=NULL; devp=&((*devp)->next))
|
||||
for (devp = &nubus_devices; *devp != NULL;
|
||||
devp = &((*devp)->next))
|
||||
/* spin */;
|
||||
*devp = dev;
|
||||
dev->next = NULL;
|
||||
}
|
||||
|
||||
/* Put it on the global NuBus board chain. Keep entries in order. */
|
||||
for (boardp=&nubus_boards; *boardp!=NULL; boardp=&((*boardp)->next))
|
||||
for (boardp = &nubus_boards; *boardp != NULL;
|
||||
boardp = &((*boardp)->next))
|
||||
/* spin */;
|
||||
*boardp = board;
|
||||
board->next = NULL;
|
||||
|
@ -902,8 +889,7 @@ void __init nubus_probe_slot(int slot)
|
|||
int i;
|
||||
|
||||
rp = nubus_rom_addr(slot);
|
||||
for(i = 4; i; i--)
|
||||
{
|
||||
for (i = 4; i; i--) {
|
||||
int card_present;
|
||||
|
||||
rp--;
|
||||
|
@ -935,12 +921,12 @@ void __init nubus_probe_slot(int slot)
|
|||
void __init nubus_scan_bus(void)
|
||||
{
|
||||
int slot;
|
||||
|
||||
/* This might not work on your machine */
|
||||
#ifdef I_WANT_TO_PROBE_SLOT_ZERO
|
||||
nubus_probe_slot(0);
|
||||
#endif
|
||||
for(slot = 9; slot < 15; slot++)
|
||||
{
|
||||
for (slot = 9; slot < 15; slot++) {
|
||||
nubus_probe_slot(slot);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue