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 ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux