From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from 9.77.mail-out.ovh.net ([87.98.189.41] helo=77.mail-out.ovh.net) by canuck.infradead.org with smtp (Exim 4.72 #1 (Red Hat Linux)) id 1Pd2W7-0005Zn-3J for barebox@lists.infradead.org; Wed, 12 Jan 2011 15:21:44 +0000 From: =?UTF-8?q?Eric=20B=C3=A9nard?= Date: Wed, 12 Jan 2011 16:21:37 +0100 Message-Id: <1294845697-2729-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-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] i2c-imx: sync with kernel's driver To: s.hauer@pengutronix.de Cc: barebox@lists.infradead.org c3RyYW5nZSBiZWhhdmlvdXIgd2FzIG9ic2VydmVkIHdpdGggYWN0dWFsIGRyaXZlciA6IGJ1cyBs b2NrLCBwcm9iZSBvZgphYnNlbnQgYWRyZXNzZXMsIHdyb25nIGRhdGEgcmVhZC4KVGhpcyBwYXRj aCBzeW5jIHRoZSBkcml2ZXIgd2l0aCBsaW51eCdzIG9uZSBhbmQgYWZ0ZXIgYSBmZXcgdGVzdHMs IHdlCmRvbid0IHNlZSBhbnltb3JlIHN0cmFuZ2UgYmVoYXZpb3VyICh0ZXN0ZWQgb24gaS5NWDI3 KS4KClNpZ25lZC1vZmYtYnk6IEVyaWMgQsOpbmFyZCA8ZXJpY0BldWtyZWEuY29tPgotLS0KIGRy aXZlcnMvaTJjL2J1c3Nlcy9pMmMtaW14LmMgfCAgIDM1ICsrKysrKysrLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tCiAxIGZpbGVzIGNoYW5nZWQsIDggaW5zZXJ0aW9ucygrKSwgMjcgZGVsZXRp b25zKC0pCgpkaWZmIC0tZ2l0IGEvZHJpdmVycy9p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