Re: [PATCH v1] i2c: base: Drop unneeded checks for of_node

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

 



Hi Andy,

> @@ -354,13 +354,11 @@ static int i2c_device_probe(struct device *dev)
>  		return -ENODEV;
>  
>  	if (client->flags & I2C_CLIENT_WAKE) {
> -		int wakeirq = -ENOENT;
> +		int wakeirq;
>  
> -		if (dev->of_node) {
> -			wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
> -			if (wakeirq == -EPROBE_DEFER)
> -				return wakeirq;
> -		}
> +		wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
> +		if (wakeirq == -EPROBE_DEFER)
> +			return wakeirq;
>  

I really like this chunk. It simplifies the code.

> @@ -813,10 +811,9 @@ void i2c_unregister_device(struct i2c_client *client)
>  	if (!client)
>  		return;
>  
> -	if (client->dev.of_node) {
> +	if (client->dev.of_node)
>  		of_node_clear_flag(client->dev.of_node, OF_POPULATED);
> -		of_node_put(client->dev.of_node);
> -	}
> +	of_node_put(client->dev.of_node);

This one, not so much. We do the check anyhow, so the grouping of
related calls in one block looks better readable to me than the chunk
above. Yes, we save the braces but it looks a bit messy to me.

Thanks,

   Wolfram

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux