diff options
Diffstat (limited to 'drivers/mux/gpio.c')
| -rw-r--r-- | drivers/mux/gpio.c | 19 | 
1 files changed, 9 insertions, 10 deletions
| diff --git a/drivers/mux/gpio.c b/drivers/mux/gpio.c index 02c1f2c014e8..cc5f2c1861d4 100644 --- a/drivers/mux/gpio.c +++ b/drivers/mux/gpio.c @@ -7,11 +7,12 @@   * Author: Peter Rosin <peda@axentia.se>   */ +#include <linux/bitmap.h>  #include <linux/err.h>  #include <linux/gpio/consumer.h> +#include <linux/mod_devicetable.h>  #include <linux/module.h>  #include <linux/mux/driver.h> -#include <linux/of_platform.h>  #include <linux/platform_device.h>  #include <linux/property.h> @@ -23,8 +24,9 @@ static int mux_gpio_set(struct mux_control *mux, int state)  {  	struct mux_gpio *mux_gpio = mux_chip_priv(mux->chip);  	DECLARE_BITMAP(values, BITS_PER_TYPE(state)); +	u32 value = state; -	values[0] = state; +	bitmap_from_arr32(values, &value, BITS_PER_TYPE(value));  	gpiod_set_array_value_cansleep(mux_gpio->gpios->ndescs,  				       mux_gpio->gpios->desc, @@ -64,14 +66,11 @@ static int mux_gpio_probe(struct platform_device *pdev)  	mux_chip->ops = &mux_gpio_ops;  	mux_gpio->gpios = devm_gpiod_get_array(dev, "mux", GPIOD_OUT_LOW); -	if (IS_ERR(mux_gpio->gpios)) { -		ret = PTR_ERR(mux_gpio->gpios); -		if (ret != -EPROBE_DEFER) -			dev_err(dev, "failed to get gpios\n"); -		return ret; -	} +	if (IS_ERR(mux_gpio->gpios)) +		return dev_err_probe(dev, PTR_ERR(mux_gpio->gpios), +				     "failed to get gpios\n");  	WARN_ON(pins != mux_gpio->gpios->ndescs); -	mux_chip->mux->states = 1 << pins; +	mux_chip->mux->states = BIT(pins);  	ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state);  	if (ret >= 0 && idle_state != MUX_IDLE_AS_IS) { @@ -96,7 +95,7 @@ static int mux_gpio_probe(struct platform_device *pdev)  static struct platform_driver mux_gpio_driver = {  	.driver = {  		.name = "gpio-mux", -		.of_match_table	= of_match_ptr(mux_gpio_dt_ids), +		.of_match_table	= mux_gpio_dt_ids,  	},  	.probe = mux_gpio_probe,  }; | 
