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