On Fri, 2015-05-15 at 19:19 +0900, Chanwoo Choi wrote:
> On 05/15/2015 06:25 PM, Dan Carpenter wrote:
> > We need to be able to handle more than 32 bits here because "id" can go
> > up to MAX77686_BUCK9 (34).  ->gpio_enabled is a u64 so that's fine
> > already.
> > 
> > Fixes: 3307e9025d29 ('regulator: max77686: Add GPIO control')
> > Signed-off-by: Dan Carpenter <[email protected]>

Alternate suggested patch below:

> > diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
[]
> > @@ -121,7 +121,7 @@ static unsigned int max77686_map_normal_mode(struct 
> > max77686_data *max77686,
> > -           if (max77686->gpio_enabled & (1 << id))
> > +           if (max77686->gpio_enabled & (1ULL << id))
[]
> > @@ -277,7 +277,7 @@ static int max77686_of_parse_cb(struct device_node *np,
> >     if (gpio_is_valid(config->ena_gpio)) {
> > -           max77686->gpio_enabled |= (1 << desc->id);
> > +           max77686->gpio_enabled |= (1ULL << desc->id);
[]
> Looks good to me.
> Reviewed-by: Chanwoo Choi <[email protected]>

This could be better with DECLARE_BITMAP and test_bit/set_bit
---

 drivers/regulator/max77686.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index 23b7c06..17ccf36 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -88,7 +88,7 @@ enum max77686_ramp_rate {
 };
 
 struct max77686_data {
-       u64 gpio_enabled:MAX77686_REGULATORS;
+       DECLARE_BITMAP(gpio_enabled, MAX77686_REGULATORS);
 
        /* Array indexed by regulator id */
        unsigned int opmode[MAX77686_REGULATORS];
@@ -121,7 +121,7 @@ static unsigned int max77686_map_normal_mode(struct 
max77686_data *max77686,
        case MAX77686_BUCK8:
        case MAX77686_BUCK9:
        case MAX77686_LDO20 ... MAX77686_LDO22:
-               if (max77686->gpio_enabled & (1 << id))
+               if (test_bit(id, max77686->gpio_enabled))
                        return MAX77686_GPIO_CONTROL;
        }
 
@@ -277,7 +277,7 @@ static int max77686_of_parse_cb(struct device_node *np,
        }
 
        if (gpio_is_valid(config->ena_gpio)) {
-               max77686->gpio_enabled |= (1 << desc->id);
+               set_bit(desc->id, max77686->gpio_enabled);
 
                return regmap_update_bits(config->regmap, desc->enable_reg,
                                          desc->enable_mask,



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to