From patchwork Fri Apr 5 14:22:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2399271 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 014E9DF2E5 for ; Fri, 5 Apr 2013 16:48:40 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UO7bx-0002Ey-2m; Fri, 05 Apr 2013 14:27:27 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UO7a7-0000uP-2s; Fri, 05 Apr 2013 14:25:31 +0000 Received: from eu1sys200aog111.obsmtp.com ([207.126.144.131]) by merlin.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UO7YI-0000kM-8p for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2013 14:24:00 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob111.postini.com ([207.126.147.11]) with SMTP ID DSNKUV7eZVQ8eRvL0mkwfO3d5DYvU8KzJ9oH@postini.com; Fri, 05 Apr 2013 14:23:38 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6189375; Fri, 5 Apr 2013 14:23:11 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2DFE54F61; Fri, 5 Apr 2013 14:23:11 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 0EAF3A8083; Fri, 5 Apr 2013 16:23:05 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.279.5; Fri, 5 Apr 2013 16:23:10 +0200 From: Linus Walleij To: , Arnd Bergmann Subject: [PATCH 04/14] staging: ste_rmi4: kill platform_data hack Date: Fri, 5 Apr 2013 16:22:46 +0200 Message-ID: <1365171776-8463-5-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1365171776-8463-1-git-send-email-linus.walleij@stericsson.com> References: <1365171776-8463-1-git-send-email-linus.walleij@stericsson.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130405_102338_783093_B17769FA X-CRM114-Status: GOOD ( 25.14 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.131 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linus Walleij X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Arnd Bergmann There is only one instance of the platform data for synaptics_i2c_rmi4 in the mainline kernel, so there is no point of pretending its variable here. The only member that has a dependency on the platform is actually the interrupt number, and there is a field in the i2c_client structure that gets initialized from the board info, so we can trivially move the board_into into the platform without knowledge of the platform_data structure. Signed-off-by: Arnd Bergmann Acked-by: Greg Kroah-Hartman Signed-off-by: Linus Walleij --- arch/arm/mach-ux500/board-mop500-u8500uib.c | 7 +++-- drivers/staging/ste_rmi4/Makefile | 1 - .../staging/ste_rmi4/board-mop500-u8500uib-rmi4.c | 31 ---------------------- drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 31 +++++++++++++--------- drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h | 1 - 5 files changed, 23 insertions(+), 48 deletions(-) delete mode 100644 drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c diff --git a/arch/arm/mach-ux500/board-mop500-u8500uib.c b/arch/arm/mach-ux500/board-mop500-u8500uib.c index ead91c9..0b5e14a 100644 --- a/arch/arm/mach-ux500/board-mop500-u8500uib.c +++ b/arch/arm/mach-ux500/board-mop500-u8500uib.c @@ -16,8 +16,11 @@ #include "board-mop500.h" -/* Dummy data that can be overridden by staging driver */ -struct i2c_board_info __initdata __weak mop500_i2c3_devices_u8500[] = { +static struct i2c_board_info __initdata mop500_i2c3_devices_u8500[] = { + { + I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B), + .irq = NOMADIK_GPIO_TO_IRQ(84), + }, }; /* diff --git a/drivers/staging/ste_rmi4/Makefile b/drivers/staging/ste_rmi4/Makefile index e4c0335..6cce2ed 100644 --- a/drivers/staging/ste_rmi4/Makefile +++ b/drivers/staging/ste_rmi4/Makefile @@ -2,4 +2,3 @@ # Makefile for the RMI4 touchscreen driver. # obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += synaptics_i2c_rmi4.o -obj-$(CONFIG_MACH_MOP500) += board-mop500-u8500uib-rmi4.o diff --git a/drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c b/drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c deleted file mode 100644 index 47439c3..0000000 --- a/drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Some platform data for the RMI4 touchscreen that will override the __weak - * platform data in the Ux500 machine if this driver is activated. - */ -#include -#include -#include -#include -#include "synaptics_i2c_rmi4.h" - -/* - * Synaptics RMI4 touchscreen interface on the U8500 UIB - */ - -/* - * Descriptor structure. - * Describes the number of i2c devices on the bus that speak RMI. - */ -static struct synaptics_rmi4_platform_data rmi4_i2c_dev_platformdata = { - .irq_number = NOMADIK_GPIO_TO_IRQ(84), - .irq_type = (IRQF_TRIGGER_FALLING | IRQF_SHARED), - .x_flip = false, - .y_flip = true, -}; - -struct i2c_board_info __initdata mop500_i2c3_devices_u8500[] = { - { - I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B), - .platform_data = &rmi4_i2c_dev_platformdata, - }, -}; diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index 6a21f67..2e35307 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c @@ -864,6 +864,16 @@ static int synaptics_rmi4_i2c_query_device(struct synaptics_rmi4_data *pdata) return 0; } +/* + * Descriptor structure. + * Describes the number of i2c devices on the bus that speak RMI. + */ +static struct synaptics_rmi4_platform_data synaptics_rmi4_platformdata = { + .irq_type = (IRQF_TRIGGER_FALLING | IRQF_SHARED), + .x_flip = false, + .y_flip = true, +}; + /** * synaptics_rmi4_probe() - Initialze the i2c-client touchscreen driver * @i2c: i2c client structure pointer @@ -890,10 +900,8 @@ static int synaptics_rmi4_probe return -EIO; } - if (!platformdata) { - dev_err(&client->dev, "%s: no platform data\n", __func__); - return -EINVAL; - } + if (!platformdata) + platformdata = &synaptics_rmi4_platformdata; /* Allocate and initialize the instance data for this client */ rmi4_data = kcalloc(2, sizeof(struct synaptics_rmi4_data), @@ -977,13 +985,13 @@ static int synaptics_rmi4_probe synaptics_rmi4_i2c_block_read(rmi4_data, rmi4_data->fn01_data_base_addr + 1, intr_status, rmi4_data->number_of_interrupt_register); - retval = request_threaded_irq(platformdata->irq_number, NULL, + retval = request_threaded_irq(client->irq, NULL, synaptics_rmi4_irq, platformdata->irq_type, DRIVER_NAME, rmi4_data); if (retval) { dev_err(&client->dev, "%s:Unable to get attn irq %d\n", - __func__, platformdata->irq_number); + __func__, client->irq); goto err_query_dev; } @@ -996,7 +1004,7 @@ static int synaptics_rmi4_probe return retval; err_free_irq: - free_irq(platformdata->irq_number, rmi4_data); + free_irq(client->irq, rmi4_data); err_query_dev: regulator_disable(rmi4_data->regulator); err_regulator_enable: @@ -1019,11 +1027,10 @@ err_input: static int synaptics_rmi4_remove(struct i2c_client *client) { struct synaptics_rmi4_data *rmi4_data = i2c_get_clientdata(client); - const struct synaptics_rmi4_platform_data *pdata = rmi4_data->board; rmi4_data->touch_stopped = true; wake_up(&rmi4_data->wait); - free_irq(pdata->irq_number, rmi4_data); + free_irq(client->irq, rmi4_data); input_unregister_device(rmi4_data->input_dev); regulator_disable(rmi4_data->regulator); regulator_put(rmi4_data->regulator); @@ -1046,10 +1053,9 @@ static int synaptics_rmi4_suspend(struct device *dev) int retval; unsigned char intr_status; struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); - const struct synaptics_rmi4_platform_data *pdata = rmi4_data->board; rmi4_data->touch_stopped = true; - disable_irq(pdata->irq_number); + disable_irq(rmi4_data->i2c_client->irq); retval = synaptics_rmi4_i2c_block_read(rmi4_data, rmi4_data->fn01_data_base_addr + 1, @@ -1080,11 +1086,10 @@ static int synaptics_rmi4_resume(struct device *dev) int retval; unsigned char intr_status; struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); - const struct synaptics_rmi4_platform_data *pdata = rmi4_data->board; regulator_enable(rmi4_data->regulator); - enable_irq(pdata->irq_number); + enable_irq(rmi4_data->i2c_client->irq); rmi4_data->touch_stopped = false; retval = synaptics_rmi4_i2c_block_read(rmi4_data, diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h index 384436e..8c9166b 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h @@ -38,7 +38,6 @@ * This structure gives platform data for rmi4. */ struct synaptics_rmi4_platform_data { - int irq_number; int irq_type; bool x_flip; bool y_flip;