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 Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux