@@ -1054,26 +1054,26 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
10541054 struct mtk_base_afe * afe ;
10551055 struct mt8173_afe_private * afe_priv ;
10561056 struct snd_soc_component * comp_pcm , * comp_hdmi ;
1057+ struct device * dev = & pdev -> dev ;
10571058
1058- ret = dma_set_mask_and_coherent (& pdev -> dev , DMA_BIT_MASK (33 ));
1059+ ret = dma_set_mask_and_coherent (dev , DMA_BIT_MASK (33 ));
10591060 if (ret )
10601061 return ret ;
10611062
1062- afe = devm_kzalloc (& pdev -> dev , sizeof (* afe ), GFP_KERNEL );
1063+ afe = devm_kzalloc (dev , sizeof (* afe ), GFP_KERNEL );
10631064 if (!afe )
10641065 return - ENOMEM ;
10651066
1066- afe -> platform_priv = devm_kzalloc (& pdev -> dev , sizeof (* afe_priv ),
1067- GFP_KERNEL );
1067+ afe -> platform_priv = devm_kzalloc (dev , sizeof (* afe_priv ), GFP_KERNEL );
10681068 afe_priv = afe -> platform_priv ;
10691069 if (!afe_priv )
10701070 return - ENOMEM ;
10711071
1072- afe -> dev = & pdev -> dev ;
1072+ afe -> dev = dev ;
10731073
1074- ret = of_reserved_mem_device_init (& pdev -> dev );
1074+ ret = of_reserved_mem_device_init (dev );
10751075 if (ret ) {
1076- dev_info (& pdev -> dev , "no reserved memory found, pre-allocating buffers instead\n" );
1076+ dev_info (dev , "no reserved memory found, pre-allocating buffers instead\n" );
10771077 afe -> preallocate_buffers = true;
10781078 }
10791079
@@ -1085,27 +1085,27 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
10851085 if (IS_ERR (afe -> base_addr ))
10861086 return PTR_ERR (afe -> base_addr );
10871087
1088- afe -> regmap = devm_regmap_init_mmio (& pdev -> dev , afe -> base_addr ,
1089- & mt8173_afe_regmap_config );
1088+ afe -> regmap = devm_regmap_init_mmio (dev , afe -> base_addr ,
1089+ & mt8173_afe_regmap_config );
10901090 if (IS_ERR (afe -> regmap ))
10911091 return PTR_ERR (afe -> regmap );
10921092
10931093 /* initial audio related clock */
10941094 ret = mt8173_afe_init_audio_clk (afe );
10951095 if (ret ) {
1096- dev_err (afe -> dev , "mt8173_afe_init_audio_clk fail\n" );
1096+ dev_err (dev , "mt8173_afe_init_audio_clk fail\n" );
10971097 return ret ;
10981098 }
10991099
11001100 /* memif % irq initialize*/
11011101 afe -> memif_size = MT8173_AFE_MEMIF_NUM ;
1102- afe -> memif = devm_kcalloc (afe -> dev , afe -> memif_size ,
1102+ afe -> memif = devm_kcalloc (dev , afe -> memif_size ,
11031103 sizeof (* afe -> memif ), GFP_KERNEL );
11041104 if (!afe -> memif )
11051105 return - ENOMEM ;
11061106
11071107 afe -> irqs_size = MT8173_AFE_IRQ_NUM ;
1108- afe -> irqs = devm_kcalloc (afe -> dev , afe -> irqs_size ,
1108+ afe -> irqs = devm_kcalloc (dev , afe -> irqs_size ,
11091109 sizeof (* afe -> irqs ), GFP_KERNEL );
11101110 if (!afe -> irqs )
11111111 return - ENOMEM ;
@@ -1124,9 +1124,9 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
11241124
11251125 platform_set_drvdata (pdev , afe );
11261126
1127- pm_runtime_enable (& pdev -> dev );
1128- if (!pm_runtime_enabled (& pdev -> dev )) {
1129- ret = mt8173_afe_runtime_resume (& pdev -> dev );
1127+ pm_runtime_enable (dev );
1128+ if (!pm_runtime_enabled (dev )) {
1129+ ret = mt8173_afe_runtime_resume (dev );
11301130 if (ret )
11311131 goto err_pm_disable ;
11321132 }
@@ -1136,21 +1136,20 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
11361136 afe -> runtime_resume = mt8173_afe_runtime_resume ;
11371137 afe -> runtime_suspend = mt8173_afe_runtime_suspend ;
11381138
1139- ret = devm_snd_soc_register_component (& pdev -> dev ,
1140- & mtk_afe_pcm_platform ,
1141- NULL , 0 );
1139+ ret = devm_snd_soc_register_component (dev , & mtk_afe_pcm_platform ,
1140+ NULL , 0 );
11421141 if (ret )
11431142 goto err_pm_disable ;
11441143
1145- comp_pcm = devm_kzalloc (& pdev -> dev , sizeof (* comp_pcm ), GFP_KERNEL );
1144+ comp_pcm = devm_kzalloc (dev , sizeof (* comp_pcm ), GFP_KERNEL );
11461145 if (!comp_pcm ) {
11471146 ret = - ENOMEM ;
11481147 goto err_pm_disable ;
11491148 }
11501149
11511150 ret = snd_soc_component_initialize (comp_pcm ,
11521151 & mt8173_afe_pcm_dai_component ,
1153- & pdev -> dev );
1152+ dev );
11541153 if (ret )
11551154 goto err_pm_disable ;
11561155
@@ -1164,15 +1163,15 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
11641163 if (ret )
11651164 goto err_pm_disable ;
11661165
1167- comp_hdmi = devm_kzalloc (& pdev -> dev , sizeof (* comp_hdmi ), GFP_KERNEL );
1166+ comp_hdmi = devm_kzalloc (dev , sizeof (* comp_hdmi ), GFP_KERNEL );
11681167 if (!comp_hdmi ) {
11691168 ret = - ENOMEM ;
11701169 goto err_cleanup_components ;
11711170 }
11721171
11731172 ret = snd_soc_component_initialize (comp_hdmi ,
11741173 & mt8173_afe_hdmi_dai_component ,
1175- & pdev -> dev );
1174+ dev );
11761175 if (ret )
11771176 goto err_cleanup_components ;
11781177
@@ -1186,30 +1185,32 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
11861185 if (ret )
11871186 goto err_cleanup_components ;
11881187
1189- ret = devm_request_irq (afe -> dev , irq_id , mt8173_afe_irq_handler ,
1188+ ret = devm_request_irq (dev , irq_id , mt8173_afe_irq_handler ,
11901189 0 , "Afe_ISR_Handle" , (void * )afe );
11911190 if (ret ) {
1192- dev_err (afe -> dev , "could not request_irq\n" );
1191+ dev_err (dev , "could not request_irq\n" );
11931192 goto err_cleanup_components ;
11941193 }
11951194
1196- dev_info (& pdev -> dev , "MT8173 AFE driver initialized.\n" );
1195+ dev_info (dev , "MT8173 AFE driver initialized.\n" );
11971196 return 0 ;
11981197
11991198err_cleanup_components :
1200- snd_soc_unregister_component (& pdev -> dev );
1199+ snd_soc_unregister_component (dev );
12011200err_pm_disable :
1202- pm_runtime_disable (& pdev -> dev );
1201+ pm_runtime_disable (dev );
12031202 return ret ;
12041203}
12051204
12061205static void mt8173_afe_pcm_dev_remove (struct platform_device * pdev )
12071206{
1208- snd_soc_unregister_component ( & pdev -> dev ) ;
1207+ struct device * dev = & pdev -> dev ;
12091208
1210- pm_runtime_disable (& pdev -> dev );
1211- if (!pm_runtime_status_suspended (& pdev -> dev ))
1212- mt8173_afe_runtime_suspend (& pdev -> dev );
1209+ snd_soc_unregister_component (dev );
1210+
1211+ pm_runtime_disable (dev );
1212+ if (!pm_runtime_status_suspended (dev ))
1213+ mt8173_afe_runtime_suspend (dev );
12131214}
12141215
12151216static const struct of_device_id mt8173_afe_pcm_dt_match [] = {
0 commit comments