Simplify yenta code
PATCH 1/1 Simplify yenta code
Simplify some of the resource detection logic in yenta_socket. This patch results in the same run-time behaviour as the current code, but does so with fewer lines of code. This makes the logical flow of the code a bit easier to understand.
Signed-off-by Linas Vepstas <[email protected]>
Cc Dominik Brodowski <[email protected]>
----
drivers/pcmcia/yenta_socket.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/pcmcia/yenta_socket.c +8 -14
@@ -654,20 +654,14 @@ static int yenta_allocate_res(struct yen pci_name(socket->dev), nr); } -if (type &IORESOURCE_IO ) { -if ((yenta_search_res (socket, res,BRIDGE_IO_MAX )) || - (yenta_search_res (socket, res,BRIDGE_IO_ACC )) || - (yenta_search_res (socket, res,BRIDGE_IO_MIN ))) -return 1 ; - }else { -if (type &IORESOURCE_PREFETCH ) { -if ((yenta_search_res (socket, res,BRIDGE_MEM_MAX )) || - (yenta_search_res (socket, res,BRIDGE_MEM_ACC )) || - (yenta_search_res (socket, res,BRIDGE_MEM_MIN ))) -return 1 ; -/* Approximating prefetchable by non-prefetchable */ - res->flags =IORESOURCE_MEM ; - } +if ((yenta_search_res (socket, res,BRIDGE_MEM_MAX )) || + (yenta_search_res (socket, res,BRIDGE_MEM_ACC )) || + (yenta_search_res (socket, res,BRIDGE_MEM_MIN ))) +return 1 ; + +if (type &IORESOURCE_PREFETCH ) { +/* Approximating prefetchable by non-prefetchable */ + res->flags =IORESOURCE_MEM ;if ((yenta_search_res (socket, res,BRIDGE_MEM_MAX )) || (yenta_search_res (socket, res,BRIDGE_MEM_ACC )) || (yenta_search_res (socket, res,BRIDGE_MEM_MIN )))
Quoted 7 lines · Linas Vepstas
drivers/pcmcia/yenta_socket.c +0
-7-if (type &IORESOURCE_IO ) { -if ((yenta_search_res (socket, res,BRIDGE_IO_MAX )) || - (yenta_search_res (socket, res,BRIDGE_IO_ACC )) || - (yenta_search_res (socket, res,BRIDGE_IO_MIN ))) -return 1 ; - }else { -if (type &IORESOURCE_PREFETCH ) {
drivers/pcmcia/yenta_socket.c static int yenta_allocate_res(struct yen · line 659
Quoted 10 lines
drivers/pcmcia/yenta_socket.c +3
-7-if ((yenta_search_res (socket, res,BRIDGE_MEM_MAX )) || - (yenta_search_res (socket, res,BRIDGE_MEM_ACC )) || - (yenta_search_res (socket, res,BRIDGE_MEM_MIN ))) -return 1 ; -/* Approximating prefetchable by non-prefetchable */ - res->flags =IORESOURCE_MEM ; - } +if ((yenta_search_res (socket, res,BRIDGE_MEM_MAX )) || + (yenta_search_res (socket, res,BRIDGE_MEM_ACC )) || + (yenta_search_res (socket, res,BRIDGE_MEM_MIN )))
Are BRIDGE_IO_MAX and BRIDGE_MEM_MAX guaranteed to be the same?
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 2 lines · Matthew Wilcox
Are
BRIDGE_IO_MAXandBRIDGE_MEM_MAXguaranteed to be the same?
@#$%^&*. Red-faced, I withdraw the patch. Must be cross-eyed on a Monday morning. Sorry.
--linas