Commit e2de257c authored by Amol Lad's avatar Amol Lad Committed by Linus Torvalds

[PATCH] drivers/isdn: Handcrafted MIN/MAX Macro removal

Cleanups done to use min/max macros from kernel.h.  Handcrafted MIN/MAX
macros are changed to use macros in kernel.h

[akpm@osdl.org: warning fix]
Signed-off-by: default avatarAmol Lad <amol@verismonetworks.com>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 90cc3018
...@@ -756,14 +756,14 @@ int diva_get_driver_info (dword id, byte* data, int data_length) { ...@@ -756,14 +756,14 @@ int diva_get_driver_info (dword id, byte* data, int data_length) {
data_length -= 9; data_length -= 9;
if ((to_copy = MIN(strlen(clients[id].drvName), data_length-1))) { if ((to_copy = min(strlen(clients[id].drvName), (size_t)(data_length-1)))) {
memcpy (p, clients[id].drvName, to_copy); memcpy (p, clients[id].drvName, to_copy);
p += to_copy; p += to_copy;
data_length -= to_copy; data_length -= to_copy;
if ((data_length >= 4) && clients[id].hDbg->drvTag[0]) { if ((data_length >= 4) && clients[id].hDbg->drvTag[0]) {
*p++ = '('; *p++ = '(';
data_length -= 1; data_length -= 1;
if ((to_copy = MIN(strlen(clients[id].hDbg->drvTag), data_length-2))) { if ((to_copy = min(strlen(clients[id].hDbg->drvTag), (size_t)(data_length-2)))) {
memcpy (p, clients[id].hDbg->drvTag, to_copy); memcpy (p, clients[id].hDbg->drvTag, to_copy);
p += to_copy; p += to_copy;
data_length -= to_copy; data_length -= to_copy;
......
...@@ -133,7 +133,7 @@ void pr_out(ADAPTER * a) ...@@ -133,7 +133,7 @@ void pr_out(ADAPTER * a)
i = this->XCurrent; i = this->XCurrent;
X = PTR_X(a,this); X = PTR_X(a,this);
while(i<this->XNum && length<270) { 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, a->ram_out_buffer(a,
&ReqOut->XBuffer.P[length], &ReqOut->XBuffer.P[length],
PTR_P(a,this,&X[i].P[this->XOffset]), PTR_P(a,this,&X[i].P[this->XOffset]),
...@@ -622,7 +622,7 @@ byte isdn_ind(ADAPTER * a, ...@@ -622,7 +622,7 @@ byte isdn_ind(ADAPTER * a,
sizeof(a->stream_buffer), sizeof(a->stream_buffer),
&final, NULL, NULL); &final, NULL, NULL);
} }
IoAdapter->RBuffer.length = MIN(MLength, 270); IoAdapter->RBuffer.length = min(MLength, (word)270);
if (IoAdapter->RBuffer.length != MLength) { if (IoAdapter->RBuffer.length != MLength) {
this->complete = 0; this->complete = 0;
} else { } else {
...@@ -676,9 +676,9 @@ byte isdn_ind(ADAPTER * a, ...@@ -676,9 +676,9 @@ byte isdn_ind(ADAPTER * a,
this->RCurrent++; this->RCurrent++;
} }
if (cma) { if (cma) {
clength = MIN(MLength, R[this->RCurrent].PLength-this->ROffset); clength = min(MLength, (word)(R[this->RCurrent].PLength-this->ROffset));
} else { } 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); R[this->RCurrent].PLength-this->ROffset);
} }
if(R[this->RCurrent].P) { if(R[this->RCurrent].P) {
......
...@@ -262,7 +262,7 @@ void request(PISDN_ADAPTER IoAdapter, ENTITY * e) ...@@ -262,7 +262,7 @@ void request(PISDN_ADAPTER IoAdapter, ENTITY * e)
case IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS: { case IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS: {
diva_xdi_get_capi_parameters_t prms, *pI = &syncReq->xdi_capi_prms.info; diva_xdi_get_capi_parameters_t prms, *pI = &syncReq->xdi_capi_prms.info;
memset (&prms, 0x00, sizeof(prms)); memset (&prms, 0x00, sizeof(prms));
prms.structure_length = MIN(sizeof(prms), pI->structure_length); prms.structure_length = min_t(size_t, sizeof(prms), pI->structure_length);
memset (pI, 0x00, pI->structure_length); memset (pI, 0x00, pI->structure_length);
prms.flag_dynamic_l1_down = (IoAdapter->capi_cfg.cfg_1 & \ prms.flag_dynamic_l1_down = (IoAdapter->capi_cfg.cfg_1 & \
DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON) ? 1 : 0; DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON) ? 1 : 0;
......
...@@ -92,7 +92,7 @@ int diva_istream_write (void* context, ...@@ -92,7 +92,7 @@ int diva_istream_write (void* context,
return (-1); /* was not able to write */ return (-1); /* was not able to write */
break; /* only part of message was written */ break; /* only part of message was written */
} }
to_write = MIN(length, DIVA_DFIFO_DATA_SZ); to_write = min(length, DIVA_DFIFO_DATA_SZ);
if (to_write) { if (to_write) {
a->ram_out_buffer (a, a->ram_out_buffer (a,
#ifdef PLATFORM_GT_32BIT #ifdef PLATFORM_GT_32BIT
...@@ -176,7 +176,7 @@ int diva_istream_read (void* context, ...@@ -176,7 +176,7 @@ int diva_istream_read (void* context,
return (-1); /* was not able to read */ return (-1); /* was not able to read */
break; break;
} }
to_read = MIN(max_length, tmp[1]); to_read = min(max_length, (int)tmp[1]);
if (to_read) { if (to_read) {
a->ram_in_buffer(a, a->ram_in_buffer(a,
#ifdef PLATFORM_GT_32BIT #ifdef PLATFORM_GT_32BIT
......
...@@ -83,14 +83,6 @@ ...@@ -83,14 +83,6 @@
#define NULL ((void *) 0) #define NULL ((void *) 0)
#endif #endif
#ifndef MIN
#define MIN(a,b) ((a)>(b) ? (b) : (a))
#endif
#ifndef MAX
#define MAX(a,b) ((a)>(b) ? (a) : (b))
#endif
#ifndef far #ifndef far
#define far #define far
#endif #endif
......
Markdown is supported
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