This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 8affe54985317baad2012c94339b9e42c13b9228
Author: alexcekay <[email protected]>
AuthorDate: Thu Aug 27 16:52:59 2026 +0200

    arch/arm/stm32: Fix Ethernet code style issues
    
    Fixed all the issues reported by checkpatch.sh in stm32_eth_m3m4_v1.c,
    stm32f7/stm32_ethernet.c, stm32h5/stm32_ethernet.c, stm32h7/stm32_ethernet.c
    
    Signed-off-by: alexcekay <[email protected]>
---
 arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c | 51 ++++++++--------
 arch/arm/src/stm32f7/stm32_ethernet.c         | 85 ++++++++++++++-------------
 arch/arm/src/stm32h5/stm32_ethernet.c         |  6 +-
 arch/arm/src/stm32h7/stm32_ethernet.c         |  5 +-
 4 files changed, 81 insertions(+), 66 deletions(-)

diff --git a/arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c 
b/arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c
index c1a01a6faf6..a33b15a6bc7 100644
--- a/arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c
+++ b/arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c
@@ -1717,7 +1717,7 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 #ifdef CONFIG_NET_PKT
       /* When packet sockets are enabled, feed the frame into the tap */
 
-     pkt_input(&priv->dev);
+      pkt_input(&priv->dev);
 #endif
 
       /* Check if the packet is a valid size for the network buffer
@@ -2138,7 +2138,7 @@ static int stm32_interrupt(int irq, void *context, void 
*arg)
            * expiration and the deferred interrupt processing.
            */
 
-           wd_cancel(&priv->txtimeout);
+          wd_cancel(&priv->txtimeout);
         }
 
       /* Schedule to perform the interrupt processing on the worker thread. */
@@ -2277,6 +2277,7 @@ static int stm32_ifup(struct net_driver_s *dev)
       /* Transfer time from system low-resolution timer to PTP basetime */
 
       struct timespec ts;
+
       clock_gettime(CLOCK_REALTIME, &ts);
       up_rtc_settime(&ts);
       g_rtc_enabled = true;
@@ -2336,6 +2337,7 @@ static int stm32_ifdown(struct net_driver_s *dev)
       /* Transfer back to system low-resolution timer */
 
       struct timespec ts;
+
       up_rtc_gettime(&ts);
       g_rtc_enabled = false;
       clock_settime(CLOCK_REALTIME, &ts);
@@ -2832,6 +2834,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
         (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           req->phy_id = CONFIG_STM32_PHYADDR;
           ret = OK;
         }
@@ -2841,6 +2844,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
         (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out);
         }
         break;
@@ -2849,6 +2853,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
         (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in);
         }
         break;
@@ -3310,7 +3315,7 @@ static int stm32_phyinit(struct stm32_ethmac_s *priv)
   ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_MCR, phyval);
   if (ret < 0)
     {
-     nerr("ERROR: Failed to write the PHY MCR: %d\n", ret);
+      nerr("ERROR: Failed to write the PHY MCR: %d\n", ret);
       return ret;
     }
 
@@ -3776,26 +3781,26 @@ static void stm32_eth_ptp_convert_rxtime(struct 
stm32_ethmac_s *priv)
                      &priv->dev.d_rxtime);
 
 #else
