Re: [PATCH v2 1/1] i2c: qcom-geni: Support systems with 32MHz serial engine clock

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

 




On 9/26/2024 6:18 PM, Bjorn Andersson wrote:
> On Thu, Sep 26, 2024 at 01:28:37PM GMT, Vladimir Zapolskiy wrote:
>> On 9/26/24 06:43, Manikanta Mylavarapu wrote:
>>> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> [..]
>>> +
>>>   static int geni_i2c_clk_map_idx(struct geni_i2c_dev *gi2c)
>>>   {
>>>   	int i;
>>> -	const struct geni_i2c_clk_fld *itr = geni_i2c_clk_map;
>>> +	const struct geni_i2c_clk_fld *itr;
>>> +
>>> +	if (clk_get_rate(gi2c->se.clk) == 32 * HZ_PER_MHZ)
>>> +		itr = geni_i2c_clk_map_32mhz;
>>> +	else
>>> +		itr = geni_i2c_clk_map_19p2mhz;
>>> -	for (i = 0; i < ARRAY_SIZE(geni_i2c_clk_map); i++, itr++) {
>>> +	for (i = 0; i < ARRAY_SIZE(geni_i2c_clk_map_19p2mhz); i++, itr++) {
>>
>> Struct/data organization here is so weak, that here it's implicitly assumed
>> that sizes of two arrays are equal. It could be kept as is of course, just
>> pointing to it.
>>
> 
> Thanks for pointing this out, Vladimir.
> 
> I'd prefer we fix it by adding a sentinel value to the arrays - because
> this was only spotted due to the rename, the next guy will not be so
> lucky.
> 
> Regards,
> Bjorn
> 

Okay, sure.

Thanks & Regards,
Manikanta.




[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