[PATCH v1 2/2] drm/i2c: tda998x: remove indirect reg_read/_write() calls

Russell King - ARM Linux admin linux at armlinux.org.uk
Fri Jun 21 15:20:52 UTC 2019


On Mon, May 27, 2019 at 03:15:52PM -0400, Sven Van Asbroeck wrote:
> -static void
> -reg_set(struct tda998x_priv *priv, u16 reg, u8 val)
> +static int
> +reg_set(struct regmap *regmap, u16 reg, u8 val)

I don't see the point of making this return an 'int' - you don't modify
any of the callsites to check the returned value, so returning a value
is not useful.

>  {
> -	regmap_update_bits(priv->regmap, reg, val, val);
> +	return regmap_update_bits(regmap, reg, val, val);
>  }
>  
> -static void
> -reg_clear(struct tda998x_priv *priv, u16 reg, u8 val)
> +static int
> +reg_clear(struct regmap *regmap, u16 reg, u8 val)

Same here.

> @@ -685,16 +655,18 @@ static void tda998x_detect_work(struct work_struct *work)
>  static irqreturn_t tda998x_irq_thread(int irq, void *data)
>  {
>  	struct tda998x_priv *priv = data;
> -	u8 sta, cec, lvl, flag0, flag1, flag2;
> +	struct regmap *regmap = priv->regmap;
> +	u8 sta, cec, lvl;
> +	unsigned int flag0, flag1, flag2;
>  	bool handled = false;
>  
>  	sta = cec_read(priv, REG_CEC_INTSTATUS);
>  	if (sta & CEC_INTSTATUS_HDMI) {
>  		cec = cec_read(priv, REG_CEC_RXSHPDINT);
>  		lvl = cec_read(priv, REG_CEC_RXSHPDLEV);
> -		flag0 = reg_read(priv, REG_INT_FLAGS_0);
> -		flag1 = reg_read(priv, REG_INT_FLAGS_1);
> -		flag2 = reg_read(priv, REG_INT_FLAGS_2);
> +		regmap_read(regmap, REG_INT_FLAGS_0, &flag0);
> +		regmap_read(regmap, REG_INT_FLAGS_1, &flag1);
> +		regmap_read(regmap, REG_INT_FLAGS_2, &flag2);

Not particularly enamoured by this...

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up


More information about the dri-devel mailing list