sa11x0-dma.c (664b0bae0b87f69bc9deb098f5e0158b9cf18e04) sa11x0-dma.c (acafe7e30216166a17e6e226aadc3ecb63993242)
1/*
2 * SA11x0 DMAengine support
3 *
4 * Copyright (C) 2012 Russell King
5 * Derived in part from arch/arm/mach-sa1100/dma.c,
6 * Copyright (C) 2000, 2001 by Nicolas Pitre
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 543 unchanged lines hidden (view full) ---

552 j += DIV_ROUND_UP(len, DMA_MAX_SIZE & ~DMA_ALIGN) - 1;
553 if (addr & DMA_ALIGN) {
554 dev_dbg(chan->device->dev, "vchan %p: bad buffer alignment: %pad\n",
555 &c->vc, &addr);
556 return NULL;
557 }
558 }
559
1/*
2 * SA11x0 DMAengine support
3 *
4 * Copyright (C) 2012 Russell King
5 * Derived in part from arch/arm/mach-sa1100/dma.c,
6 * Copyright (C) 2000, 2001 by Nicolas Pitre
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 543 unchanged lines hidden (view full) ---

552 j += DIV_ROUND_UP(len, DMA_MAX_SIZE & ~DMA_ALIGN) - 1;
553 if (addr & DMA_ALIGN) {
554 dev_dbg(chan->device->dev, "vchan %p: bad buffer alignment: %pad\n",
555 &c->vc, &addr);
556 return NULL;
557 }
558 }
559
560 txd = kzalloc(sizeof(*txd) + j * sizeof(txd->sg[0]), GFP_ATOMIC);
560 txd = kzalloc(struct_size(txd, sg, j), GFP_ATOMIC);
561 if (!txd) {
562 dev_dbg(chan->device->dev, "vchan %p: kzalloc failed\n", &c->vc);
563 return NULL;
564 }
565
566 j = 0;
567 for_each_sg(sg, sgent, sglen, i) {
568 dma_addr_t addr = sg_dma_address(sgent);

--- 53 unchanged lines hidden (view full) ---

622
623 sgperiod = DIV_ROUND_UP(period, DMA_MAX_SIZE & ~DMA_ALIGN);
624 sglen = size * sgperiod / period;
625
626 /* Do not allow zero-sized txds */
627 if (sglen == 0)
628 return NULL;
629
561 if (!txd) {
562 dev_dbg(chan->device->dev, "vchan %p: kzalloc failed\n", &c->vc);
563 return NULL;
564 }
565
566 j = 0;
567 for_each_sg(sg, sgent, sglen, i) {
568 dma_addr_t addr = sg_dma_address(sgent);

--- 53 unchanged lines hidden (view full) ---

622
623 sgperiod = DIV_ROUND_UP(period, DMA_MAX_SIZE & ~DMA_ALIGN);
624 sglen = size * sgperiod / period;
625
626 /* Do not allow zero-sized txds */
627 if (sglen == 0)
628 return NULL;
629
630 txd = kzalloc(sizeof(*txd) + sglen * sizeof(txd->sg[0]), GFP_ATOMIC);
630 txd = kzalloc(struct_size(txd, sg, sglen), GFP_ATOMIC);
631 if (!txd) {
632 dev_dbg(chan->device->dev, "vchan %p: kzalloc failed\n", &c->vc);
633 return NULL;
634 }
635
636 for (i = k = 0; i < size / period; i++) {
637 size_t tlen, len = period;
638

--- 479 unchanged lines hidden ---
631 if (!txd) {
632 dev_dbg(chan->device->dev, "vchan %p: kzalloc failed\n", &c->vc);
633 return NULL;
634 }
635
636 for (i = k = 0; i < size / period; i++) {
637 size_t tlen, len = period;
638

--- 479 unchanged lines hidden ---