Re: [PATCH] rtc: rs5c372: Simplify probe()

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

 



On Mon, Aug 28, 2023 at 12:10:34PM +0100, Biju Das wrote:
> Simpilfy probe() by replacing of_device_get_match_data() and id lookup for
> retrieving match data by i2c_get_match_data().

...

>  	rs5c372->client = client;
>  	i2c_set_clientdata(client, rs5c372);
> -	if (client->dev.of_node) {
> -		rs5c372->type = (uintptr_t)of_device_get_match_data(&client->dev);
> -	} else {
> -		const struct i2c_device_id *id = i2c_match_id(rs5c372_id, client);
> -		rs5c372->type = id->driver_data;
> -	}
> +	rs5c372->type = (uintptr_t)i2c_get_match_data(client);

For better reading you can swap the order

	rs5c372->type = (uintptr_t)i2c_get_match_data(client);
	i2c_set_clientdata(client, rs5c372);

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux