diff --git a/drivers/net/netdev_upperhalf.c b/drivers/net/netdev_upperhalf.c index 1bca7fe93b..caf82bb5b9 100644 --- a/drivers/net/netdev_upperhalf.c +++ b/drivers/net/netdev_upperhalf.c @@ -91,7 +91,7 @@ struct netdev_upperhalf_s static int quota_fetch_inc(FAR struct netdev_lowerhalf_s *lower, enum netpkt_type_e type) { -#ifndef HAVE_ATOMICS +#ifndef CONFIG_HAVE_ATOMICS irqstate_t flags = spin_lock_irqsave(&lower->lock); int ret = lower->quota[type]++; spin_unlock_irqrestore(&lower->lock, flags); @@ -104,7 +104,7 @@ static int quota_fetch_inc(FAR struct netdev_lowerhalf_s *lower, static int quota_fetch_dec(FAR struct netdev_lowerhalf_s *lower, enum netpkt_type_e type) { -#ifndef HAVE_ATOMICS +#ifndef CONFIG_HAVE_ATOMICS irqstate_t flags = spin_lock_irqsave(&lower->lock); int ret = lower->quota[type]--; spin_unlock_irqrestore(&lower->lock, flags); @@ -680,7 +680,7 @@ int netdev_lower_register(FAR struct netdev_lowerhalf_s *dev, return -ENOMEM; } -#ifndef HAVE_ATOMICS +#ifndef CONFIG_HAVE_ATOMICS spin_initialize(&dev->lock, SP_UNLOCKED); #endif dev->netdev.d_ifup = netdev_upper_ifup; @@ -849,7 +849,7 @@ void netdev_lower_txdone(FAR struct netdev_lowerhalf_s *dev) int netdev_lower_quota_load(FAR struct netdev_lowerhalf_s *dev, enum netpkt_type_e type) { -#ifndef HAVE_ATOMICS +#ifndef CONFIG_HAVE_ATOMICS irqstate_t flags = spin_lock_irqsave(&dev->lock); int ret = dev->quota[type]; spin_unlock_irqrestore(&dev->lock, flags); diff --git a/include/nuttx/net/netdev_lowerhalf.h b/include/nuttx/net/netdev_lowerhalf.h index 44459b2e4a..88e6ebc99d 100644 --- a/include/nuttx/net/netdev_lowerhalf.h +++ b/include/nuttx/net/netdev_lowerhalf.h @@ -34,13 +34,7 @@ #include #include -/* Compiler may not have stdatomic.h before C11 or with __STDC_NO_ATOMICS__ - * But we can also get atomic support from libmetal. - */ - -#if defined(CONFIG_OPENAMP) -# include -#elif defined(CONFIG_HAVE_ATOMICS) +#ifdef CONFIG_HAVE_ATOMICS # include #endif @@ -62,10 +56,6 @@ #define NETPKT_BUFLEN CONFIG_IOB_BUFSIZE -#if defined(CONFIG_OPENAMP) || defined(CONFIG_HAVE_ATOMICS) -# define HAVE_ATOMICS -#endif - /**************************************************************************** * Public Types ****************************************************************************/ @@ -103,7 +93,7 @@ struct netdev_lowerhalf_s /* Max # of buffer held by driver */ -#ifdef HAVE_ATOMICS +#ifdef CONFIG_HAVE_ATOMICS atomic_int quota[NETPKT_TYPENUM]; #else int quota[NETPKT_TYPENUM];