Author: kevans
Date: Fri Jun 15 13:14:45 2018
New Revision: 335195
URL: https://svnweb.freebsd.org/changeset/base/335195

Log:
  Revert r335173 at request of mmel@
  
  This was the wrong solution to the problem; regulator_shutdown invokes
  regnode_stop. regulator_stop is not a refcounting method, but it invokes
  regnode_enable, which is.
  
  mmel@ has a proposed patch/solution to instead provide regnode_fixed_stop
  behavior that properly takes shared GPIO pins into account.

Modified:
  head/sys/dev/extres/regulator/regulator.c
  head/sys/dev/extres/regulator/regulator.h
  head/sys/dev/extres/regulator/regulator_fixed.c

Modified: head/sys/dev/extres/regulator/regulator.c
==============================================================================
--- head/sys/dev/extres/regulator/regulator.c   Fri Jun 15 12:28:43 2018        
(r335194)
+++ head/sys/dev/extres/regulator/regulator.c   Fri Jun 15 13:14:45 2018        
(r335195)
@@ -507,20 +507,6 @@ struct regnode_std_param *regnode_get_stdparam(struct 
        return (&regnode->std_param);
 }
 
-void
-regnode_enable_cnt_inc(struct regnode *regnode)
-{
-
-       regnode->enable_cnt++;
-}
-
-void
-regnode_enable_cnt_dec(struct regnode *regnode)
-{
-
-       regnode->enable_cnt--;
-}
-
 void regnode_topo_unlock(void)
 {
 

Modified: head/sys/dev/extres/regulator/regulator.h
==============================================================================
--- head/sys/dev/extres/regulator/regulator.h   Fri Jun 15 12:28:43 2018        
(r335194)
+++ head/sys/dev/extres/regulator/regulator.h   Fri Jun 15 13:14:45 2018        
(r335195)
@@ -106,8 +106,6 @@ int regnode_get_flags(struct regnode *regnode);
 void *regnode_get_softc(struct regnode *regnode);
 device_t regnode_get_device(struct regnode *regnode);
 struct regnode_std_param *regnode_get_stdparam(struct regnode *regnode);
-void regnode_enable_cnt_inc(struct regnode *regnode);
-void regnode_enable_cnt_dec(struct regnode *regnode);
 void regnode_topo_unlock(void);
 void regnode_topo_xlock(void);
 void regnode_topo_slock(void);

Modified: head/sys/dev/extres/regulator/regulator_fixed.c
==============================================================================
--- head/sys/dev/extres/regulator/regulator_fixed.c     Fri Jun 15 12:28:43 
2018        (r335194)
+++ head/sys/dev/extres/regulator/regulator_fixed.c     Fri Jun 15 13:14:45 
2018        (r335195)
@@ -156,8 +156,6 @@ regnode_fixed_init(struct regnode *regnode)
        if (sc->gpio_open_drain)
                flags |= GPIO_PIN_OPENDRAIN;
        enable = sc->param->boot_on || sc->param->always_on;
-       if (enable)
-               regnode_enable_cnt_inc(regnode);
        if (!sc->param->enable_active_high)
                enable = !enable;
        rv = GPIO_PIN_SET(pin->dev, pin->pin, enable);
@@ -196,14 +194,12 @@ regnode_fixed_enable(struct regnode *regnode, bool ena
                return (0);
        pin = &sc->gpio_entry->gpio_pin;
        if (enable) {
-               regnode_enable_cnt_inc(regnode);
                sc->gpio_entry->enable_cnt++;
                if (sc->gpio_entry->enable_cnt > 1)
                        return (0);
        } else {
                KASSERT(sc->gpio_entry->enable_cnt > 0,
                    ("Invalid enable count"));
-               regnode_enable_cnt_dec(regnode);
                sc->gpio_entry->enable_cnt--;
                if (sc->gpio_entry->enable_cnt >= 1)
                        return (0);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to