Lines Matching refs:cnt

2289 static void dw_mci_set_part_bytes(struct dw_mci *host, void *buf, int cnt)
2291 memcpy((void *)&host->part_buf, buf, cnt);
2292 host->part_buf_count = cnt;
2296 static int dw_mci_push_part_bytes(struct dw_mci *host, void *buf, int cnt)
2298 cnt = min(cnt, (1 << host->data_shift) - host->part_buf_count);
2299 memcpy((void *)&host->part_buf + host->part_buf_count, buf, cnt);
2300 host->part_buf_count += cnt;
2301 return cnt;
2305 static int dw_mci_pull_part_bytes(struct dw_mci *host, void *buf, int cnt)
2307 cnt = min_t(int, cnt, host->part_buf_count);
2308 if (cnt) {
2310 cnt);
2311 host->part_buf_count -= cnt;
2312 host->part_buf_start += cnt;
2314 return cnt;
2318 static void dw_mci_pull_final_bytes(struct dw_mci *host, void *buf, int cnt)
2320 memcpy(buf, &host->part_buf, cnt);
2321 host->part_buf_start = cnt;
2322 host->part_buf_count = (1 << host->data_shift) - cnt;
2325 static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
2328 int init_cnt = cnt;
2332 int len = dw_mci_push_part_bytes(host, buf, cnt);
2335 cnt -= len;
2343 while (cnt >= 2) {
2345 int len = min(cnt & -2, (int)sizeof(aligned_buf));
2351 cnt -= len;
2361 for (; cnt >= 2; cnt -= 2)
2366 if (cnt) {
2367 dw_mci_set_part_bytes(host, buf, cnt);
2375 static void dw_mci_pull_data16(struct dw_mci *host, void *buf, int cnt)
2379 while (cnt >= 2) {
2382 int len = min(cnt & -2, (int)sizeof(aligned_buf));
2391 cnt -= len;
2398 for (; cnt >= 2; cnt -= 2)
2402 if (cnt) {
2404 dw_mci_pull_final_bytes(host, buf, cnt);
2408 static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
2411 int init_cnt = cnt;
2415 int len = dw_mci_push_part_bytes(host, buf, cnt);
2418 cnt -= len;
2426 while (cnt >= 4) {
2428 int len = min(cnt & -4, (int)sizeof(aligned_buf));
2434 cnt -= len;
2444 for (; cnt >= 4; cnt -= 4)
2449 if (cnt) {
2450 dw_mci_set_part_bytes(host, buf, cnt);
2458 static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
2462 while (cnt >= 4) {
2465 int len = min(cnt & -4, (int)sizeof(aligned_buf));
2474 cnt -= len;
2481 for (; cnt >= 4; cnt -= 4)
2485 if (cnt) {
2487 dw_mci_pull_final_bytes(host, buf, cnt);
2491 static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
2494 int init_cnt = cnt;
2498 int len = dw_mci_push_part_bytes(host, buf, cnt);
2501 cnt -= len;
2510 while (cnt >= 8) {
2512 int len = min(cnt & -8, (int)sizeof(aligned_buf));
2518 cnt -= len;
2528 for (; cnt >= 8; cnt -= 8)
2533 if (cnt) {
2534 dw_mci_set_part_bytes(host, buf, cnt);
2542 static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
2546 while (cnt >= 8) {
2549 int len = min(cnt & -8, (int)sizeof(aligned_buf));
2559 cnt -= len;
2566 for (; cnt >= 8; cnt -= 8)
2570 if (cnt) {
2572 dw_mci_pull_final_bytes(host, buf, cnt);
2576 static void dw_mci_pull_data(struct dw_mci *host, void *buf, int cnt)
2581 len = dw_mci_pull_part_bytes(host, buf, cnt);
2582 if (unlikely(len == cnt))
2585 cnt -= len;
2588 host->pull_data(host, buf, cnt);