lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e44e39b5-e989-6820-f283-9e3271048940@sionneau.net>
Date:   Thu, 17 Aug 2023 16:05:44 +0200
From:   Yann Sionneau <yann@...nneau.net>
To:     Huangzheng Lai <Huangzheng.Lai@...soc.com>,
        Andi Shyti <andi.shyti@...nel.org>
Cc:     Orson Zhai <orsonzhai@...il.com>,
        Baolin Wang <baolin.wang@...ux.alibaba.com>,
        Chunyan Zhang <zhang.lyra@...il.com>,
        linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
        huangzheng lai <laihuangzheng@...il.com>,
        Xiongpeng Wu <xiongpeng.wu@...soc.com>
Subject: Re: [PATCH 1/8] i2c: sprd: Add configurations that support 1Mhz and
 3.4Mhz frequencies

Le 17/08/2023 à 11:45, Huangzheng Lai a écrit :
> This patch adds I2C controller driver support for 1Mhz and 3.4Mhz
> frequency configurations.
> @@ -347,6 +347,10 @@ static void sprd_i2c_set_clk(struct sprd_i2c *i2c_dev, u32 freq)
>   		writel((6 * apb_clk) / 10000000, i2c_dev->base + ADDR_STA0_DVD);
>   	else if (freq == I2C_MAX_STANDARD_MODE_FREQ)
>   		writel((4 * apb_clk) / 1000000, i2c_dev->base + ADDR_STA0_DVD);
> +	else if (freq == I2C_MAX_FAST_MODE_PLUS_FREQ)
> +		writel((8 * apb_clk) / 10000000, i2c_dev->base + ADDR_STA0_DVD);
> +	else if (freq == I2C_MAX_HIGH_SPEED_MODE_FREQ)
> +		writel((8 * apb_clk) / 10000000, i2c_dev->base + ADDR_STA0_DVD);
>   }

Maybe using a switch case could be beneficial to readability instead of 
a series of if / else if ?

-- 

Yann

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