[PATCH] Fix up return value from dio_find() (fixing a FIXME)
From: Jesper Juhl (juhl-lkml_at_dif.dk)
Date: 07/31/04
- Previous message: Lee Revell: "Re: PATCH: VLAN support for 3c59x/3c90x"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 31 Jul 2004 22:47:40 +0200 (CEST) To: LKML <linux-kernel@vger.kernel.org>
Here's a patch to fix up this FIXME in drivers/dio/dio.c:dio_find() :
* Aargh: we use 0 for an error return code, but select code 0 exists!
* FIXME (trivial, use -1, but requires changes to all the drivers :-< )
*/
I've changed the return value to -1 as suggested by the comment, and then
went looking for the drivers that needed to be changed (as the comment
mentions). I only found two users of dio_find() and I've fixed those up to
not treat 0 as an error, but only values <0.
The FIXME implies (to me at least) that there are many drivers that would
need to be changed, but I could only find two - did I miss anything?
Also, I don't have the hardware to test the drivers I've changed, so I've
done compile testing only - could someone please review my changes and
confirm if they are correct?
Patch is against 2.6.8-rc2-mm1
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
diff -urp linux-2.6.8-rc2-mm1-orig/drivers/dio/dio.c linux-2.6.8-rc2-mm1/drivers/dio/dio.c
--- linux-2.6.8-rc2-mm1-orig/drivers/dio/dio.c 2004-06-16 07:19:43.000000000 +0200
+++ linux-2.6.8-rc2-mm1/drivers/dio/dio.c 2004-07-31 19:12:26.000000000 +0200
@@ -148,9 +148,6 @@ static int __init dio_find_slow(int devi
return 0;
}
-/* Aargh: we use 0 for an error return code, but select code 0 exists!
- * FIXME (trivial, use -1, but requires changes to all the drivers :-< )
- */
int dio_find(int deviceid)
{
if (blist)
@@ -160,7 +157,7 @@ int dio_find(int deviceid)
for (b = blist; b; b = b->next)
if (b->id == deviceid && b->configured == 0)
return b->scode;
- return 0;
+ return -1;
}
return dio_find_slow(deviceid);
}
diff -urp linux-2.6.8-rc2-mm1-orig/drivers/net/hplance.c linux-2.6.8-rc2-mm1/drivers/net/hplance.c
--- linux-2.6.8-rc2-mm1-orig/drivers/net/hplance.c 2004-06-16 07:19:22.000000000 +0200
+++ linux-2.6.8-rc2-mm1/drivers/net/hplance.c 2004-07-31 19:10:12.000000000 +0200
@@ -91,7 +91,7 @@ struct net_device * __init hplance_probe
{
int scode = dio_find(DIO_ID_LAN);
- if (!scode)
+ if (scode < 0)
break;
dio_config_board(scode);
diff -urp linux-2.6.8-rc2-mm1-orig/drivers/video/hpfb.c linux-2.6.8-rc2-mm1/drivers/video/hpfb.c
--- linux-2.6.8-rc2-mm1-orig/drivers/video/hpfb.c 2004-06-16 07:19:26.000000000 +0200
+++ linux-2.6.8-rc2-mm1/drivers/video/hpfb.c 2004-07-31 13:59:47.000000000 +0200
@@ -197,7 +197,7 @@ int __init hpfb_init(void)
} else {
int sc = dio_find(DIO_ID_FBUFFER);
- if (sc) {
+ if (sc >= 0) {
unsigned long addr = (unsigned long)dio_scodetoviraddr(sc);
unsigned int sid = DIO_SECID(addr);
-- Jesper Juhl <juhl-lkml@dif.dk> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Lee Revell: "Re: PATCH: VLAN support for 3c59x/3c90x"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: 2.6.10-rc2 on VAIO laptop and PowerMac 8500/G3
... fbdev layer broke some of those old drivers. ... VT mode data structure,
the driver is now sort-of supposed to re-invent ... but I suppose I'll have to fix controlfb
(and platinumfb ... send the line "unsubscribe linux-kernel" in ... (Linux-Kernel) - RE: Driver Model 2 Proposal - Linux Kernel Performance v Usability
... I agree that it is an extra interface ... > Windows has many faults but drivers
are often compatible across ... common users in the Windows world can't handle installing
a driver any better than they would be able to in Linux. ... send the line "unsubscribe linux-kernel"
in ... (Linux-Kernel) - Re: [Bug 1412] Copy from USB1 CF/SM reader stalls, no actual content is read (only directory structu
... For drivers like this that aren't performance critical and ... > depends
on the capabilities of the USB host controller that our device ... and if the result is
0 then calling kmap() ... send the line "unsubscribe linux-kernel" in ...
(Linux-Kernel) - Re: HighPoint 374
... > I'm using two seagates, one Samsung and one Maxtor, ... > drivers,
pretty much everything that does not relate directly to the IDE ... send the line "unsubscribe
linux-kernel" in ... (Linux-Kernel) - Re: Losing interrupts
... > bus to completely freeze until the FIFO had drained. ... at which point
they fixed their drivers. ... send the line "unsubscribe linux-kernel" in ...
(Linux-Kernel)