From patchwork Wed May 25 12:22:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 68587 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1180246qge; Wed, 25 May 2016 05:22:25 -0700 (PDT) X-Received: by 10.98.66.149 with SMTP id h21mr5339563pfd.56.1464178945111; Wed, 25 May 2016 05:22:25 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si11537029pfb.12.2016.05.25.05.22.24; Wed, 25 May 2016 05:22:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754731AbcEYMWL (ORCPT + 30 others); Wed, 25 May 2016 08:22:11 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:36819 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752094AbcEYMWH (ORCPT ); Wed, 25 May 2016 08:22:07 -0400 Received: by mail-lb0-f182.google.com with SMTP id h1so14762649lbj.3 for ; Wed, 25 May 2016 05:22:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=owFz8FIDWR1KTefgdd+kD8GEaRbKrnw2LW6wij89IWk=; b=UgAYgZ9jitC6hHr9sDcfawFJtBT+nzt4efnUuzngR2XHKRdh4dq7T5bZczL2v2xg23 Ah7ZpXTDufyMLWkS9uw7ffgmn1WLvT5GNKCiASC1eZLIjQgtBFl2p1Fu/gDil1KZ1RjW 87gQteVgQnPzsnrOzGYhRgz6FNwlhEIFEwoDc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=owFz8FIDWR1KTefgdd+kD8GEaRbKrnw2LW6wij89IWk=; b=UpsAV3LKIG4FyJcIk9kHcUc2hmYDRN/s7KAMr1DuFlsKnFbgyST1+j/pg83Fq5kl5x L9cm1RXJOiUcGz0ZBRcKxKE5Xzuif4kmCgROAKrJR5Fxf2dp4EGQks7sTvCYhP6T3ju8 MDfRDoQkChgDj+JbbyjIlJKuEJyFKOtjSFkQRjgiue/3aiIFa/GkGQVikd7kf7/nYpjF erAmCZuMo60lVuvJelj8TzpXpHFM5HuJovL436Evojb+K4IouvFttUuQRAqmd01Z93Ac qzVgBahuu/mlCM1KvIaca5YY417DI9M4wZ3+BbLcFLtaKt72pcc6p4lhZfq7RSzp/C+X Y4Zg== X-Gm-Message-State: ALyK8tLbze8hF15S2M89dRmBI2y0NkIj8x3Alx1xYzfDkFEt/l949jaawcdt46o0XrcK3Kvy X-Received: by 10.112.170.38 with SMTP id aj6mr1094153lbc.29.1464178925503; Wed, 25 May 2016 05:22:05 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id r5sm1436729lbb.14.2016.05.25.05.22.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 05:22:04 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij , Patrice Chotard Subject: [PATCH v2] mfd: stmpe: move platform data into mfd driver Date: Wed, 25 May 2016 14:22:02 +0200 Message-Id: <1464178922-29927-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Cc: Patrice Chotard Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Drop check for (!np) NULL device node: as Lee notices, this can no longer happen on a pure DT driver. --- drivers/mfd/stmpe.c | 40 ++++++++++++++++++++++++++++------------ include/linux/mfd/stmpe.h | 22 +--------------------- 2 files changed, 29 insertions(+), 33 deletions(-) -- 2.4.11 diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index fb8f9e8b75df..94c7cc02fdab 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); @@ -1187,24 +1208,19 @@ 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; - - 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 cb83883918a7..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,25 +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