clk: lmk04832: fix minor warnings and syntax issues
cover clk: lmk04832: fix minor warnings and syntax issues
This series addresses a few automated reports I missed since adding initial support for the lmk04832.
There are no functional changes here.
Liam Beguin (4):
clk: lmk04832: declare variables as const when possible
clk: lmk04832: drop unnecessary semicolons
clk: lmk04832: drop superfluous #include
clk: lmk04832: fix kernel-doc warnings
drivers/clk/clk-lmk04832.c | 41 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
base-commit: 77c51ba552a1c4f73228766e43ae37c4101b3758
Signature · 1 line
2.37.1.223.g6a475b71f8c4
PATCH 1/4 clk: lmk04832: declare variables as const when possible
Fix the following warning reported by the kernel test robot.
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/clk/clk-lmk04832.c:357:15: warning: Variable 'pll2_p' can be declared with const [constVariable]
unsigned int pll2_p[] = {8, 2, 2, 3, 4, 5, 6, 7};
--- drivers/clk/clk-lmk04832.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-lmk04832.c +2 -2
@@ -371,7 +371,7 @@ static unsigned long lmk04832_vco_recalc_rate(struct clk_hw *hw, unsigned long prate) { struct lmk04832 *lmk = container_of(hw, struct lmk04832, vco); -unsigned int pll2_p[] = {8 ,2 ,2 ,3 ,4 ,5 ,6 ,7 }; +const unsigned int pll2_p[] = {8 ,2 ,2 ,3 ,4 ,5 ,6 ,7 };unsigned int pll2_n, p, pll2_r;unsigned int pll2_misc;unsigned long vco_rate;
@@ -633,7 +633,7 @@ static int lmk04832_register_vco(struct lmk04832 *lmk)static int lmk04832_clkout_set_ddly (struct lmk04832 *lmk,int id) { -int dclk_div_adj[] = {0 ,0 ,-2 ,-2 ,0 ,3 ,-1 ,0 }; +const int dclk_div_adj[] = {0 ,0 ,-2 ,-2 ,0 ,3 ,-1 ,0 };unsigned int sclkx_y_ddly =10 ;unsigned int dclkx_y_ddly;unsigned int dclkx_y_div;
Signature · 1 line
2.37.1.223.g6a475b71f8c4
Re: [PATCH v1 1/4] clk: lmk04832: declare variables as const when possible
Quoting Liam Beguin (2022-11-19 19:02:54)
Quoted 10 lines
Fix the following warning reported by the kernel test robot.
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>>drivers/clk/clk-lmk04832.c:357:15: warning: Variable 'pll2_p' can be declared with const [constVariable]
unsigned int pll2_p[] = {8, 2, 2, 3, 4, 5, 6, 7};Reported-by kernel test robot <[email protected]>Signed-off-by Liam Beguin <[email protected]>---
Applied to clk-next
PATCH 2/4 clk: lmk04832: drop unnecessary semicolons
In reply to Liam BeguinSemicolons on the closing brace of a function definition are unnecessary, remove them.
--- drivers/clk/clk-lmk04832.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/clk/clk-lmk04832.c +9 -8
@@ -282,7 +282,7 @@ static bool lmk04832_regmap_rd_regs(struct device *dev, unsigned int reg)default :return false; }; -}; +}static bool lmk04832_regmap_wr_regs (struct device *dev,unsigned int reg) {
@@ -305,7 +305,7 @@ static bool lmk04832_regmap_wr_regs(struct device *dev, unsigned int reg)default :return false; }; -}; +}static const struct regmap_config regmap_config = { .name ="lmk04832" ,
@@ -403,7 +403,7 @@ static unsigned long lmk04832_vco_recalc_rate(struct clk_hw *hw, pll2_misc)) * pll2_n * pll2_p[p] / pll2_r;return vco_rate; -}; +}/** * lmk04832_check_vco_ranges - Check requested VCO frequency against VCO ranges
@@ -509,7 +509,7 @@ static long lmk04832_vco_round_rate(struct clk_hw *hw, unsigned long rate,return -EINVAL ;return vco_rate; -}; +}static int lmk04832_vco_set_rate (struct clk_hw *hw,unsigned long rate,unsigned long prate)
@@ -568,7 +568,7 @@ static int lmk04832_vco_set_rate(struct clk_hw *hw, unsigned long rate,return regmap_write (lmk->regmap,LMK04832_REG_PLL2_N_2 ,FIELD_GET (0x0000ff , n)); -}; +}static const struct clk_ops lmk04832_vco_ops = { .is_enabled = lmk04832_vco_is_enabled,
@@ -1063,7 +1063,7 @@ static unsigned long lmk04832_dclk_recalc_rate(struct clk_hw *hw, rate =DIV_ROUND_CLOSEST (prate, dclk_div);return rate; -}; +}static long lmk04832_dclk_round_rate (struct clk_hw *hw,unsigned long rate,unsigned long *prate)
@@ -1085,7 +1085,7 @@ static long lmk04832_dclk_round_rate(struct clk_hw *hw, unsigned long rate,return -EINVAL ;return dclk_rate; -}; +}static int lmk04832_dclk_set_rate (struct clk_hw *hw,unsigned long rate,unsigned long prate)
@@ -1147,7 +1147,7 @@ static int lmk04832_dclk_set_rate(struct clk_hw *hw, unsigned long rate,dev_err (lmk->dev,"SYNC sequence failed\n" );return ret; -}; +}static const struct clk_ops lmk04832_dclk_ops = { .is_enabled = lmk04832_dclk_is_enabled,
@@ -1551,6 +1551,7 @@ static void lmk04832_remove(struct spi_device *spi)clk_disable_unprepare (lmk->oscin);of_clk_del_provider (spi->dev.of_node); } +static const struct spi_device_id lmk04832_id[] = { {"lmk04832" ,LMK04832 }, {}
Signature · 1 line
2.37.1.223.g6a475b71f8c4
Re: [PATCH v1 2/4] clk: lmk04832: drop unnecessary semicolons
Quoting Liam Beguin (2022-11-19 19:02:55)
Quoted 5 lines
Semicolons on the closing brace of a function definition are unnecessary, remove them.
Signed-off-by Liam Beguin <[email protected]>---
Applied to clk-next
PATCH 3/4 clk: lmk04832: drop superfluous #include
In reply to Liam Beguiniwyu warnings: (new ones prefixed by >>)
Quoted 2 lines
Quoted 2 lines
drivers/clk/clk-lmk04832.c:15:1: iwyu: warning: superfluous #include <linux/debugfs.h>drivers/clk/clk-lmk04832.c:20:1: iwyu: warning: superfluous #include <linux/uaccess.h>
--- drivers/clk/clk-lmk04832.c | 2 -- 1 file changed, 2 deletions(-)
drivers/clk/clk-lmk04832.c +0 -2
@@ -12,12 +12,10 @@#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/debugfs.h> #include <linux/device.h> #include <linux/gcd.h> #include <linux/gpio/consumer.h> #include <linux/module.h> -#include <linux/uaccess.h> #include <linux/regmap.h> #include <linux/spi/spi.h>
Signature · 1 line
2.37.1.223.g6a475b71f8c4
Re: [PATCH v1 3/4] clk: lmk04832: drop superfluous #include
Quoting Liam Beguin (2022-11-19 19:02:56)
Quoted 8 lines
iwyu warnings: (new ones prefixed by >>)
Quoted 2 lines
Quoted 2 lines
drivers/clk/clk-lmk04832.c:15:1: iwyu: warning: superfluous #include <linux/debugfs.h>drivers/clk/clk-lmk04832.c:20:1: iwyu: warning: superfluous #include <linux/uaccess.h>Reported-by kernel test robot <[email protected]>Signed-off-by Liam Beguin <[email protected]>---
Applied to clk-next
PATCH 4/4 clk: lmk04832: fix kernel-doc warnings
In reply to Liam BeguinFix syntax generating the following kernel-doc warnings:
drivers/clk/clk-lmk04832.c:189: warning: cannot understand function prototype: 'struct lmk04832_device_info ' drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'pid' not described in 'lmk04832_device_info' drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'maskrev' not described in 'lmk04832_device_info' drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'num_channels' not described in 'lmk04832_device_info' drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'vco0_range' not described in 'lmk04832_device_info' drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'vco1_range' not described in 'lmk04832_device_info' drivers/clk/clk-lmk04832.c:420: warning: No description found for return value of 'lmk04832_check_vco_ranges' drivers/clk/clk-lmk04832.c:459: warning: No description found for return value of 'lmk04832_calc_pll2_params'
--- drivers/clk/clk-lmk04832.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/clk/clk-lmk04832.c +9 -9
@@ -175,14 +175,14 @@ enum lmk04832_device_types { };/** -* lmk04832_device_info - Holds static device information that is specific to -* the chip revision +* struct lmk04832_device_info - Holds static device information that is +* specific to the chip revision * -* pid: Product Identifier -* maskrev: IC version identifier -* num_channels: Number of available output channels (clkout count) -* vco0_range: {min, max} of the VCO0 operating range (in MHz) -* vco1_range: {min, max} of the VCO1 operating range (in MHz) +* @pid: Product Identifier +* @maskrev: IC version identifier +* @num_channels: Number of available output channels (clkout count) +* @vco0_range: {min, max} of the VCO0 operating range (in MHz) +* @vco1_range: {min, max} of the VCO1 operating range (in MHz) */ struct lmk04832_device_info {u16 pid;
@@ -412,7 +412,7 @@ static unsigned long lmk04832_vco_recalc_rate(struct clk_hw *hw,* The LMK04832 has 2 internal VCO, each with independent operating ranges. * Use the device_info structure to determine which VCO to use based on rate. * -* Returns VCO_MUX value or negative errno. +* Returns: VCO_MUX value or negative errno. */ static int lmk04832_check_vco_ranges (struct lmk04832 *lmk,unsigned long rate) {
@@ -449,7 +449,7 @@ static int lmk04832_check_vco_ranges(struct lmk04832 *lmk, unsigned long rate)* * VCO = OSCin * 2 * PLL2_N * PLL2_P / PLL2_R * -* Returns vco rate or negative errno. +* Returns: vco rate or negative errno. */ static long lmk04832_calc_pll2_params(unsigned long prate, unsigned long rate, unsigned int *n, unsigned int *p,
Signature · 1 line
2.37.1.223.g6a475b71f8c4
Re: [PATCH v1 4/4] clk: lmk04832: fix kernel-doc warnings
Quoting Liam Beguin (2022-11-19 19:02:57)
Quoted 11 lines
Fix syntax generating the following kernel-doc warnings:
drivers/clk/clk-lmk04832.c:189: warning: cannot understand function prototype: 'structlmk04832_device_info'drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'pid' not described in 'lmk04832_device_info'drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'maskrev' not described in 'lmk04832_device_info'drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'num_channels' not described in 'lmk04832_device_info'drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'vco0_range' not described in 'lmk04832_device_info'drivers/clk/clk-lmk04832.c:193: warning: Function parameter or member 'vco1_range' not described in 'lmk04832_device_info'drivers/clk/clk-lmk04832.c:420: warning: No description found for return value of 'lmk04832_check_vco_ranges'drivers/clk/clk-lmk04832.c:459: warning: No description found for return value of 'lmk04832_calc_pll2_params'
Quoted 2 lines
Signed-off-by Liam Beguin <[email protected]>---
Applied to clk-next