Re: [PATCH V2 1/2] pinctrl: bcm2835: Implement bcm2835_pinconf_get

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sat, Mar 02, 2024 at 10:54:29AM +0100, Stefan Wahren kirjoitti:
> Even the driver already has implemented pin_dbg_show, it could
> be helpful to implement pin_conf_get for a more generic behavior.
> Contrary to the BCM2711, the BCM2835 SOC doesn't allow to read
> the bias config, so the implementation is limited to the basics.

> +	switch (param) {
> +	case PIN_CONFIG_INPUT_ENABLE:
> +		if (fsel != BCM2835_FSEL_GPIO_IN)
> +			return -EINVAL;
> +
> +		*config = pinconf_to_config_packed(param, 1);

> +		return 0;

Either use break here (and in similar situations)...

> +	case PIN_CONFIG_OUTPUT_ENABLE:
> +		if (fsel != BCM2835_FSEL_GPIO_OUT)
> +			return -EINVAL;
> +
> +		*config = pinconf_to_config_packed(param, 1);
> +		return 0;
> +
> +	case PIN_CONFIG_OUTPUT:
> +		if (fsel != BCM2835_FSEL_GPIO_OUT)
> +			return -EINVAL;
> +
> +		val = bcm2835_gpio_get_bit(pc, GPLEV0, pin);
> +		*config = pinconf_to_config_packed(param, val);
> +		return 0;
> +
> +	default:
> +		break;

...and return from here directly.

> +	}
> +
>  	return -ENOTSUPP;

I.o.w. it's better to have a single point of returning a success code.

>  }

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux