From patchwork Fri Sep 28 01:18:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 187684 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D9FC82C00AC for ; Fri, 28 Sep 2012 11:19:44 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7E403280F8; Fri, 28 Sep 2012 03:19:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PMDd-KUVwgda; Fri, 28 Sep 2012 03:19:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 29536280A2; Fri, 28 Sep 2012 03:19:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 824EC280D9 for ; Fri, 28 Sep 2012 03:19:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cDTMcv9LXbNy for ; Fri, 28 Sep 2012 03:19:35 +0200 (CEST) X-Greylist: delayed 1710 seconds by postgrey-1.27 at theia; Fri, 28 Sep 2012 03:19:33 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ey0-f202.google.com (mail-ey0-f202.google.com [209.85.215.202]) by theia.denx.de (Postfix) with ESMTPS id 77498280A2 for ; Fri, 28 Sep 2012 03:19:33 +0200 (CEST) Received: by eaaq10 with SMTP id q10so123824eaa.3 for ; Thu, 27 Sep 2012 18:19:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=BOmUtMJwN1NFSG3ja1+PFupGxB4IsJxm6Nu1BqsmC0c=; b=mvPT/hnfgjfkOuFrCJUZBBiuFDJHcNzgj7Zyw8Rs1b5Blqmn1OH0kXEezeEiwJHKhx cVcCp0uRZUn22vHOy7lHzQ+977kNb47KFcVtrLYUqfUcCT6f4L8FPhCV7TL+XX8oOask UQr8nw75K8AClXGyTKwR+mLW8DkZBve2rCQ3G16MwkTXbeOouYKXi723SJPd3Gy7DD/U lUGPJWSBDpl/a9f5bceye2wP6/jcJPr7gEVAwnHrTj4JhX1Ep2E6t3F8fTJFwrYU1Qfw XLMz4Ot2zA538eQgDlKVnrZ9ze6+klnW2azQMvfpu+nt2N3Ty3qVCG3+Ofw3CjDJDzyz ywEg== Received: by 10.180.91.231 with SMTP id ch7mr25904wib.1.1348795172899; Thu, 27 Sep 2012 18:19:32 -0700 (PDT) Received: by 10.180.91.231 with SMTP id ch7mr25900wib.1.1348795172833; Thu, 27 Sep 2012 18:19:32 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id cq5si965657wib.1.2012.09.27.18.19.32 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 27 Sep 2012 18:19:32 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 6E33F5C0050; Thu, 27 Sep 2012 18:19:32 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id C0E8116090F; Thu, 27 Sep 2012 18:19:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Thu, 27 Sep 2012 18:18:40 -0700 Message-Id: <1348795123-24385-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1348795123-24385-1-git-send-email-sjg@chromium.org> References: <1348795123-24385-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQlZC7HT1uaag2eHhY5tszPtyIWXlAj7oej0/OIVYA3Cw99yDVdqve5qQ3pxr+IiCYSSbFckwyEU+eXErVMsfAYJ1y2LHX6Aw1xdno98JPEQzAfvXOYL67z522O5Up10gOwEkr6EN6i+roi07WnYTe++D4b4Z5StytBmH25c6HtHsqlBRJ52KFvM5IczL/g2sz/C8b8I Cc: Tom Warren Subject: [U-Boot] [PATCH 1/4] input: Correct key_matrix fdt decoding X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Some issues with this were not addressed in the previous series. Fix up the binding decoding to deal with what is actually expected in the fdt. This corrects the broken keyboard on seaboard. Signed-off-by: Simon Glass --- drivers/input/key_matrix.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c index 715e57a..c08caa6 100644 --- a/drivers/input/key_matrix.c +++ b/drivers/input/key_matrix.c @@ -153,6 +153,8 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, int node) { const struct fdt_property *prop; + const char prefix[] = "linux,"; + int plen = sizeof(prefix) - 1; int offset; /* Check each property name for ones that we understand */ @@ -168,16 +170,17 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, /* Name needs to match "1,keymap" */ debug("%s: property '%s'\n", __func__, name); - if (strncmp(name, "1,", 2) || len < 8 || - strcmp(name + len - 6, "keymap")) + if (strncmp(name, prefix, plen) || + len < plen + 6 || + strcmp(name + len - 6, "keymap")) continue; - len -= 8; + len -= plen + 6; if (len == 0) { config->plain_keycode = create_keymap(config, (u32 *)prop->data, fdt32_to_cpu(prop->len), KEY_FN, &config->fn_pos); - } else if (0 == strncmp(name + 2, "fn-", len)) { + } else if (0 == strncmp(name + plen, "fn-", len)) { config->fn_keycode = create_keymap(config, (u32 *)prop->data, fdt32_to_cpu(prop->len), -1, NULL);