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 1Ua8L2-0007Yc-8r for barebox@lists.infradead.org; Wed, 08 May 2013 17:39:38 +0000 From: =?UTF-8?q?Eric=20B=C3=A9nard?= Date: Wed, 8 May 2013 19:39:08 +0200 Message-Id: <1368034748-15462-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 v3] nand_base: sync flash detection functions with linux 3.9's code To: barebox@lists.infradead.org U2lnbmVkLW9mZi1ieTogRXJpYyBCw6luYXJkIDxlcmljQGV1a3JlYS5jb20+Ci0tLQogZHJpdmVy cy9tdGQvbmFuZC9uYW5kX2Jhc2UuYyB8IDM4NSArKysrKysrKysrKysrKysrKysrKysrKysrKysr KystLS0tLS0tLS0tLS0tCiBpbmNsdWRlL2xpbnV4L210ZC9iYm0uaCAgICAgIHwgICAyICsKIDIg ZmlsZXMgY2hhbmdlZCwgMjY4IGluc2VydGlvbnMoKyksIDExOSBkZWxldGlvbnMoLSkKCmRpZmYg LS1naXQgYS9kcml2ZXJzL210ZC9uYW5kL25hbmRfYmFzZS5jIGIvZHJpdmVycy9tdGQvbmFuZC9u YW5kX2Jhc2UuYwppbmRleCBlODEwM2NmLi5lNjAxZjg0IDEwMDY0NAotLS0gYS9kcml2ZXJzL210 ZC9uYW5kL25hbmRfYmFzZS5jCisrKyBiL2RyaXZlcnMvbXRkL25hbmQvbmFuZF9iYXNlLmMKQEAg LTEwNzcsNyArMTA3Nyw2IEBAIHN0YXRpYyBpbnQgbmFuZF9mbGFzaF9kZXRlY3Rfb25maShzdHJ1 Y3QgbXRkX2luZm8gKm10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