-    {
-      struct timespec realtime;
-      uint64_t ptptime;
-      irqstate_t flags;
-
-      /* Sample PTP and CLOCK_REALTIME close to each other */
-
-      clock_gettime(CLOCK_REALTIME, &realtime);
-      flags = spin_lock_irqsave(&g_rtc_lock);
-      ptptime = stm32_eth_ptp_gettime();
-      spin_unlock_irqrestore(&g_rtc_lock, flags);
-
-      /* Compute how much time has elapsed since packet reception
-       * and add that to current time.
-       */
-
-      timestamp = ptptime - timestamp;
-      ptp_to_timespec(timestamp, &rxtime);
-      clock_timespec_add(&rxtime, &realtime, &priv->dev.d_rxtime);
-    }
+  {
+    struct timespec realtime;
+    uint64_t ptptime;
+    irqstate_t flags;
+
+    /* Sample PTP and CLOCK_REALTIME close to each other */
+
+    clock_gettime(CLOCK_REALTIME, &realtime);
+    flags = spin_lock_irqsave(&g_rtc_lock);
+    ptptime = stm32_eth_ptp_gettime();
+    spin_unlock_irqrestore(&g_rtc_lock, flags);
+
+    /* Compute how much time has elapsed since packet reception
+     * and add that to current time.
+     */
+
+    timestamp = ptptime - timestamp;
+    ptp_to_timespec(timestamp, &rxtime);
+    clock_timespec_add(&rxtime, &realtime, &priv->dev.d_rxtime);
+  }
 #endif /* CONFIG_STM32_ETH_PTP_RTC_HIRES */
 }
 #endif /* CONFIG_STM32_ETH_TIMESTAMP_RX */
diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c 
b/arch/arm/src/stm32f7/stm32_ethernet.c
index 89847d7662a..0e943b4b972 100644
--- a/arch/arm/src/stm32f7/stm32_ethernet.c
+++ b/arch/arm/src/stm32f7/stm32_ethernet.c
@@ -1763,7 +1763,7 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 #ifdef CONFIG_NET_PKT
       /* When packet sockets are enabled, feed the frame into the tap */
 
-     pkt_input(&priv->dev);
+      pkt_input(&priv->dev);
 #endif
 
       /* Check if the packet is a valid size for the network buffer
@@ -2196,7 +2196,7 @@ static int stm32_interrupt(int irq, void *context, void 
*arg)
            * expiration and the deferred interrupt processing.
            */
 
-           wd_cancel(&priv->txtimeout);
+          wd_cancel(&priv->txtimeout);
         }
 
       DEBUGASSERT(work_available(&priv->irqwork));
@@ -2843,55 +2843,58 @@ static int stm32_ioctl(struct net_driver_s *dev, int 
cmd, unsigned long arg)
   int ret;
 
   switch (cmd)
-  {
+    {
 #ifdef CONFIG_NETDEV_PHY_IOCTL
 #ifdef CONFIG_ARCH_PHY_INTERRUPT
-  case SIOCMIINOTIFY: /* Set up for PHY event notifications */
-    {
-      struct mii_ioctl_notify_s *req =
-        (struct mii_ioctl_notify_s *)((uintptr_t)arg);
-
-      ret = phy_notify_subscribe(dev->d_ifname, req->pid, &req->event);
-      if (ret == OK)
+      case SIOCMIINOTIFY: /* Set up for PHY event notifications */
         {
-          /* Enable PHY link up/down interrupts */
+          struct mii_ioctl_notify_s *req =
+            (struct mii_ioctl_notify_s *)((uintptr_t)arg);
+
+          ret = phy_notify_subscribe(dev->d_ifname, req->pid, &req->event);
+          if (ret == OK)
+            {
+              /* Enable PHY link up/down interrupts */
 
-          ret = stm32_phyintenable(priv);
+              ret = stm32_phyintenable(priv);
+            }
         }
-    }
-    break;
+        break;
 #endif
 
-  case SIOCGMIIPHY: /* Get MII PHY address */
-    {
-      struct mii_ioctl_data_s *req =
-        (struct mii_ioctl_data_s *)((uintptr_t)arg);
-      req->phy_id = CONFIG_STM32_PHYADDR;
-      ret = OK;
-    }
-    break;
+      case SIOCGMIIPHY: /* Get MII PHY address */
+        {
+          struct mii_ioctl_data_s *req =
+            (struct mii_ioctl_data_s *)((uintptr_t)arg);
 
-  case SIOCGMIIREG: /* Get register from MII PHY */
-    {
-      struct mii_ioctl_data_s *req =
-        (struct mii_ioctl_data_s *)((uintptr_t)arg);
-      ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out);
-    }
-    break;
+          req->phy_id = CONFIG_STM32_PHYADDR;
+          ret = OK;
+        }
+        break;
 
-  case SIOCSMIIREG: /* Set register in MII PHY */
-    {
-      struct mii_ioctl_data_s *req =
-        (struct mii_ioctl_data_s *)((uintptr_t)arg);
-      ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in);
-    }
-    break;
+      case SIOCGMIIREG: /* Get register from MII PHY */
+        {
+          struct mii_ioctl_data_s *req =
+            (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
+          ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out);
+        }
+        break;
+
+      case SIOCSMIIREG: /* Set register in MII PHY */
+        {
+          struct mii_ioctl_data_s *req =
+            (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
+          ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in);
+        }
+        break;
 #endif /* CONFIG_NETDEV_PHY_IOCTL */
 
