Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1433670
| From | Manish Badarkhe <badarkhe.manish@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 3/3] gpio: lp873x: Add support for General Purpose Outputs |
| Date | 2016-06-29 12:50 +0200 |
| Message-ID | <rPle9-36J-13@gated-at.bofh.it> (permalink) |
| References | <rPk8p-2rm-3@gated-at.bofh.it> <rPk8p-2rm-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Keerthy
Some minor comment
> +static int lp873x_gpio_direction_output(struct gpio_chip *chip,
> + unsigned int offset, int value)
> +{
> + struct lp873x_gpio *gpio = gpiochip_get_data(chip);
> +
> + /* Set the initial value */
> + regmap_update_bits(gpio->lp873->regmap, LP873X_REG_GPO_CTRL,
> + BIT(offset * 4), value ? BIT(offset * 4) : 0);
> +
> + return 0;
> +}
Error needs to be return, this function always return 0.
> +
> +static int lp873x_gpio_get(struct gpio_chip *chip, unsigned int offset)
> +{
> + struct lp873x_gpio *gpio = gpiochip_get_data(chip);
> + int ret, val;
> +
> + ret = regmap_read(gpio->lp873->regmap, LP873X_REG_GPO_CTRL, &val);
> + if (ret < 0)
> + return ret;
> +
> + return val & BIT(offset * 4);
> +}
> +
> +static void lp873x_gpio_set(struct gpio_chip *chip, unsigned int offset,
> + int value)
> +{
> + struct lp873x_gpio *gpio = gpiochip_get_data(chip);
> +
> + regmap_update_bits(gpio->lp873->regmap, LP873X_REG_GPO_CTRL,
> + BIT(offset * 4), value ? BIT(offset * 4) : 0);
> +}
> +
> +static int lp873x_gpio_request(struct gpio_chip *gc, unsigned int offset)
> +{
> + struct lp873x_gpio *gpio = gpiochip_get_data(gc);
> + int ret;
> +
> + switch (offset) {
> + case 0:
> + /* No MUX Set up Needed for GPO */
> + break;
> + case 1:
> + /* Setup the CLKIN_PIN_SEL MUX to GPO2 */
> + ret = regmap_update_bits(gpio->lp873->regmap, LP873X_REG_CONFIG,
> + LP873X_CONFIG_CLKIN_PIN_SEL, 0);
> + if (ret)
> + return ret;
> +
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
Error needs to be return, this function always return 0. Only default
returns error here which is unlikely condition.
> +
> +
> +static int lp873x_gpio_set_single_ended(struct gpio_chip *gc,
> + unsigned int offset,
> + enum single_ended_mode mode)
> +{
> + struct lp873x_gpio *gpio = gpiochip_get_data(gc);
> +
> + switch (mode) {
> + case LINE_MODE_OPEN_DRAIN:
> + return regmap_update_bits(gpio->lp873->regmap,
> + LP873X_REG_GPO_CTRL,
> + BIT(offset * 4 + 2),
> + BIT(offset * 4 + 2));
> + case LINE_MODE_PUSH_PULL:
> + return regmap_update_bits(gpio->lp873->regmap,
> + LP873X_REG_GPO_CTRL,
> + BIT(offset * 4 + 2), 0);
> + default:
> + return -ENOTSUPP;
> + }
> +}
Error needs to be return, this function always return 0. Only default
returns error here which is unlikely condition.
Regards
Manish Badarkhe
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v4 3/3] gpio: lp873x: Add support for General Purpose Outputs Keerthy <j-keerthy@ti.com> - 2016-06-29 11:40 +0200
Re: [PATCH v4 3/3] gpio: lp873x: Add support for General Purpose Outputs Manish Badarkhe <badarkhe.manish@gmail.com> - 2016-06-29 12:50 +0200
Re: [PATCH v4 3/3] gpio: lp873x: Add support for General Purpose Outputs Keerthy <a0393675@ti.com> - 2016-06-29 14:50 +0200
Re: [PATCH v4 3/3] gpio: lp873x: Add support for General Purpose Outputs Manish Badarkhe <badarkhe.manish@gmail.com> - 2016-06-29 12:50 +0200
csiph-web