Remove the remain MIN/MAX like macro

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2023-02-03 21:42:03 +08:00
committed by Xiang Xiao
parent d1162ac58f
commit 7625126c91
17 changed files with 60 additions and 110 deletions
+5 -15
View File
@@ -37,6 +37,8 @@
#include <errno.h>
#include <debug.h>
#include <sys/param.h>
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
@@ -199,18 +201,6 @@
#define PL2303_RWREQUEST_TYPE (0x40)
#define PL2303_RWREQUEST (0x01) /* IN/OUT, Recipient device */
/* Misc Macros **************************************************************/
/* min/max macros */
#ifndef min
# define min(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef max
# define max(a,b) ((a)>(b)?(a):(b))
#endif
/* Trace values *************************************************************/
#define PL2303_CLASSAPI_SETUP TRACE_EVENT(TRACE_CLASSAPI_ID, USBSER_TRACECLASSAPI_SETUP)
@@ -617,7 +607,7 @@ static int usbclass_sndpacket(FAR struct pl2303_dev_s *priv)
/* Get the maximum number of bytes that will fit into one bulk IN request */
reqlen = max(CONFIG_PL2303_BULKIN_REQLEN, ep->maxpacket);
reqlen = MAX(CONFIG_PL2303_BULKIN_REQLEN, ep->maxpacket);
while (!sq_empty(&priv->reqlist))
{
@@ -1809,7 +1799,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
{
case PL2303_SETLINEREQUEST:
{
memcpy(priv->linest, ctrlreq->buf, min(len, 7));
memcpy(priv->linest, ctrlreq->buf, MIN(len, 7));
ret = 0;
}
break;
@@ -1897,7 +1887,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
if (ret >= 0)
{
ctrlreq->len = min(len, ret);
ctrlreq->len = MIN(len, ret);
ctrlreq->flags = USBDEV_REQFLAGS_NULLPKT;
ret = EP_SUBMIT(dev->ep0, ctrlreq);
if (ret < 0)
+5 -11
View File
@@ -35,6 +35,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <sys/param.h>
#include <nuttx/queue.h>
#include <nuttx/net/net.h>
#include <nuttx/net/netdev.h>
@@ -96,14 +98,6 @@
#define ETHWORK LPWORK
#ifndef min
# define min(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef max
# define max(a,b) ((a)>(b)?(a):(b))
#endif
/****************************************************************************
* Private Types
****************************************************************************/
@@ -813,7 +807,7 @@ static uint16_t rndis_fillrequest(FAR struct rndis_dev_s *priv,
req->len = 0;
datalen = min(priv->netdev.d_len,
datalen = MIN(priv->netdev.d_len,
CONFIG_RNDIS_BULKIN_REQLEN - RNDIS_PACKET_HDR_SIZE);
if (datalen > 0)
{
@@ -1135,7 +1129,7 @@ static inline int rndis_recvpacket(FAR struct rndis_dev_s *priv,
{
size_t index = priv->current_rx_received -
priv->current_rx_datagram_offset;
size_t copysize = min(reqlen,
size_t copysize = MIN(reqlen,
priv->current_rx_datagram_size - index);
/* Check if the received packet exceeds request buffer */
@@ -2442,7 +2436,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
if (ret >= 0)
{
ctrlreq->len = min(len, ret);
ctrlreq->len = MIN(len, ret);
ctrlreq->flags = USBDEV_REQFLAGS_NULLPKT;
ret = EP_SUBMIT(dev->ep0, ctrlreq);
if (ret < 0)