Commit 144e988d authored by Sam Ravnborg's avatar Sam Ravnborg Committed by David S. Miller
Browse files

sparc32: code cleanup in floppy glue



Small cleanup to improve readability.
Dropped one test for sparc_cpu_model -
we already know that only sun4m support floppy.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 918f8322
...@@ -288,10 +288,11 @@ static int sun_floppy_init(void) ...@@ -288,10 +288,11 @@ static int sun_floppy_init(void)
{ {
struct platform_device *op; struct platform_device *op;
struct device_node *dp; struct device_node *dp;
struct resource r;
char state[128]; char state[128];
phandle tnode, fd_node; phandle fd_node;
phandle tnode;
int num_regs; int num_regs;
struct resource r;
use_virtual_dma = 1; use_virtual_dma = 1;
...@@ -305,19 +306,18 @@ static int sun_floppy_init(void) ...@@ -305,19 +306,18 @@ static int sun_floppy_init(void)
/* Well, try to find one. */ /* Well, try to find one. */
tnode = prom_getchild(prom_root_node); tnode = prom_getchild(prom_root_node);
fd_node = prom_searchsiblings(tnode, "obio"); fd_node = prom_searchsiblings(tnode, "obio");
if(fd_node != 0) { if (fd_node != 0) {
tnode = prom_getchild(fd_node); tnode = prom_getchild(fd_node);
fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo"); fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo");
} else { } else {
fd_node = prom_searchsiblings(tnode, "fd"); fd_node = prom_searchsiblings(tnode, "fd");
} }
if(fd_node == 0) { if (fd_node == 0) {
goto no_sun_fdc; goto no_sun_fdc;
} }
/* The sun4m lets us know if the controller is actually usable. */ /* The sun4m lets us know if the controller is actually usable. */
if(sparc_cpu_model == sun4m && if (prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) {
prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) {
if(!strcmp(state, "disabled")) { if(!strcmp(state, "disabled")) {
goto no_sun_fdc; goto no_sun_fdc;
} }
...@@ -328,8 +328,7 @@ static int sun_floppy_init(void) ...@@ -328,8 +328,7 @@ static int sun_floppy_init(void)
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
r.flags = fd_regs[0].which_io; r.flags = fd_regs[0].which_io;
r.start = fd_regs[0].phys_addr; r.start = fd_regs[0].phys_addr;
sun_fdc = (struct sun_flpy_controller *) sun_fdc = of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
/* Look up irq in platform_device. /* Look up irq in platform_device.
* We try "SUNW,fdtwo" and "fd" * We try "SUNW,fdtwo" and "fd"
...@@ -353,7 +352,7 @@ static int sun_floppy_init(void) ...@@ -353,7 +352,7 @@ static int sun_floppy_init(void)
FLOPPY_IRQ = op->archdata.irqs[0]; FLOPPY_IRQ = op->archdata.irqs[0];
/* Last minute sanity check... */ /* Last minute sanity check... */
if(sun_fdc->status_82072 == 0xff) { if (sun_fdc->status_82072 == 0xff) {
sun_fdc = NULL; sun_fdc = NULL;
goto no_sun_fdc; goto no_sun_fdc;
} }
......
Supports Markdown
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