Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752748Ab3JHMed (ORCPT ); Tue, 8 Oct 2013 08:34:33 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:62862 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635Ab3JHMeb (ORCPT ); Tue, 8 Oct 2013 08:34:31 -0400 MIME-Version: 1.0 In-Reply-To: <20131008121326.GB21581@sirena.org.uk> References: <20131008121326.GB21581@sirena.org.uk> From: Richard Genoud Date: Tue, 8 Oct 2013 14:34:09 +0200 Message-ID: Subject: Re: [BUG] spi/spi-atmel: DMA rx buffer corruption with SPI_IOC_MESSAGE To: Mark Brown Cc: Nicolas Ferre , Wenyou Yang , linux-spi@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: multipart/mixed; boundary=001a11c350967133f704e839fd98 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3891 Lines: 66 --001a11c350967133f704e839fd98 Content-Type: text/plain; charset=UTF-8 2013/10/8 Mark Brown : > On Tue, Oct 08, 2013 at 12:44:16PM +0200, Richard Genoud wrote: > >> I'm attaching the test software that I used ( ./spi_test /dev/spidevx.x ) > > Looks like the attachment got forgotten? arg !!! thanks ! here it is. --001a11c350967133f704e839fd98 Content-Type: text/x-csrc; charset=US-ASCII; name="spi_test.c" Content-Disposition: attachment; filename="spi_test.c" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hmj40vdl1 I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8dW5pc3RkLmg+CiNpbmNsdWRlIDxzdGRpby5o PgojaW5jbHVkZSA8c3lzL3R5cGVzLmg+CiNpbmNsdWRlIDxzeXMvc3RhdC5oPgojaW5jbHVkZSA8 ZmNudGwuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8c3lzL2lvY3RsLmg+CiNpbmNs dWRlIDxs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J1ZiwgRklMTF9CWVRFLCB4ZmVyW2ldLmxlbik7CgkJfQoKCQllcnIg PSBpb2N0bChmZCwgU1BJX0lPQ19NRVNTQUdFKE5CKSwgeGZlcik7CgkJaWYgKGVyciA8IDApIHsK CQkJcGVycm9yKCJpb2N0bCIpOwoJCQlicmVhazsKCQl9CgkJaWYgKGVyciAhPSAoc2l6ZW9mKHJ4 X2J1ZmZlcikgKyBzaXplb2YocnhfZm9vdGVyKQoJCQkgICAgKyBzaXplb2YocnhfaGVhZGVyKSkp IHsKCQkJcHJpbnRmKCJtZXNzYWdlIHRvbyBzaG9ydDogJWQgYnl0ZXNcbiIsIGVycik7CgkJCWJy ZWFrOwoJCX0KCQlmb3IgKGkgPSAwOyBpIDwgTkI7IGkrKykgewoJCQllcnIgPSBjaGVja19idWYo KGNoYXIgKikoeGZlcltpXS5yeF9idWYpLCB4ZmVyW2ldLmxlbiwgUlhfQllURSk7CgkJCWlmIChl cnIpCgkJCQlkdW1wKChjaGFyICopKHhmZXJbaV0ucnhfYnVmKSwgeGZlcltpXS5sZW4pOwoJCX0K CX0KCgkodm9pZCkgY2xvc2UoZmQpOwpvdXQ6CglyZXR1cm4gZXJyOwp9Cg== --001a11c350967133f704e839fd98-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/