Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15320607ybl; Tue, 31 Dec 2019 05:43:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxm5UsictKKvltGYo6F7mld0BrGfmIyXPGa33pcOA/+ev/xBBhYx3AhI9D/95G6FlTRghiZ X-Received: by 2002:a9d:5786:: with SMTP id q6mr60833051oth.164.1577799782994; Tue, 31 Dec 2019 05:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577799782; cv=none; d=google.com; s=arc-20160816; b=U7emUKlEjIFoARHckHWUfwRzOBKgnJOxY62hnRcBP6YdcYvWYN/aKgetY86JQYmeGJ 2pQEu5FUwFF4NxNMYuWwgjY7HQBGEBba+pEsB+A+g+1NwE336e7kakJH+0KE4S5E2Mi3 Z4Dc5cNank4waEnClwCwu6Rt8nZTW4kHRW59DMqAIy6r9NOkAOqDeHgYy2KQiNWaJAAG 7X0XFs+JC2iWwgQMhYeBsxDCnDfQKiN2dwGa5+0MGqbi2e6hXEuayphqr+YOT1uhfZuW dfmdsFandW71e8pKYwaQaFF4P/yWSzFgTVzsDPqSxaWfLUernjoGieR05E2REbWx2QrS fLmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=x++Akfe5JkRpAPh9IOfWBiqdOpZR4O4wmNvzoxS/MP0=; b=nVyBTLRB9JrFOCo4mfEQN2mlUrUCT8mADDRJQ0B3NutoiG0+9IlzkqsFZYCCdF8LyQ gTlnNcGr01Qg80i7ulCuSPBvrEO2ZzqxCi67K9MvHQm2KaY7vBoSq3rwRvhycUnJvwbo R9lOUT5LIz0o+uhWEC5aCemZiaoxj302HdMgIo8RLZUQee4TK7CHs7ZKoaH6PZy8Gl6A 1fpHM+geExkcw8pDZgqcZhkhojxr9CEsKzW/cUf/TZpAyFKPc70iKvTSOuCerWfkqd4A 4j4nURATzySQqkAKxgoKO1tu/Kq5zOPa2cvzaDhxN4QjZ/ymp5GtzCGn2Z5bS1/t6mlp aVwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=A82eM1Cn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si24132075oto.305.2019.12.31.05.42.50; Tue, 31 Dec 2019 05:43:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=A82eM1Cn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbfLaNmE (ORCPT + 99 others); Tue, 31 Dec 2019 08:42:04 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:3222 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726060AbfLaNmE (ORCPT ); Tue, 31 Dec 2019 08:42:04 -0500 X-UUID: 899694e97fd14460a93cd45b9705dc64-20191231 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=x++Akfe5JkRpAPh9IOfWBiqdOpZR4O4wmNvzoxS/MP0=; b=A82eM1CnU2B9PRysa/XMc7FtaaNwH6ir6Q3V8+/2AWvzYzz7zZ39eDhT7TvJBpUBQT2lhcWM86mL/VsflugwL3BDKf4Wkb6EZgRIXFefjmuikZCSW5CGHltISb3OCPwTNDL6VK1yEdEdWxIy0c7kIjweQQc78MfsY3A94pd2PVo=; X-UUID: 899694e97fd14460a93cd45b9705dc64-20191231 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 401010651; Tue, 31 Dec 2019 21:41:56 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 31 Dec 2019 21:41:04 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 31 Dec 2019 21:41:16 +0800 From: Light Hsieh To: CC: , , , , , Light Hsieh Subject: [PATCH v7 1/6] Check gpio pin number and use binary search in mtk_hw_pin_field_lookup() Date: Tue, 31 Dec 2019 21:41:42 +0800 Message-ID: <1577799707-11855-1-git-send-email-light.hsieh@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 5207F01DB3CE30980E9CA3D8E90B387874F153407A88F81A4AAE3662A242D8AA2000:8 X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MS4gQ2hlY2sgaWYgZ3BpbyBwaW4gbnVtYmVyIGlzIGluIHZhbGlkIHJhbmdlIHRvIHByZXZlbnQg ZnJvbSBnZXQgaW52YWxpZA0KICAgcG9pbnRlciAnZGVzYycgaW4gdGhlIGZvbGxvd2luZyBjb2Rl Og0KCWRlc2MgPSAoY29uc3Qgc3RydWN0IG10a19waW5fZGVzYyAqKSZody0+c29jLT5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