Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp151410imm; Thu, 21 Jun 2018 15:43:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKItNpzdbkhpz4mmHl9FokNgDxhQ//WTVNeAQnopd0cCvUymuy1AJ2fdMTKN5NX6wOXqZdb1 X-Received: by 2002:a17:902:563:: with SMTP id 90-v6mr30305421plf.327.1529621014570; Thu, 21 Jun 2018 15:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529621014; cv=none; d=google.com; s=arc-20160816; b=Izo/qC0Rt+I+5aFqsV83xzWM5Rtfm8X0eVrKJA65OqgI8d8iaFoTFhCrZfqJv21Uuj ek03m7SeHSXUo3/ux7Jdc5edEWHFWuJuHiwLPu0qc2sbAi/WGQ8eDXRWHewAHPGkVgj6 jPmyR8c+S8tSG7A/+/ZCN+9mWRgaiZes7umNCGzvT84vMFDTFdBoCD4AJ4pJ/yQdWz1k lAXLfjwFLOb/ZmkRCSJibTbTN13oGH8d0tiW+8rBQa5i72tydt2codoKfL7ytkQp17rt k71M0di7utC5xKJwrNNdRuwqTTNvZeNR4K1HHUaLwS1GfkCgyBTkG2kanFJcvQFBy5KE y10Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=IkWEj4MJxmai4vzpckcnzaQtnDAXgiUEdfdEKzLaXHw=; b=Pd9oCv13QH8iXTG8JAfvcfZqsTSP2M0KMAHHyPeLTwWC/oFX5cWU8aM1V/o6IHVDU+ 3iKdUknJ1APKAt/IdyuOh2Vt7PehXHNiYPxf8SJkxVH9gLiLipjMlX55pz2fWD31XCJe 85UJmY2XzgobCXEZUPkxNDS3h0v7zo1gkSqv41fzO/616/K9b9FAdTab8QXSovCzqC2h 06Uj1EFfs3qiPLVvqJmgZybjsKYvAf02Vc0bywP0/gzBZUg0+Ew+4U0FjP32xmWvvD3m CLcqs9D5UdB1Uh40VUtGYTriMpkNeM8iE7uO7/JDsWIQva4Ilx3SQRYUlZ9mvNqbpuAE 4nYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nvTE71xc; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si6009443plh.340.2018.06.21.15.43.20; Thu, 21 Jun 2018 15:43:34 -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=@gmail.com header.s=20161025 header.b=nvTE71xc; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933973AbeFUWmR (ORCPT + 99 others); Thu, 21 Jun 2018 18:42:17 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:40940 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933653AbeFUWmP (ORCPT ); Thu, 21 Jun 2018 18:42:15 -0400 Received: by mail-lf0-f66.google.com with SMTP id q11-v6so6615317lfc.7; Thu, 21 Jun 2018 15:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IkWEj4MJxmai4vzpckcnzaQtnDAXgiUEdfdEKzLaXHw=; b=nvTE71xcUSgZPqP7M+tYjjtVkemrE7M/AazT9wt5E6tM0cp4H1EBWTjTdnG6jOwVZn /LwpkBx4zkBpBSIEl7EVQNZulyewyIHl6A2iFV/lA8IsrcdTXLO2jznutx2DOdzXpBAZ cdLGDBCdGv0sGeN0fpWesHL2Q6tf9tyVYHYN+h7JA7sYHIKVSmR9SugpGQLjOhv2rAvA YHotBmByEoSbhg6nWmvIbKD60rWL6rNE8qOQ9luQa1iyKUFRfkSXDf2YpagRkbLP8mvm r0ZSImNPS+GLFnRSKZFxXbXtkNIbw9Ux7tHezJEQjEwnJrudifqI1UuItWLJYwiH5BQj q0ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IkWEj4MJxmai4vzpckcnzaQtnDAXgiUEdfdEKzLaXHw=; b=cyrTgObVaLjpwkAwFERBR6X1WCK0UfIbvX+tiFENmqmmt9vE+DnARAoNKc3QAc1+8h WC9XIggK7MoS0YIJbOHPzbIBi9KL+0C0XDY0EE+Awdqobw6SZo00ZA0wPiX+P6PiV7Jn RQuBNdCOMeTHiWKFUZU2D+QODozXofErObta4yYEgFxtG5ASL+2LYwta2QBoqH1288iP 6X16vlSRk8uMbkgM3sbOtN+vsgb/jDmBHufA2oN4A7A3wQIacD+HxR3TwPhsgAyUB48f U+uWHWezyVtPbiqfNudoI9pevAldCQugPO1Y1HnEZgsSHUj90hUM5ZRYXTnapfHC/jJk Sb2g== X-Gm-Message-State: APt69E0jf9JJV7wA0rQDQDHdW8NZIbKfnIlq+lR2rBza3/deu7ksMJeX Sog2mVpLo0lS/0gwBBpZCT4= X-Received: by 2002:a2e:6e19:: with SMTP id j25-v6mr18941369ljc.61.1529620933308; Thu, 21 Jun 2018 15:42:13 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id t6-v6sm1046153lje.18.2018.06.21.15.42.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jun 2018 15:42:12 -0700 (PDT) From: Janusz Krzysztofik To: Dmitry Torokhov , Tony Lindgren , Aaro Koskinen Cc: "David S . Miller " , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Randy Dunlap , Linus Walleij , Mark Brown , Liam Girdwood , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-input@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH v2 02/10] Input: ams_delta_serio: convert to platform driver Date: Fri, 22 Jun 2018 00:41:20 +0200 Message-Id: <20180621224128.17623-2-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180621224128.17623-1-jmkrzyszt@gmail.com> References: <20180609140224.32606-1-jmkrzyszt@gmail.com> <20180621224128.17623-1-jmkrzyszt@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to an "ams-delta-serio" platform driver. For it to be used with Amstrad Delta, register an "ams-delta-serio" platform device from the board init file. Signed-off-by: Janusz Krzysztofik --- Changelog: v2: rebased on v4.18-rc1, no conflicts arch/arm/mach-omap1/board-ams-delta.c | 6 ++++++ drivers/input/serio/ams_delta_serio.c | 34 +++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 18e0ff437b27..2119d2d3ba84 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -504,12 +504,18 @@ static struct platform_device cx20442_codec_device = { .id = -1, }; +static struct platform_device ams_delta_serio_device = { + .name = "ams-delta-serio", + .id = PLATFORM_DEVID_NONE, +}; + static struct platform_device *ams_delta_devices[] __initdata = { &latch1_gpio_device, &latch2_gpio_device, &ams_delta_kp_device, &ams_delta_camera_device, &ams_delta_audio_device, + &ams_delta_serio_device, }; static struct platform_device *late_devices[] __initdata = { diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index 3df501c3421b..a2a7fa19bf49 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c @@ -22,15 +22,17 @@ */ #include #include +#include #include #include #include -#include #include #include +#define DRIVER_NAME "ams-delta-serio" + MODULE_AUTHOR("Matt Callow"); MODULE_DESCRIPTION("AMS Delta (E3) keyboard port driver"); MODULE_LICENSE("GPL"); @@ -126,13 +128,10 @@ static const struct gpio ams_delta_gpios[] __initconst_or_module = { }, }; -static int __init ams_delta_serio_init(void) +static int ams_delta_serio_init(struct platform_device *pdev) { int err; - if (!machine_is_ams_delta()) - return -ENODEV; - ams_delta_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!ams_delta_serio) return -ENOMEM; @@ -142,22 +141,22 @@ static int __init ams_delta_serio_init(void) ams_delta_serio->close = ams_delta_serio_close; strlcpy(ams_delta_serio->name, "AMS DELTA keyboard adapter", sizeof(ams_delta_serio->name)); - strlcpy(ams_delta_serio->phys, "GPIO/serio0", + strlcpy(ams_delta_serio->phys, dev_name(&pdev->dev), sizeof(ams_delta_serio->phys)); + ams_delta_serio->dev.parent = &pdev->dev; err = gpio_request_array(ams_delta_gpios, ARRAY_SIZE(ams_delta_gpios)); if (err) { - pr_err("ams_delta_serio: Couldn't request gpio pins\n"); + dev_err(&pdev->dev, "Couldn't request gpio pins\n"); goto serio; } err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING, - "ams-delta-serio", 0); + DRIVER_NAME, 0); if (err < 0) { - pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n", - gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); + dev_err(&pdev->dev, "IRQ request failed (%d)\n", err); goto gpio; } /* @@ -179,13 +178,22 @@ static int __init ams_delta_serio_init(void) kfree(ams_delta_serio); return err; } -module_init(ams_delta_serio_init); -static void __exit ams_delta_serio_exit(void) +static int ams_delta_serio_exit(struct platform_device *pdev) { serio_unregister_port(ams_delta_serio); free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0); gpio_free_array(ams_delta_gpios, ARRAY_SIZE(ams_delta_gpios)); + + return 0; } -module_exit(ams_delta_serio_exit); + +static struct platform_driver ams_delta_serio_driver = { + .probe = ams_delta_serio_init, + .remove = ams_delta_serio_exit, + .driver = { + .name = DRIVER_NAME + }, +}; +module_platform_driver(ams_delta_serio_driver); -- 2.16.4