[PATCH 02/10] pwm: atmel-hlcdc: Use consistent variable naming

Thierry Reding thierry.reding at gmail.com
Wed Jul 19 23:53:50 PDT 2023


On Fri, Jul 14, 2023 at 10:56:15PM +0200, Uwe Kleine-König wrote:
> In pwm drivers the variable name "chip" is usually only used for struct
> pwm_chip pointers. This driver however used "chip" for its driver data
> and pwm_chip pointers are named "chip", too, when there is no driver
> data around and "c" otherwise. Instead use "ddata" for driver data and
> always "chip" for pwm_chips.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
>  drivers/pwm/pwm-atmel-hlcdc.c | 64 +++++++++++++++++------------------
>  1 file changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
> index 96a709a9d49a..9b0165d61c49 100644
> --- a/drivers/pwm/pwm-atmel-hlcdc.c
> +++ b/drivers/pwm/pwm-atmel-hlcdc.c
> @@ -38,11 +38,11 @@ static inline struct atmel_hlcdc_pwm *to_atmel_hlcdc_pwm(struct pwm_chip *chip)
>  	return container_of(chip, struct atmel_hlcdc_pwm, chip);
>  }
>  
> -static int atmel_hlcdc_pwm_apply(struct pwm_chip *c, struct pwm_device *pwm,
> +static int atmel_hlcdc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  				 const struct pwm_state *state)
>  {
> -	struct atmel_hlcdc_pwm *chip = to_atmel_hlcdc_pwm(c);
> -	struct atmel_hlcdc *hlcdc = chip->hlcdc;
> +	struct atmel_hlcdc_pwm *ddata = to_atmel_hlcdc_pwm(chip);

Can we not just use something like "data", "priv" or "atmel"? "ddata" is
horrific and looks like a typo.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230720/b8266851/attachment-0001.sig>


More information about the linux-arm-kernel mailing list