Re: [PATCH v5 RESEND 2/4] i2c: Add i2c_device_get_match_data() callback

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

 



On Thu, Aug 03, 2023 at 11:31:00AM +0100, Biju Das wrote:
> Add i2c_device_get_match_data() callback to struct bus_type().
> 
> While at it, introduced i2c_get_match_data_helper() to avoid code
> duplication with i2c_get_match_data().

It seems you are missing to Cc Andi for all these... (not your fault,
rather unfortunately).

Yes, while he is not directly involved into core changes the drivers
are pretty much should consider this change.

...

>  	data = device_get_match_data(&client->dev);
> -	if (!data) {
> -		match = i2c_match_id(driver->id_table, client);
> -		if (!match)
> -			return NULL;
> +	if (data)
> +		return data;
>  
> -		data = (const void *)match->driver_data;
> -	}
> -
> -	return data;

Looking at this, it _might_ make sense to split another patch to prepare for
better difference here.

 -	if (!data) {
 -		match = i2c_match_id(driver->id_table, client);
 -		if (!match)
 -			return NULL;
 +	if (data)
 +		return data;
 +
 +	match = i2c_match_id(driver->id_table, client);
 +	if (!match)
 +		return NULL;
 +
 +	return (const void *)match->driver_data;

 Just play with this idea.

-- 
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