From patchwork Mon Mar 23 15:29:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 46202 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 00A0120D10 for ; Mon, 23 Mar 2015 15:29:35 +0000 (UTC) Received: by lamq1 with SMTP id q1sf27906434lam.3 for ; Mon, 23 Mar 2015 08:29:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=gsxEOfHGoa/DHLzo3kYtGvO1AYlrrS0ZBcF9kPIbMl0=; b=Me2ERdIkr4B8KALivUWgpNOz1UIqZoyyMnitT09NxDCKpqPmU0kTwcYGiUEHTiNySj KZxDHnWUIo+y/DF/lJg3WIKH7NMGB+zZ3ZzoDIhczEi2f0eaVw/VPFkwJXkj3UB0zfoh 0PhVwA3FzCm25cUP5BY0sTUl+I6sDgXTgthsnsUG3KSpKNWha+BNTeW2/GgnXbTdmspA VlX0Qxm77fv56gwYgnGzhVsZcZwPej/xRb4RvCUFUUnlbKf6tFazfgzPOkP+fjD7txf/ 8leE372Mthh5OxqA29RLNd2xm0icVy0JJ6CVEfDFL9dL7/D/O1k4qlbebuQ1itKsQ7GW yuIQ== X-Gm-Message-State: ALoCoQlER542ji4yNNY412hXER7QG8xliTZM315A7XaIEBe4thXNNsXGR1SV5E0AvxBoKPQzq1jL X-Received: by 10.152.45.7 with SMTP id i7mr15654197lam.9.1427124573943; Mon, 23 Mar 2015 08:29:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.246.38 with SMTP id xt6ls644253lac.102.gmail; Mon, 23 Mar 2015 08:29:33 -0700 (PDT) X-Received: by 10.112.73.104 with SMTP id k8mr82207736lbv.120.1427124573769; Mon, 23 Mar 2015 08:29:33 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id pw4si858071lbb.87.2015.03.23.08.29.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Mar 2015 08:29:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbbsy1 with SMTP id sy1so121074802lbb.1 for ; Mon, 23 Mar 2015 08:29:33 -0700 (PDT) X-Received: by 10.152.121.33 with SMTP id lh1mr84601842lab.86.1427124573676; Mon, 23 Mar 2015 08:29:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp897672lbq; Mon, 23 Mar 2015 08:29:32 -0700 (PDT) X-Received: by 10.68.132.194 with SMTP id ow2mr21981508pbb.51.1427124570165; Mon, 23 Mar 2015 08:29:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pw8si1630177pbc.60.2015.03.23.08.29.28; Mon, 23 Mar 2015 08:29:30 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbbCWP3X (ORCPT + 27 others); Mon, 23 Mar 2015 11:29:23 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:35115 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752519AbbCWP3V (ORCPT ); Mon, 23 Mar 2015 11:29:21 -0400 Received: by laae1 with SMTP id e1so4942623laa.2 for ; Mon, 23 Mar 2015 08:29:19 -0700 (PDT) X-Received: by 10.112.63.165 with SMTP id h5mr83001756lbs.16.1427124559537; Mon, 23 Mar 2015 08:29:19 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id y8sm251886lag.10.2015.03.23.08.29.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Mar 2015 08:29:18 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , Dmitry Torokhov , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Cc: Linus Walleij Subject: [PATCH 2/2] mfd: stmpe: move platform data into mfd driver Date: Mon, 23 Mar 2015 16:29:13 +0100 Message-Id: <1427124553-27551-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The STMPE platform data is only populated from the device tree in all existing users, so push the struct and make the OF case the norm. Signed-off-by: Linus Walleij --- drivers/mfd/stmpe.c | 41 ++++++++++++++++++++++++++++++----------- include/linux/mfd/stmpe.h | 23 +---------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 2d7fae94c861..cb5f19749442 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -23,6 +23,27 @@ #include #include "stmpe.h" +/** + * struct stmpe_platform_data - STMPE platform data + * @id: device id to distinguish between multiple STMPEs on the same board + * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*) + * @irq_trigger: IRQ trigger to use for the interrupt to the host + * @autosleep: bool to enable/disable stmpe autosleep + * @autosleep_timeout: inactivity timeout in milliseconds for autosleep + * @irq_over_gpio: true if gpio is used to get irq + * @irq_gpio: gpio number over which irq will be requested (significant only if + * irq_over_gpio is true) + */ +struct stmpe_platform_data { + int id; + unsigned int blocks; + unsigned int irq_trigger; + bool autosleep; + bool irq_over_gpio; + int irq_gpio; + int autosleep_timeout; +}; + static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks) { return stmpe->variant->enable(stmpe, blocks, true); @@ -1158,24 +1179,22 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, /* Called from client specific probe routines */ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum) { - struct stmpe_platform_data *pdata = dev_get_platdata(ci->dev); + struct stmpe_platform_data *pdata; struct device_node *np = ci->dev->of_node; struct stmpe *stmpe; int ret; - if (!pdata) { - if (!np) - return -EINVAL; + if (!np) + return -EINVAL; - pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return -ENOMEM; + pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; - stmpe_of_probe(pdata, np); + stmpe_of_probe(pdata, np); - if (of_find_property(np, "interrupts", NULL) == NULL) - ci->irq = -1; - } + if (of_find_property(np, "interrupts", NULL) == NULL) + ci->irq = -1; stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL); if (!stmpe) diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index 93e62ae32906..de748bc7525e 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h @@ -62,6 +62,7 @@ enum { struct stmpe_variant_info; struct stmpe_client_info; +struct stmpe_platform_data; /** * struct stmpe - STMPE MFD structure @@ -117,26 +118,4 @@ extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks); #define STMPE_GPIO_NOREQ_811_TOUCH (0xf0) - -/** - * struct stmpe_platform_data - STMPE platform data - * @id: device id to distinguish between multiple STMPEs on the same board - * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*) - * @irq_trigger: IRQ trigger to use for the interrupt to the host - * @autosleep: bool to enable/disable stmpe autosleep - * @autosleep_timeout: inactivity timeout in milliseconds for autosleep - * @irq_over_gpio: true if gpio is used to get irq - * @irq_gpio: gpio number over which irq will be requested (significant only if - * irq_over_gpio is true) - */ -struct stmpe_platform_data { - int id; - unsigned int blocks; - unsigned int irq_trigger; - bool autosleep; - bool irq_over_gpio; - int irq_gpio; - int autosleep_timeout; -}; - #endif