-  default:
-    ret = -ENOTTY;
-    break;
-  }
+      default:
+        ret = -ENOTTY;
+        break;
+    }
 
   return ret;
 }
@@ -3322,7 +3325,7 @@ static int stm32_phyinit(struct stm32_ethmac_s *priv)
   ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_MCR, phyval);
   if (ret < 0)
     {
-     nerr("ERROR: Failed to write the PHY MCR: %d\n", ret);
+      nerr("ERROR: Failed to write the PHY MCR: %d\n", ret);
       return ret;
     }
 
diff --git a/arch/arm/src/stm32h5/stm32_ethernet.c 
b/arch/arm/src/stm32h5/stm32_ethernet.c
index 7e0e53feca9..473b27d418f 100644
--- a/arch/arm/src/stm32h5/stm32_ethernet.c
+++ b/arch/arm/src/stm32h5/stm32_ethernet.c
@@ -1711,6 +1711,7 @@ static int stm32_recvframe(struct stm32_ethmac_s *priv)
           else
             {
               bool err = ((rxdesc->des3 & ETH_RDES3_WB_ES) != 0);
+
               priv->segments++;
 
               /* Check if there is only one segment in the frame */
@@ -1895,7 +1896,7 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
        * tap
        */
 
-     pkt_input(&priv->dev);
+      pkt_input(&priv->dev);
 #endif
 
       /* Check if the packet is a valid size for the network buffer
@@ -2995,6 +2996,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
             (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           req->phy_id = CONFIG_STM32_PHYADDR;
           ret = OK;
         }
@@ -3004,6 +3006,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
             (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           ret = stm32_phyread(req->phy_id, req->reg_num, &req->val_out);
         }
         break;
@@ -3012,6 +3015,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
             (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           ret = stm32_phywrite(req->phy_id, req->reg_num, req->val_in,
                                0xffff);
         }
diff --git a/arch/arm/src/stm32h7/stm32_ethernet.c 
b/arch/arm/src/stm32h7/stm32_ethernet.c
index ee1a6d32f42..abe6ab20be8 100644
--- a/arch/arm/src/stm32h7/stm32_ethernet.c
+++ b/arch/arm/src/stm32h7/stm32_ethernet.c
@@ -1963,7 +1963,7 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
        * tap
        */
 
-     pkt_input(&priv->dev);
+      pkt_input(&priv->dev);
 #endif
 
       /* Check if the packet is a valid size for the network buffer
@@ -3097,6 +3097,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
             (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           req->phy_id = CONFIG_STM32_PHYADDR;
           ret = OK;
         }
@@ -3106,6 +3107,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
             (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           ret = mdio_read(priv->mdio,
             req->phy_id, req->reg_num, &req->val_out);
         }
@@ -3115,6 +3117,7 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, 
unsigned long arg)
         {
           struct mii_ioctl_data_s *req =
             (struct mii_ioctl_data_s *)((uintptr_t)arg);
+
           ret = mdio_write(priv->mdio,
             req->phy_id, req->reg_num, req->val_in);
         }

Reply via email to