From patchwork Tue Aug 21 10:42:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Klauser X-Patchwork-Id: 1353991 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E6F22DFB34 for ; Tue, 21 Aug 2012 10:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756327Ab2HUKuO (ORCPT ); Tue, 21 Aug 2012 06:50:14 -0400 Received: from mx1.zhaw.ch ([160.85.104.50]:44577 "EHLO mx1.zhaw.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756716Ab2HUKuJ (ORCPT ); Tue, 21 Aug 2012 06:50:09 -0400 Received: from mx1.zhaw.ch (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 763E7AE8; Tue, 21 Aug 2012 12:42:13 +0200 (CEST) Received: from fermion.zhaw.ch (inst-232.20.zhaw.ch [160.85.232.20]) by mx1.zhaw.ch (Postfix) with ESMTP id 30480ADE; Tue, 21 Aug 2012 12:42:13 +0200 (CEST) From: Tobias Klauser To: Dmitry Torokhov Cc: linux-input@vger.kernel.org Subject: [PATCH 2/2] input: samsung-keypad: Use of_get_child_count() helper Date: Tue, 21 Aug 2012 12:42:13 +0200 Message-Id: <1345545733-27503-1-git-send-email-tklauser@distanz.ch> X-Mailer: git-send-email 1.7.5.4 X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.8.21.103016 X-PerlMx-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1100_1199 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS ' Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Use of_get_child_count() instead of custom implementation. Signed-off-by: Tobias Klauser --- drivers/input/keyboard/samsung-keypad.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index e2f31c8..277e26d 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -256,7 +256,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt( struct matrix_keymap_data *keymap_data; uint32_t *keymap, num_rows = 0, num_cols = 0; struct device_node *np = dev->of_node, *key_np; - unsigned int key_count = 0; + unsigned int key_count; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) { @@ -280,9 +280,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt( } pdata->keymap_data = keymap_data; - for_each_child_of_node(np, key_np) - key_count++; - + key_count = of_get_child_count(np); keymap_data->keymap_size = key_count; keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL); if (!keymap) {