Message ID | 20240111105247.117766-7-angelogioacchino.delregno@collabora.com |
---|---|
State | Superseded |
Headers | show |
Series | ASoC: mediatek: AFE drivers cleanups | expand |
Hi AngeloGioacchino, kernel test robot noticed the following build warnings: [auto build test WARNING on broonie-sound/for-next] [also build test WARNING on broonie-spi/for-next tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.7 next-20240111] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/AngeloGioacchino-Del-Regno/ASoC-mediatek-mt8173-afe-pcm-Convert-to-devm_pm_runtime_enable/20240111-185734 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20240111105247.117766-7-angelogioacchino.delregno%40collabora.com patch subject: [PATCH 6/7] ASoC: mediatek: mt8192-afe-pcm: Simplify with dev_err_probe() config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240112/202401121019.EC2g0hQM-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240112/202401121019.EC2g0hQM-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401121019.EC2g0hQM-lkp@intel.com/ All warnings (new ones prefixed by >>): sound/soc/mediatek/mt8192/mt8192-afe-pcm.c: In function 'mt8192_afe_pcm_dev_probe': >> sound/soc/mediatek/mt8192/mt8192-afe-pcm.c:2284:67: warning: format '%d' expects a matching 'int' argument [-Wformat=] 2284 | return dev_err_probe(afe->dev, ret, "dai %d register fail"); | ~^ | | | int vim +2284 sound/soc/mediatek/mt8192/mt8192-afe-pcm.c 2172 2173 static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) 2174 { 2175 struct mtk_base_afe *afe; 2176 struct mt8192_afe_private *afe_priv; 2177 struct device *dev; 2178 struct reset_control *rstc; 2179 int i, ret, irq_id; 2180 2181 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); 2182 if (ret) 2183 return ret; 2184 2185 afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); 2186 if (!afe) 2187 return -ENOMEM; 2188 platform_set_drvdata(pdev, afe); 2189 2190 afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), 2191 GFP_KERNEL); 2192 if (!afe->platform_priv) 2193 return -ENOMEM; 2194 afe_priv = afe->platform_priv; 2195 2196 afe->dev = &pdev->dev; 2197 dev = afe->dev; 2198 2199 /* init audio related clock */ 2200 ret = mt8192_init_clock(afe); 2201 if (ret) { 2202 dev_err(dev, "init clock error\n"); 2203 return ret; 2204 } 2205 2206 /* reset controller to reset audio regs before regmap cache */ 2207 rstc = devm_reset_control_get_exclusive(dev, "audiosys"); 2208 if (IS_ERR(rstc)) 2209 return dev_err_probe(dev, PTR_ERR(rstc), "could not get audiosys reset\n"); 2210 2211 ret = reset_control_reset(rstc); 2212 if (ret) 2213 return dev_err_probe(dev, ret, "failed to trigger audio reset\n"); 2214 2215 ret = devm_pm_runtime_enable(&pdev->dev); 2216 if (ret) 2217 return ret; 2218 2219 /* regmap init */ 2220 afe->regmap = syscon_node_to_regmap(dev->parent->of_node); 2221 if (IS_ERR(afe->regmap)) 2222 return dev_err_probe(dev, PTR_ERR(afe->regmap), 2223 "could not get regmap from parent"); 2224 2225 ret = regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config); 2226 if (ret) 2227 return dev_err_probe(dev, ret, "regmap_attach_dev fail\n"); 2228 2229 /* enable clock for regcache get default value from hw */ 2230 afe_priv->pm_runtime_bypass_reg_ctl = true; 2231 pm_runtime_get_sync(&pdev->dev); 2232 2233 ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config); 2234 if (ret) 2235 return dev_err_probe(dev, ret, "regmap_reinit_cache fail\n"); 2236 2237 pm_runtime_put_sync(&pdev->dev); 2238 afe_priv->pm_runtime_bypass_reg_ctl = false; 2239 2240 regcache_cache_only(afe->regmap, true); 2241 regcache_mark_dirty(afe->regmap); 2242 2243 /* init memif */ 2244 afe->memif_size = MT8192_MEMIF_NUM; 2245 afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), 2246 GFP_KERNEL); 2247 if (!afe->memif) 2248 return -ENOMEM; 2249 2250 for (i = 0; i < afe->memif_size; i++) { 2251 afe->memif[i].data = &memif_data[i]; 2252 afe->memif[i].irq_usage = memif_irq_usage[i]; 2253 afe->memif[i].const_irq = 1; 2254 } 2255 2256 mutex_init(&afe->irq_alloc_lock); /* needed when dynamic irq */ 2257 2258 /* init irq */ 2259 afe->irqs_size = MT8192_IRQ_NUM; 2260 afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), 2261 GFP_KERNEL); 2262 if (!afe->irqs) 2263 return -ENOMEM; 2264 2265 for (i = 0; i < afe->irqs_size; i++) 2266 afe->irqs[i].irq_data = &irq_data[i]; 2267 2268 /* request irq */ 2269 irq_id = platform_get_irq(pdev, 0); 2270 if (irq_id < 0) 2271 return irq_id; 2272 2273 ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler, 2274 IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); 2275 if (ret) 2276 return dev_err_probe(dev, ret, "could not request_irq for Afe_ISR_Handle\n"); 2277 2278 /* init sub_dais */ 2279 INIT_LIST_HEAD(&afe->sub_dais); 2280 2281 for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) { 2282 ret = dai_register_cbs[i](afe); 2283 if (ret) > 2284 return dev_err_probe(afe->dev, ret, "dai %d register fail"); 2285 } 2286 2287 /* init dai_driver and component_driver */ 2288 ret = mtk_afe_combine_sub_dai(afe); 2289 if (ret) 2290 return dev_err_probe(afe->dev, ret, "mtk_afe_combine_sub_dai fail\n"); 2291 2292 /* others */ 2293 afe->mtk_afe_hardware = &mt8192_afe_hardware; 2294 afe->memif_fs = mt8192_memif_fs; 2295 afe->irq_fs = mt8192_irq_fs; 2296 afe->get_dai_fs = mt8192_get_dai_fs; 2297 afe->get_memif_pbuf_size = mt8192_get_memif_pbuf_size; 2298 afe->memif_32bit_supported = 1; 2299 2300 afe->runtime_resume = mt8192_afe_runtime_resume; 2301 afe->runtime_suspend = mt8192_afe_runtime_suspend; 2302 2303 /* register platform */ 2304 ret = devm_snd_soc_register_component(&pdev->dev, 2305 &mt8192_afe_component, NULL, 0); 2306 if (ret) 2307 return dev_err_probe(dev, ret, "Couldn't register AFE component\n"); 2308 2309 ret = devm_snd_soc_register_component(&pdev->dev, 2310 &mt8192_afe_pcm_component, 2311 afe->dai_drivers, 2312 afe->num_dai_drivers); 2313 if (ret) 2314 return dev_err_probe(dev, ret, "Couldn't register AFE-PCM component\n"); 2315 2316 return 0; 2317 } 2318
Hi AngeloGioacchino, kernel test robot noticed the following build warnings: [auto build test WARNING on broonie-sound/for-next] [also build test WARNING on broonie-spi/for-next tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.7 next-20240112] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/AngeloGioacchino-Del-Regno/ASoC-mediatek-mt8173-afe-pcm-Convert-to-devm_pm_runtime_enable/20240111-185734 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20240111105247.117766-7-angelogioacchino.delregno%40collabora.com patch subject: [PATCH 6/7] ASoC: mediatek: mt8192-afe-pcm: Simplify with dev_err_probe() config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20240112/202401121548.rwSkkCvR-lkp@intel.com/config) compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 9bde5becb44ea071f5e1fa1f5d4071dc8788b18c) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240112/202401121548.rwSkkCvR-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401121548.rwSkkCvR-lkp@intel.com/ All warnings (new ones prefixed by >>): >> sound/soc/mediatek/mt8192/mt8192-afe-pcm.c:2284:46: warning: more '%' conversions than data arguments [-Wformat-insufficient-args] 2284 | return dev_err_probe(afe->dev, ret, "dai %d register fail"); | ~^ 1 warning generated. vim +2284 sound/soc/mediatek/mt8192/mt8192-afe-pcm.c 2172 2173 static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) 2174 { 2175 struct mtk_base_afe *afe; 2176 struct mt8192_afe_private *afe_priv; 2177 struct device *dev; 2178 struct reset_control *rstc; 2179 int i, ret, irq_id; 2180 2181 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); 2182 if (ret) 2183 return ret; 2184 2185 afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); 2186 if (!afe) 2187 return -ENOMEM; 2188 platform_set_drvdata(pdev, afe); 2189 2190 afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), 2191 GFP_KERNEL); 2192 if (!afe->platform_priv) 2193 return -ENOMEM; 2194 afe_priv = afe->platform_priv; 2195 2196 afe->dev = &pdev->dev; 2197 dev = afe->dev; 2198 2199 /* init audio related clock */ 2200 ret = mt8192_init_clock(afe); 2201 if (ret) { 2202 dev_err(dev, "init clock error\n"); 2203 return ret; 2204 } 2205 2206 /* reset controller to reset audio regs before regmap cache */ 2207 rstc = devm_reset_control_get_exclusive(dev, "audiosys"); 2208 if (IS_ERR(rstc)) 2209 return dev_err_probe(dev, PTR_ERR(rstc), "could not get audiosys reset\n"); 2210 2211 ret = reset_control_reset(rstc); 2212 if (ret) 2213 return dev_err_probe(dev, ret, "failed to trigger audio reset\n"); 2214 2215 ret = devm_pm_runtime_enable(&pdev->dev); 2216 if (ret) 2217 return ret; 2218 2219 /* regmap init */ 2220 afe->regmap = syscon_node_to_regmap(dev->parent->of_node); 2221 if (IS_ERR(afe->regmap)) 2222 return dev_err_probe(dev, PTR_ERR(afe->regmap), 2223 "could not get regmap from parent"); 2224 2225 ret = regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config); 2226 if (ret) 2227 return dev_err_probe(dev, ret, "regmap_attach_dev fail\n"); 2228 2229 /* enable clock for regcache get default value from hw */ 2230 afe_priv->pm_runtime_bypass_reg_ctl = true; 2231 pm_runtime_get_sync(&pdev->dev); 2232 2233 ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config); 2234 if (ret) 2235 return dev_err_probe(dev, ret, "regmap_reinit_cache fail\n"); 2236 2237 pm_runtime_put_sync(&pdev->dev); 2238 afe_priv->pm_runtime_bypass_reg_ctl = false; 2239 2240 regcache_cache_only(afe->regmap, true); 2241 regcache_mark_dirty(afe->regmap); 2242 2243 /* init memif */ 2244 afe->memif_size = MT8192_MEMIF_NUM; 2245 afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), 2246 GFP_KERNEL); 2247 if (!afe->memif) 2248 return -ENOMEM; 2249 2250 for (i = 0; i < afe->memif_size; i++) { 2251 afe->memif[i].data = &memif_data[i]; 2252 afe->memif[i].irq_usage = memif_irq_usage[i]; 2253 afe->memif[i].const_irq = 1; 2254 } 2255 2256 mutex_init(&afe->irq_alloc_lock); /* needed when dynamic irq */ 2257 2258 /* init irq */ 2259 afe->irqs_size = MT8192_IRQ_NUM; 2260 afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), 2261 GFP_KERNEL); 2262 if (!afe->irqs) 2263 return -ENOMEM; 2264 2265 for (i = 0; i < afe->irqs_size; i++) 2266 afe->irqs[i].irq_data = &irq_data[i]; 2267 2268 /* request irq */ 2269 irq_id = platform_get_irq(pdev, 0); 2270 if (irq_id < 0) 2271 return irq_id; 2272 2273 ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler, 2274 IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); 2275 if (ret) 2276 return dev_err_probe(dev, ret, "could not request_irq for Afe_ISR_Handle\n"); 2277 2278 /* init sub_dais */ 2279 INIT_LIST_HEAD(&afe->sub_dais); 2280 2281 for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) { 2282 ret = dai_register_cbs[i](afe); 2283 if (ret) > 2284 return dev_err_probe(afe->dev, ret, "dai %d register fail"); 2285 } 2286 2287 /* init dai_driver and component_driver */ 2288 ret = mtk_afe_combine_sub_dai(afe); 2289 if (ret) 2290 return dev_err_probe(afe->dev, ret, "mtk_afe_combine_sub_dai fail\n"); 2291 2292 /* others */ 2293 afe->mtk_afe_hardware = &mt8192_afe_hardware; 2294 afe->memif_fs = mt8192_memif_fs; 2295 afe->irq_fs = mt8192_irq_fs; 2296 afe->get_dai_fs = mt8192_get_dai_fs; 2297 afe->get_memif_pbuf_size = mt8192_get_memif_pbuf_size; 2298 afe->memif_32bit_supported = 1; 2299 2300 afe->runtime_resume = mt8192_afe_runtime_resume; 2301 afe->runtime_suspend = mt8192_afe_runtime_suspend; 2302 2303 /* register platform */ 2304 ret = devm_snd_soc_register_component(&pdev->dev, 2305 &mt8192_afe_component, NULL, 0); 2306 if (ret) 2307 return dev_err_probe(dev, ret, "Couldn't register AFE component\n"); 2308 2309 ret = devm_snd_soc_register_component(&pdev->dev, 2310 &mt8192_afe_pcm_component, 2311 afe->dai_drivers, 2312 afe->num_dai_drivers); 2313 if (ret) 2314 return dev_err_probe(dev, ret, "Couldn't register AFE-PCM component\n"); 2315 2316 return 0; 2317 } 2318
diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c index 794419d16b01..7242e6a4625c 100644 --- a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +++ b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c @@ -2205,17 +2205,12 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) /* reset controller to reset audio regs before regmap cache */ rstc = devm_reset_control_get_exclusive(dev, "audiosys"); - if (IS_ERR(rstc)) { - ret = PTR_ERR(rstc); - dev_err(dev, "could not get audiosys reset:%d\n", ret); - return ret; - } + if (IS_ERR(rstc)) + return dev_err_probe(dev, PTR_ERR(rstc), "could not get audiosys reset\n"); ret = reset_control_reset(rstc); - if (ret) { - dev_err(dev, "failed to trigger audio reset:%d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "failed to trigger audio reset\n"); ret = devm_pm_runtime_enable(&pdev->dev); if (ret) @@ -2223,25 +2218,21 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) /* regmap init */ afe->regmap = syscon_node_to_regmap(dev->parent->of_node); - if (IS_ERR(afe->regmap)) { - dev_err(dev, "could not get regmap from parent\n"); - return PTR_ERR(afe->regmap); - } + if (IS_ERR(afe->regmap)) + return dev_err_probe(dev, PTR_ERR(afe->regmap), + "could not get regmap from parent"); + ret = regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config); - if (ret) { - dev_warn(dev, "regmap_attach_dev fail, ret %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "regmap_attach_dev fail\n"); /* enable clock for regcache get default value from hw */ afe_priv->pm_runtime_bypass_reg_ctl = true; pm_runtime_get_sync(&pdev->dev); ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config); - if (ret) { - dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "regmap_reinit_cache fail\n"); pm_runtime_put_sync(&pdev->dev); afe_priv->pm_runtime_bypass_reg_ctl = false; @@ -2281,30 +2272,22 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler, IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); - if (ret) { - dev_err(dev, "could not request_irq for Afe_ISR_Handle\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "could not request_irq for Afe_ISR_Handle\n"); /* init sub_dais */ INIT_LIST_HEAD(&afe->sub_dais); for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) { ret = dai_register_cbs[i](afe); - if (ret) { - dev_warn(afe->dev, "dai register i %d fail, ret %d\n", - i, ret); - return ret; - } + if (ret) + return dev_err_probe(afe->dev, ret, "dai %d register fail"); } /* init dai_driver and component_driver */ ret = mtk_afe_combine_sub_dai(afe); - if (ret) { - dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n", - ret); - return ret; - } + if (ret) + return dev_err_probe(afe->dev, ret, "mtk_afe_combine_sub_dai fail\n"); /* others */ afe->mtk_afe_hardware = &mt8192_afe_hardware; @@ -2320,19 +2303,15 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) /* register platform */ ret = devm_snd_soc_register_component(&pdev->dev, &mt8192_afe_component, NULL, 0); - if (ret) { - dev_warn(dev, "err_platform\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Couldn't register AFE component\n"); ret = devm_snd_soc_register_component(&pdev->dev, &mt8192_afe_pcm_component, afe->dai_drivers, afe->num_dai_drivers); - if (ret) { - dev_warn(dev, "err_dai_component\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Couldn't register AFE-PCM component\n"); return 0; }
Simplify the probe function by switching error prints to return dev_err_probe(), lowering the lines count; while at it, also beautify some messages and change some others' level from warn to error. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 65 ++++++++-------------- 1 file changed, 22 insertions(+), 43 deletions(-)