From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.emlix.com ([188.40.240.192]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7mYu-0007Sw-K2 for barebox@lists.infradead.org; Fri, 28 Feb 2020 20:48:49 +0000 Received: from mailer.emlix.com (unknown [81.20.119.6]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 668215FB1E for ; Fri, 28 Feb 2020 21:48:43 +0100 (CET) From: =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= Date: Fri, 28 Feb 2020 21:48:21 +0100 Message-Id: <20200228204823.28415-2-dg@emlix.com> In-Reply-To: <20200228204823.28415-1-dg@emlix.com> References: <20200228204823.28415-1-dg@emlix.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 1/3] fastboot: split generic code from USB gadget To: barebox@lists.infradead.org Cc: Edmund Henniges , =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= RnJvbTogRWRtdW5kIEhlbm5pZ2VzIDxlaEBlbWxpeC5jb20+CgpUaGUgZmFzdGJvb3Qgc3BlY2lm aWNhdGlvbiBkZXNjcmliZXMgb3RoZXIgcHJvdG9jb2xzIGJleW9uZCBVU0IuIEFsbG93CnRoZXNl IHRvIHJldXNlIHRoZSBnZW5lcmljIHBhcnRzIG9mIHRoZSBleGlzdGluZyBmYXN0Ym9vdCBjb2Rl IHdoZW4gdGhleQphcmUgaW1wbGVtZW50ZWQuCgpNb3N0IG9mIHRoZSBjaGFuZ2VzIGluIGNvbW1v bi9mYXN0Ym9vdC5jIGFyZSBkdWUgdG8gdGhlIHJlbmFtaW5nIG9mIHN0cnVjdApmX2Zhc3Rib290 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gKmNtZHMsIGludCBudW1fY29tbWFu ZHMpCit7CisJY29uc3Qgc3RydWN0IGNtZF9kaXNwYXRjaF9pbmZvICpjbWQ7CisJaW50IGk7CisK Kwljb25zb2xlX2NvdW50ZG93bl9hYm9ydCgpOworCisJZm9yIChpID0gMDsgaSA8IG51bV9jb21t YW5kczsgaSsrKSB7CisJCWNtZCA9ICZjbWRzW2ldOworCisJCWlmICghc3RyY21wX2wxKGNtZC0+ Y21kLCBjbWRidWYpKSB7CisJCQljbWQtPmNiKGZiLCBjbWRidWYgKyBzdHJsZW4oY21kLT5jbWQp KTsKKworCQkJcmV0dXJuOworCQl9CisJfQorCisJZmFzdGJvb3RfdHhfcHJpbnQoZmIsIEZBU1RC T09UX01TR19GQUlMLCAidW5rbm93biBjb21tYW5kICVzIiwKKwkJCSAgY21kYnVmKTsKK30KKwor c3RhdGljIHZvaWQgY2Jfb2VtX2dldGVudihzdHJ1Y3QgZmFzdGJvb3QgKmZiLCBjb25zdCBjaGFy ICpjbWQpCit7CisJY29uc3QgY2hhciAqdmFsdWU7CisKKwlwcl9kZWJ1ZygiJXM6IFwiJXNcIlxu IiwgX19mdW5jX18sIGNtZCk7CisKKwl2YWx1ZSA9IGdldGVudihjbWQpOworCisJZmFzdGJvb3Rf dHhfcHJpbnQoZmIsIEZBU1RCT09UX01TR19JTkZPLCB2YWx1ZSA/IHZhbHVlIDogIiIpOworCWZh c3Rib290X3R4X3ByaW50KGZiLCBGQVNUQk9PVF9NU0dfT0tBWSwgIiIpOworfQorCitzdGF0aWMg dm9pZCBjYl9vZW1fc2V0ZW52KHN0cnVjdCBmYXN0Ym9vdCAqZmIsIGNvbnN0IGNoYXIgKmNtZCkK K3sKKwljaGFyICp2YXIgPSB4c3RyZHVwKGNtZCk7CisJY2hhciAqdmFsdWU7CisJaW50IHJldDsK KworCXByX2RlYnVnKCIlczogXCIlc1wiXG4iLCBfX2Z1bmNfXywgY21kKTsKKworCXZhbHVlID0g c3RyY2hyKHZhciwgJz0n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