@@ -47,16 +47,12 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
47
47
if (of_property_read_u32 (np , "clock-frequency" , & clk )) {
48
48
49
49
/* Get clk rate through clk driver if present */
50
- info -> clk = devm_clk_get ( & ofdev -> dev , NULL );
50
+ info -> clk = devm_clk_get_enabled ( dev , NULL );
51
51
if (IS_ERR (info -> clk )) {
52
52
ret = dev_err_probe (dev , PTR_ERR (info -> clk ), "failed to get clock\n" );
53
53
goto err_pmruntime ;
54
54
}
55
55
56
- ret = clk_prepare_enable (info -> clk );
57
- if (ret < 0 )
58
- goto err_pmruntime ;
59
-
60
56
clk = clk_get_rate (info -> clk );
61
57
}
62
58
/* If current-speed was set, then try not to change it. */
@@ -66,7 +62,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
66
62
ret = of_address_to_resource (np , 0 , & resource );
67
63
if (ret ) {
68
64
dev_err_probe (dev , ret , "invalid address\n" );
69
- goto err_unprepare ;
65
+ goto err_pmruntime ;
70
66
}
71
67
72
68
port -> flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT |
@@ -85,7 +81,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
85
81
if (prop >= port -> mapsize ) {
86
82
ret = dev_err_probe (dev , - EINVAL , "reg-offset %u exceeds region size %pa\n" ,
87
83
prop , & port -> mapsize );
88
- goto err_unprepare ;
84
+ goto err_pmruntime ;
89
85
}
90
86
91
87
port -> mapbase += prop ;
@@ -108,7 +104,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
108
104
default :
109
105
ret = dev_err_probe (dev , - EINVAL , "unsupported reg-io-width (%u)\n" ,
110
106
prop );
111
- goto err_unprepare ;
107
+ goto err_pmruntime ;
112
108
}
113
109
}
114
110
port -> flags |= UPF_IOREMAP ;
@@ -135,7 +131,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
135
131
if (irq < 0 ) {
136
132
if (irq == - EPROBE_DEFER ) {
137
133
ret = - EPROBE_DEFER ;
138
- goto err_unprepare ;
134
+ goto err_pmruntime ;
139
135
}
140
136
/* IRQ support not mandatory */
141
137
irq = 0 ;
@@ -146,12 +142,12 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
146
142
info -> rst = devm_reset_control_get_optional_shared (& ofdev -> dev , NULL );
147
143
if (IS_ERR (info -> rst )) {
148
144
ret = PTR_ERR (info -> rst );
149
- goto err_unprepare ;
145
+ goto err_pmruntime ;
150
146
}
151
147
152
148
ret = reset_control_deassert (info -> rst );
153
149
if (ret )
154
- goto err_unprepare ;
150
+ goto err_pmruntime ;
155
151
156
152
port -> type = type ;
157
153
port -> uartclk = clk ;
@@ -169,7 +165,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
169
165
case PORT_RT2880 :
170
166
ret = rt288x_setup (port );
171
167
if (ret )
172
- goto err_unprepare ;
168
+ goto err_pmruntime ;
173
169
break ;
174
170
}
175
171
@@ -181,8 +177,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
181
177
}
182
178
183
179
return 0 ;
184
- err_unprepare :
185
- clk_disable_unprepare (info -> clk );
186
180
err_pmruntime :
187
181
pm_runtime_put_sync (& ofdev -> dev );
188
182
pm_runtime_disable (& ofdev -> dev );
@@ -249,7 +243,6 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
249
243
irq_dispose_mapping (port8250 .port .irq );
250
244
pm_runtime_put_sync (& ofdev -> dev );
251
245
pm_runtime_disable (& ofdev -> dev );
252
- clk_disable_unprepare (info -> clk );
253
246
err_free :
254
247
kfree (info );
255
248
return ret ;
@@ -267,7 +260,6 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
267
260
reset_control_assert (info -> rst );
268
261
pm_runtime_put_sync (& ofdev -> dev );
269
262
pm_runtime_disable (& ofdev -> dev );
270
- clk_disable_unprepare (info -> clk );
271
263
kfree (info );
272
264
return 0 ;
273
265
}
0 commit comments