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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9e59cb4506f supply: remove powerled.c critical_section
9e59cb4506f is described below

commit 9e59cb4506f3368224e68b915a1adfafc1254a5c
Author: tengshuangshuang <[email protected]>
AuthorDate: Tue Jun 24 11:24:06 2025 +0800

    supply: remove powerled.c critical_section
    
    The setup() and shutdown() callbacks in the powerled upper-half driver
    are already serialized by the closelock mutex. The additional
    enter_critical_section()/leave_critical_section() wrapping is redundant
    and can be removed.
    
    Signed-off-by: tengshuangshuang <[email protected]>
---
 drivers/power/supply/powerled.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/power/supply/powerled.c b/drivers/power/supply/powerled.c
index 24ae1f5fa58..14cf76784a4 100644
--- a/drivers/power/supply/powerled.c
+++ b/drivers/power/supply/powerled.c
@@ -111,7 +111,6 @@ static int powerled_open(FAR struct file *filep)
             {
               /* Yes.. perform one time hardware initialization. */
 
-              irqstate_t flags = enter_critical_section();
               ret = dev->ops->setup(dev);
               if (ret == OK)
                 {
@@ -119,8 +118,6 @@ static int powerled_open(FAR struct file *filep)
 
                   dev->ocount = tmp;
                 }
-
-              leave_critical_section(flags);
             }
         }
 
@@ -143,7 +140,6 @@ static int powerled_close(FAR struct file *filep)
 {
   FAR struct inode *inode        = filep->f_inode;
   FAR struct powerled_dev_s *dev = inode->i_private;
-  irqstate_t flags;
   int ret;
 
   ret = nxmutex_lock(&dev->closelock);
@@ -166,10 +162,7 @@ static int powerled_close(FAR struct file *filep)
 
           /* Free the IRQ and disable the POWERLED device */
 
-          flags = enter_critical_section();      /* Disable interrupts */
-          dev->ops->shutdown(dev);               /* Disable the POWERLED */
-          leave_critical_section(flags);
-
+          dev->ops->shutdown(dev);  /* Disable the POWERLED */
           nxmutex_unlock(&dev->closelock);
         }
     }

Reply via email to