Cleanup MIN/MAX Macro usage in eicon/di.c
PATCH 2/5 Cleanup MIN/MAX Macro usage in eicon/di.c
hi,
This patch changes eicon/di.c from MIN/MAX usage
to min/max.
drivers/isdn/hardware/eicon/di.c renamed from drivers/isdn/hardware/eicon/di.c.orig +4 -4
@@ -133,7 +133,7 @@ void pr_out(ADAPTER * a) i = this->XCurrent;X =PTR_X (a,this);while (i<this->XNum && length<270 ) { - clength =MIN ((word)(270 -length),X [i].PLength-this->XOffset); + clength =min ((word)(270 -length),(word)(X [i].PLength-this->XOffset)); a->ram_out_buffer(a, &ReqOut->XBuffer.P[length], PTR_P(a,this,&X[i].P[this->XOffset]),
@@ -622,7 +622,7 @@ byte isdn_ind(ADAPTER * a,sizeof (a->stream_buffer), &final, NULL, NULL); } - IoAdapter->RBuffer.length =MIN (MLength,270 ); + IoAdapter->RBuffer.length =min ((word )MLength, (word )270 );if (IoAdapter->RBuffer.length != MLength) { this->complete =0 ; }else {
@@ -676,9 +676,9 @@ byte isdn_ind(ADAPTER * a, this->RCurrent++; }if (cma) { - clength =MIN (MLength,R [this->RCurrent].PLength-this->ROffset); + clength =min (MLength, (word)(R [this->RCurrent].PLength-this->ROffset)); }else { - clength =MIN (a->ram_inw (a, &RBuffer->length)-offset, + clength =min (a->ram_inw (a, &RBuffer->length)-offset,R [this->RCurrent].PLength-this->ROffset); }if (R [this->RCurrent].P) {
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
drivers/isdn/hardware/eicon/di.c void pr_out(ADAPTER * a) · line 136
Quoted 2 lines · Eric Sesterhenn / snakebyte
drivers/isdn/hardware/eicon/di.c renamed from drivers/isdn/hardware/eicon/di.c.orig +1
-1- clength =MIN ((word)(270 -length),X [i].PLength-this->XOffset); + clength =min ((word)(270 -length),(word)(X [i].PLength-this->XOffset));
perhaps you should use min_t?
drivers/isdn/hardware/eicon/di.c byte isdn_ind(ADAPTER * a, · line 625
Quoted 2 lines
drivers/isdn/hardware/eicon/di.c renamed from drivers/isdn/hardware/eicon/di.c.orig +1
-1- IoAdapter->RBuffer.length =MIN (MLength,270 ); + IoAdapter->RBuffer.length =min ((word )MLength, (word )270 );
likewise.
drivers/isdn/hardware/eicon/di.c byte isdn_ind(ADAPTER * a, · line 679
Quoted 2 lines
drivers/isdn/hardware/eicon/di.c renamed from drivers/isdn/hardware/eicon/di.c.orig +1
-1- clength =MIN (MLength,R [this->RCurrent].PLength-this->ROffset); + clength =min (MLength, (word)(R [this->RCurrent].PLength-this->ROffset));
likewise.
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
hi,
Quoted 5 lines · Matthew Wilcox
Review
Quoted 2 lines · Eric Sesterhenn / snakebyte
(quoted diff) +1
-1- clength = MIN((word)(270-length),X[i].PLength-this->XOffset); + clength = min((word)(270-length),(word)(X[i].PLength-this->XOffset));perhaps you should use
min_t?
revisited patch, it now uses min_t instead of min, compile tested.
drivers/isdn/hardware/eicon/di.c renamed from drivers/isdn/hardware/eicon/di.c.orig +4 -4
@@ -133,7 +133,7 @@ void pr_out(ADAPTER * a) i = this->XCurrent;X =PTR_X (a,this);while (i<this->XNum && length<270 ) { - clength =MIN ((word)(270 -length),X [i].PLength-this->XOffset); + clength =min_t (word,270 -length,X [i].PLength-this->XOffset); a->ram_out_buffer(a, &ReqOut->XBuffer.P[length], PTR_P(a,this,&X[i].P[this->XOffset]),
@@ -622,7 +622,7 @@ byte isdn_ind(ADAPTER * a,sizeof (a->stream_buffer), &final, NULL, NULL); } - IoAdapter->RBuffer.length =MIN (MLength,270 ); + IoAdapter->RBuffer.length =min_t (word, MLength,270 );if (IoAdapter->RBuffer.length != MLength) { this->complete =0 ; }else {
@@ -676,9 +676,9 @@ byte isdn_ind(ADAPTER * a, this->RCurrent++; }if (cma) { - clength =MIN (MLength,R [this->RCurrent].PLength-this->ROffset); + clength =min_t (word, MLength,R [this->RCurrent].PLength-this->ROffset); }else { - clength =MIN (a->ram_inw (a, &RBuffer->length)-offset, + clength =min (a->ram_inw (a, &RBuffer->length)-offset,R [this->RCurrent].PLength-this->ROffset); }if (R [this->RCurrent].P) {
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors