From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eJR0t-00057F-Te for barebox@lists.infradead.ORG; Mon, 27 Nov 2017 21:32:30 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 27 Nov 2017 22:31:56 +0100 Message-Id: <20171127213156.24187-1-u.kleine-koenig@pengutronix.de> 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] net/e1000: implement protect and unprotect for attached flash To: barebox@lists.infradead.org U29tZSBzdXBwb3J0ZWQgZmxhc2ggZGV2aWNlcyAoZS5nLiBTU1QyNVZGMDQwKSBhcmUgd3JpdGUg cHJvdGVjdGVkIGFmdGVyCnBvd2VyIHVwLiBJZiB0aGUgZGV2aWNlIGhvbGRzIGEgdmFsaWQgZmly bXdhcmUgaW1hZ2UgdGhlIGkyMTAgY2FuIGhhbmRsZQp0aGF0IGp1c3QgZmluZS4gSWYgaG93ZXZl ciB0aGVyZSBpcyBubyBmaXJtd2FyZSBwcm9ncmFtbWVkLCBhIHByb2NlZHVyZQppcyBuZWVkZWQg dG8gcmVtb3ZlIHRoaXMgcHJvdGVjdGlvbiBiZWZvcmUgYW4gaW1hZ2UgY2FuIGJlIGZsYXNoZWQu CgpTbyBpbXBsZW1lbnQgdGhlIG5lZWRlZCBjYWxsYmFja3MgdG8gbWFrZSB0aGUgY29tbWFuZHMg cHJvdGVjdCBhbmQKdW5wcm90ZWN0IGRvIHRoZSByaWdodCB0aGluZy4KClNpZ25lZC1vZmYtYnk6 IFV3ZSBLbGVpbmUtS8O2bmlnIDx1LmtsZWluZS1rb2VuaWdAcGV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