From patchwork Thu Nov 29 23:22:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dromede@gmail.com X-Patchwork-Id: 1823261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id DF7AADF23A for ; Thu, 29 Nov 2012 23:27:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TeDT5-0002bE-Fy; Thu, 29 Nov 2012 23:24:31 +0000 Received: from mail-ea0-f177.google.com ([209.85.215.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TeDT2-0002au-C8 for linux-arm-kernel@lists.infradead.org; Thu, 29 Nov 2012 23:24:29 +0000 Received: by mail-ea0-f177.google.com with SMTP id c10so4120945eaa.36 for ; Thu, 29 Nov 2012 15:24:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=mSMDQnsK1Il74dQ0JMybDGL13UcBhH88Lmv5uobC7zU=; b=pIcPsbkHG9U8bZrrZRZTxNpaEjUOLz0I6Mtx3ALmf6+w9HEatFctHCnVffQ8kBl2sU 8KwFhxrv/gCXOECnBMnyEEb16Kx/Pqbmon4V+QrlVPFdisgYZwQJbxsJuQkYoCI3EcNI /Z/HrFMBYpGjvxrbna4uyaD+/xdCrHYlodIomAqg/W8Pa0eu/3Lsce3sVzy9lSii0IKW 7L3vPhrplKGLjOmX76Vo3zD288qnsSD1OHnujzOdo3AtYTZ9IRScASWWoLpCFtmo527o 7hlzL8wpT4K1ToiBEslUkG0fcdPCFXTkMc3Nexq4CiHuMEaNcuzDDg8YCeVyqaWepPmn Gpdw== Received: by 10.14.203.2 with SMTP id e2mr87210301eeo.20.1354231464946; Thu, 29 Nov 2012 15:24:24 -0800 (PST) Received: from localhost.localdomain (93-136-127-248.adsl.net.t-com.hr. [93.136.127.248]) by mx.google.com with ESMTPS id q44sm6769621eep.5.2012.11.29.15.24.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 29 Nov 2012 15:24:24 -0800 (PST) From: dromede@gmail.com To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] [ARM] pxa/spitz: Minor code refactor and typo fixes Date: Fri, 30 Nov 2012 00:22:59 +0100 Message-Id: <1354231379-17289-1-git-send-email-dromede@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121129_182428_753649_87925976 X-CRM114-Status: GOOD ( 15.48 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dromede[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Marko Katic , eric.y.miao@gmail.com, haojian.zhuang@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Marko Katic This patch slightly changes the way i2c devices are defined and registered. I2c devices that are present in all spitz variants are always defined while the max7310 gpio expander specific to the akita variant is defined conditionally. This makes more sense and will result in a slightly smaller kernel for some variants. I2c init function spitz_i2c_init() is simplified and is now more readable. Some code sections were renamed to better describe their contents. Signed-off-by: Marko Katic --- arch/arm/mach-pxa/spitz.c | 46 ++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 2073f0e..0f92264 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -732,7 +732,7 @@ static inline void spitz_lcd_init(void) {} #endif /****************************************************************************** - * Framebuffer + * NAND Flash ******************************************************************************/ #if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE) static struct mtd_partition spitz_nand_partitions[] = { @@ -858,23 +858,13 @@ static inline void spitz_nor_init(void) {} #endif /****************************************************************************** - * GPIO expander + * I2C devices ******************************************************************************/ #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE) static struct pca953x_platform_data akita_pca953x_pdata = { .gpio_base = AKITA_IOEXP_GPIO_BASE, }; -static struct i2c_board_info spitz_i2c_devs[] = { - { - .type = "wm8750", - .addr = 0x1b, - }, { - .type = "max7310", - .addr = 0x18, - .platform_data = &akita_pca953x_pdata, - }, -}; static struct regulator_consumer_supply isl6271a_consumers[] = { REGULATOR_SUPPLY("vcc_core", NULL), @@ -894,7 +884,12 @@ static struct regulator_init_data isl6271a_info[] = { } }; -static struct i2c_board_info spitz_pi2c_devs[] = { +/* wm8750 and isl6271a are present in all spitz variants */ +static struct i2c_board_info spitz_i2c_devs[2] = { + { + .type = "wm8750", + .addr = 0x1b, + }, { .type = "isl6271a", .addr = 0x0c, @@ -902,18 +897,27 @@ static struct i2c_board_info spitz_pi2c_devs[] = { }, }; +#ifdef CONFIG_MACH_AKITA +static struct i2c_board_info akita_i2c_devs[1] = { + { + .type = "max7310", + .addr = 0x18, + .platform_data = &akita_pca953x_pdata, + }, +}; +#endif + static void __init spitz_i2c_init(void) { - int size = ARRAY_SIZE(spitz_i2c_devs); - - /* Only Akita has the max7310 chip */ - if (!machine_is_akita()) - size--; - pxa_set_i2c_info(NULL); pxa27x_set_i2c_power_info(NULL); - i2c_register_board_info(0, spitz_i2c_devs, size); - i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs)); + + i2c_register_board_info(0, &spitz_i2c_devs[0], 1); + i2c_register_board_info(1, &spitz_i2c_devs[1], 1); + + if (machine_is_akita()) + i2c_register_board_info(0, akita_i2c_devs, 1); + } #else static inline void spitz_i2c_init(void) {}