.. | .. |
---|
970 | 970 | if (status & (IRQ_END_OF_CHAIN | IRQ_RESP_STATUS)) { |
---|
971 | 971 | if (data && !cmd->error) |
---|
972 | 972 | data->bytes_xfered = data->blksz * data->blocks; |
---|
973 | | - if (meson_mmc_bounce_buf_read(data) || |
---|
974 | | - meson_mmc_get_next_command(cmd)) |
---|
975 | | - ret = IRQ_WAKE_THREAD; |
---|
976 | | - else |
---|
977 | | - ret = IRQ_HANDLED; |
---|
| 973 | + |
---|
| 974 | + return IRQ_WAKE_THREAD; |
---|
978 | 975 | } |
---|
979 | 976 | |
---|
980 | 977 | out: |
---|
.. | .. |
---|
985 | 982 | start &= ~START_DESC_BUSY; |
---|
986 | 983 | writel(start, host->regs + SD_EMMC_START); |
---|
987 | 984 | } |
---|
988 | | - |
---|
989 | | - if (ret == IRQ_HANDLED) |
---|
990 | | - meson_mmc_request_done(host->mmc, cmd->mrq); |
---|
991 | 985 | |
---|
992 | 986 | return ret; |
---|
993 | 987 | } |
---|
.. | .. |
---|
1128 | 1122 | struct mmc_host *mmc; |
---|
1129 | 1123 | int ret; |
---|
1130 | 1124 | |
---|
1131 | | - mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev); |
---|
| 1125 | + mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(struct meson_host)); |
---|
1132 | 1126 | if (!mmc) |
---|
1133 | 1127 | return -ENOMEM; |
---|
1134 | 1128 | host = mmc_priv(mmc); |
---|
.. | .. |
---|
1144 | 1138 | host->vqmmc_enabled = false; |
---|
1145 | 1139 | ret = mmc_regulator_get_supply(mmc); |
---|
1146 | 1140 | if (ret) |
---|
1147 | | - goto free_host; |
---|
| 1141 | + return ret; |
---|
1148 | 1142 | |
---|
1149 | 1143 | ret = mmc_of_parse(mmc); |
---|
1150 | | - if (ret) { |
---|
1151 | | - if (ret != -EPROBE_DEFER) |
---|
1152 | | - dev_warn(&pdev->dev, "error parsing DT: %d\n", ret); |
---|
1153 | | - goto free_host; |
---|
1154 | | - } |
---|
| 1144 | + if (ret) |
---|
| 1145 | + return dev_err_probe(&pdev->dev, ret, "error parsing DT\n"); |
---|
1155 | 1146 | |
---|
1156 | 1147 | host->data = (struct meson_mmc_data *) |
---|
1157 | 1148 | of_device_get_match_data(&pdev->dev); |
---|
1158 | | - if (!host->data) { |
---|
1159 | | - ret = -EINVAL; |
---|
1160 | | - goto free_host; |
---|
1161 | | - } |
---|
| 1149 | + if (!host->data) |
---|
| 1150 | + return -EINVAL; |
---|
1162 | 1151 | |
---|
1163 | 1152 | ret = device_reset_optional(&pdev->dev); |
---|
1164 | | - if (ret) { |
---|
1165 | | - dev_err_probe(&pdev->dev, ret, "device reset failed\n"); |
---|
1166 | | - goto free_host; |
---|
1167 | | - } |
---|
| 1153 | + if (ret) |
---|
| 1154 | + return dev_err_probe(&pdev->dev, ret, "device reset failed\n"); |
---|
1168 | 1155 | |
---|
1169 | 1156 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
1170 | 1157 | host->regs = devm_ioremap_resource(&pdev->dev, res); |
---|
1171 | | - if (IS_ERR(host->regs)) { |
---|
1172 | | - ret = PTR_ERR(host->regs); |
---|
1173 | | - goto free_host; |
---|
1174 | | - } |
---|
| 1158 | + if (IS_ERR(host->regs)) |
---|
| 1159 | + return PTR_ERR(host->regs); |
---|
1175 | 1160 | |
---|
1176 | 1161 | host->irq = platform_get_irq(pdev, 0); |
---|
1177 | | - if (host->irq <= 0) { |
---|
1178 | | - ret = -EINVAL; |
---|
1179 | | - goto free_host; |
---|
1180 | | - } |
---|
| 1162 | + if (host->irq < 0) |
---|
| 1163 | + return host->irq; |
---|
1181 | 1164 | |
---|
1182 | 1165 | host->pinctrl = devm_pinctrl_get(&pdev->dev); |
---|
1183 | | - if (IS_ERR(host->pinctrl)) { |
---|
1184 | | - ret = PTR_ERR(host->pinctrl); |
---|
1185 | | - goto free_host; |
---|
1186 | | - } |
---|
| 1166 | + if (IS_ERR(host->pinctrl)) |
---|
| 1167 | + return PTR_ERR(host->pinctrl); |
---|
1187 | 1168 | |
---|
1188 | 1169 | host->pins_clk_gate = pinctrl_lookup_state(host->pinctrl, |
---|
1189 | 1170 | "clk-gate"); |
---|
.. | .. |
---|
1194 | 1175 | } |
---|
1195 | 1176 | |
---|
1196 | 1177 | host->core_clk = devm_clk_get(&pdev->dev, "core"); |
---|
1197 | | - if (IS_ERR(host->core_clk)) { |
---|
1198 | | - ret = PTR_ERR(host->core_clk); |
---|
1199 | | - goto free_host; |
---|
1200 | | - } |
---|
| 1178 | + if (IS_ERR(host->core_clk)) |
---|
| 1179 | + return PTR_ERR(host->core_clk); |
---|
1201 | 1180 | |
---|
1202 | 1181 | ret = clk_prepare_enable(host->core_clk); |
---|
1203 | 1182 | if (ret) |
---|
1204 | | - goto free_host; |
---|
| 1183 | + return ret; |
---|
1205 | 1184 | |
---|
1206 | 1185 | ret = meson_mmc_clk_init(host); |
---|
1207 | 1186 | if (ret) |
---|
.. | .. |
---|
1280 | 1259 | } |
---|
1281 | 1260 | |
---|
1282 | 1261 | mmc->ops = &meson_mmc_ops; |
---|
1283 | | - mmc_add_host(mmc); |
---|
| 1262 | + ret = mmc_add_host(mmc); |
---|
| 1263 | + if (ret) |
---|
| 1264 | + goto err_free_irq; |
---|
1284 | 1265 | |
---|
1285 | 1266 | return 0; |
---|
1286 | 1267 | |
---|
.. | .. |
---|
1294 | 1275 | clk_disable_unprepare(host->mmc_clk); |
---|
1295 | 1276 | err_core_clk: |
---|
1296 | 1277 | clk_disable_unprepare(host->core_clk); |
---|
1297 | | -free_host: |
---|
1298 | | - mmc_free_host(mmc); |
---|
1299 | 1278 | return ret; |
---|
1300 | 1279 | } |
---|
1301 | 1280 | |
---|
.. | .. |
---|
1319 | 1298 | clk_disable_unprepare(host->mmc_clk); |
---|
1320 | 1299 | clk_disable_unprepare(host->core_clk); |
---|
1321 | 1300 | |
---|
1322 | | - mmc_free_host(host->mmc); |
---|
1323 | 1301 | return 0; |
---|
1324 | 1302 | } |
---|
1325 | 1303 | |
---|