From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp3-g21.free.fr ([2a01:e0c:1:1599::12]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ua7mY-000758-DS for barebox@lists.infradead.org; Wed, 08 May 2013 17:04:00 +0000 From: =?UTF-8?q?Eric=20B=C3=A9nard?= Date: Wed, 8 May 2013 19:03:30 +0200 Message-Id: <1368032610-11277-1-git-send-email-eric@eukrea.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v2] nand_base: fix to test for JCPV problem To: barebox@lists.infradead.org U2lnbmVkLW9mZi1ieTogRXJpYyBCw6luYXJkIDxlcmljQGV1a3JlYS5jb20+Ci0tLQp0aGlzIHBh dGNoIHN5bmMgZmxhc2ggZGV0ZWN0aW9uIGZ1bmN0aW9ucyB3aXRoIGxpbnV4IDMuOSdzIGNvZGUK IGRyaXZlcnMvbXRkL25hbmQvbmFuZF9iYXNlLmMgfCAzNzcgKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrLS0tLS0tLS0tLS0tLQogaW5jbHVkZS9saW51eC9tdGQvYmJtLmggICAgICB8ICAg MiArCiAyIGZpbGVzIGNoYW5nZWQsIDI2NSBpbnNlcnRpb25zKCspLCAxMTQgZGVsZXRpb25zKC0p CgpkaWZmIC0tZ2l0IGEvZHJpdmVycy9tdGQvbmFuZC9uYW5kX2Jhc2UuYyBiL2RyaXZlcnMvbXRk L25hbmQvbmFuZF9iYXNlLmMKaW5kZXggZTgxMDNjZi4uOWJmZGRmOSAxMDA2NDQKLS0tIGEvZHJp dmVycy9tdGQvbmFuZC9uYW5kX2Jhc2UuYworKysgYi9kcml2ZXJzL210ZC9uYW5kL25hbmRfYmFz ZS5jCkBAIC0xMDc3LDcgKz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