From patchwork Tue Apr 16 19:57:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 10904013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 869C417E0 for ; Tue, 16 Apr 2019 19:58:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70C92289FF for ; Tue, 16 Apr 2019 19:58:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64FB728A03; Tue, 16 Apr 2019 19:58:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13182289FF for ; Tue, 16 Apr 2019 19:58:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730490AbfDPT6K (ORCPT ); Tue, 16 Apr 2019 15:58:10 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:41715 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728466AbfDPT5m (ORCPT ); Tue, 16 Apr 2019 15:57:42 -0400 Received: from orion.localdomain ([95.117.99.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MGi2e-1h2gQI17sA-00DqED; Tue, 16 Apr 2019 21:57:40 +0200 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org Subject: [PATCH 1/4] mod_devicetable: helper macro for declaring oftree module device table Date: Tue, 16 Apr 2019 21:57:22 +0200 Message-Id: <1555444645-15156-2-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555444645-15156-1-git-send-email-info@metux.net> References: <1555444645-15156-1-git-send-email-info@metux.net> X-Provags-ID: V03:K1:io3EYpJ0TfMSSqJWuFwvkyuTFFZlJeJGmW+bxf4rexSPfQx2v1a ZIdnP+Sdpw3eCqPAvVd2rzMDsO1EddsJ4bktRd90EoXYrQ9JuLhwm9v9RenFNPrWVtKLxJU SU8XKp4VjC70eyNfxchQzjjAD+IJ4fAuVaQOq/viEAcg3oQY0rauTtoAgTy3o3UO+tfipGg MgCvKjmnaOaVH+608mlGg== X-UI-Out-Filterresults: notjunk:1;V03:K0:pX2eMN7rHxk=:BkabbqOjBmh94xnVq/lsRX qVIZib+LdXlyok9G/tyFCZaAOdrTkWYaUqqslfxGJWg9fv44F/Pt3AToK2nmK52a1Mjo/am8I 3bn4+o42yHJTSg6r0zodGj9I8yrFRwjhZ4Wvw8RrdpZdfncbCK0+d3jth0Vh5OSppe+Hn7aE2 ECYYOqcCeTLnXpDRCg6pfwmBpYk0tkGf+JJeloQ5N1kj25jmzT/IFykm/82UxmVECcjaWItjz r55b/3GPvDb8Sw0e4DCa7rmgpOM+UyP92ZtFsWm3j9CUf+ryCPjo7/hUWL2AyamjvD8bKUBTA hPQh0w3+xPEZQWHuZmHH8mba6Bpg7ssc5l84KBqedqWp+L6HJxZ8woZEnEVW3IqOOAi2b9wDH 7bHEZGNVSIa1274vrGnim+R5nBsLpluo78c++qV/q1WjATg7R8HbvNn4Dmf3/eoR58hMO3bbQ D6GUrXmSdMfq8Q7PX5Nh9sQBH9UGbuLy7zjJ7piodtoWphM4hheQD0ERnsDRyRkcTkClTKbdQ 0zQ8zjxg4fsBnmITbR0jGBx+3p6gvBByT4iE79Cv+xphfFJK6YMp45kOfhAtAfaavySk3hp4F U0U4hHuKOw25TmdHFFwhRCjO+Bz+1miSDjsjtQO8zw47mxDF790xEIQ8NlnuZ1esgdYXgfJGi IW7V2YBpkZP9xZEph9yhAUb1mDVuxm00SOuvrQe3+cA1ElN6N3QGZphY8ZQNGDMR16j9yPUhS JCm/jH/VYXsR0oEgb0FGwS4vSSTcthIBkozr1g== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Little helper macro that declares an oftree module device table, if CONFIG_OF is enabled. Otherwise it's just noop. This is also helpful if some drivers can be built w/ or w/o oftree support. Signed-off-by: Enrico Weigelt, metux IT consult --- include/linux/mod_devicetable.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 448621c..853e301 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -245,6 +245,15 @@ struct of_device_id { const void *data; }; +/* + * macro for adding the of module device table only if CONFIG_OF enabled + */ +#ifdef CONFIG_OF +#define MODULE_DEVICE_TABLE_OF(name) MODULE_DEVICE_TABLE(of,name) +#else +#define MODULE_DEVICE_TABLE_OF(name) +#endif /* CONFIG_OF */ + /* VIO */ struct vio_device_id { char type[32]; From patchwork Tue Apr 16 19:57:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 10904011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B7CB13B5 for ; Tue, 16 Apr 2019 19:58:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 547B728950 for ; Tue, 16 Apr 2019 19:58:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4814328A00; Tue, 16 Apr 2019 19:58:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F39AC28950 for ; Tue, 16 Apr 2019 19:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730459AbfDPT6F (ORCPT ); Tue, 16 Apr 2019 15:58:05 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:50773 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728734AbfDPT5m (ORCPT ); Tue, 16 Apr 2019 15:57:42 -0400 Received: from orion.localdomain ([95.117.99.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MmD6U-1gYajk25yK-00iCtf; Tue, 16 Apr 2019 21:57:40 +0200 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org Subject: [PATCH 2/4] input: keyboard: gpio-keys-polled: use input name from pdata if available Date: Tue, 16 Apr 2019 21:57:23 +0200 Message-Id: <1555444645-15156-3-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555444645-15156-1-git-send-email-info@metux.net> References: <1555444645-15156-1-git-send-email-info@metux.net> X-Provags-ID: V03:K1:0DjkhHxOiFXi9RwcCtGVebMjbGBDQAXetXZ/02Cpb8UJVwVwjUc b8WlFsvndVedmgZ5nDNDafHW/9P4s6yPwTJIME4auQc7GVPdMRcaZWVQPHHj8IhR3Cfk1Nx 0Bgkqo3g3AJt0ITVxK+XJ1Q+Vn0n7zuNA9ai3ffk5TyIApb+c7tlZtC3gnzt+MzK+TOTgYL aZPakNf1FtnEL7BNrKcxg== X-UI-Out-Filterresults: notjunk:1;V03:K0:noHrulkyL9o=:slB9iUIkJWEvps+FZvLYO2 VbZxFKY76FPruywCbLaZhf3e0DC44PqqNRJiMFV1D7BlIigoLmmqU/i+H+/oDjMDnSCqmg4/4 YLCQ3TZfIynv8WUl5LxxifkRtIhatj5/48kmRlUyYaSpl//WOaVPWOrWntUocQySTtuF42GYA 1VPR7YnMrXsV7eu0F2i05mBN0BtPRp1Wi1Asf5pcX6NdFmJAIv9RkaXgUJ07K/A/t7Nt80e8/ TLl78M4jRjMLXlvqTCldghRh59PoXk8sqg6Pu0V2iz7D32gpyVSdDHh1jAL2uzR27gL7fpG5d LGk3xaanqPUylM29687wIkitb5Vps4a3YuEBvMlHZGOI+OTedXwJ7SsreLVcoQldbWItgB6su JyLzhIf4rlo0+WYOV48MLv6SFIRLFr+cAXIJCEdYE2a260Aym1dpkXoa5JlehjjcnjUboYze3 LWV5uUDjBi3WDI+g6TGwHfXHbgy4I1nh1LjUbvB9fuMKh14zmoIcdwtAJJ0ImMyAkiuXJDpSs RljoUclNwkG6b9MK3amy1f4d6YKiptwiLbebvN6Oxfhd/vgExntZxLZfgXWsC089EEztA/ZRY FKZoZYhyjJj0JkdZ9gcsGzqKjCJfWe/gn+3lJJmvZ71iMLv/TeSvmZ+/4eFLoT7UBb/IyRuy6 Y+8AONR0CtEKtlv/ZSA6DrTb23jJGiEu49u3ZK1Z0M1bmL1avpKFjaLN6VbzFy220YK2WsdN/ LFIip4zgVJ+afxSwGCGoRb+n/iBLNyMbVCaxEw== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of hardcoding the input name to the driver name ('gpio-keys-polled'), allow the passing a name via platform data ('name' field was already present), but default to old behaviour in case of NULL. Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Signed-off-by: Enrico Weigelt, metux IT consult --- drivers/input/keyboard/gpio_keys_polled.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index edc7262..3312186 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -272,7 +272,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) input = poll_dev->input; - input->name = pdev->name; + input->name = (pdata->name ? pdata->name : pdev->name); input->phys = DRV_NAME"/input0"; input->id.bustype = BUS_HOST; From patchwork Tue Apr 16 19:57:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 10904009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6887717E0 for ; Tue, 16 Apr 2019 19:58:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50D8928915 for ; Tue, 16 Apr 2019 19:58:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45187289FF; Tue, 16 Apr 2019 19:58:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A74F428915 for ; Tue, 16 Apr 2019 19:58:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728373AbfDPT5s (ORCPT ); Tue, 16 Apr 2019 15:57:48 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:47829 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728770AbfDPT5n (ORCPT ); Tue, 16 Apr 2019 15:57:43 -0400 Received: from orion.localdomain ([95.117.99.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MFba4-1h3nQ232Q2-00H953; Tue, 16 Apr 2019 21:57:40 +0200 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org Subject: [PATCH 3/4] input: keyboard: gpio_keys_polled: use gpio lookup table Date: Tue, 16 Apr 2019 21:57:24 +0200 Message-Id: <1555444645-15156-4-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555444645-15156-1-git-send-email-info@metux.net> References: <1555444645-15156-1-git-send-email-info@metux.net> X-Provags-ID: V03:K1:CPdYnkIO5e3+kGA3V5cgWPn219nnvvi9Vdoo5187xAQ3g86z9ws qx6blkrm47RdLkPQQIivKqVU7Wl4lX20IoBHCZehiAAdhZY9CPjX0BlqdqObnLavXuLjl2W wfKdKd/6kk4wm9v4nEw0c7CbZtsrE7lG+7krm8I24pm6jdBaBgxWuiMUE4i3GDLMB75ertY a+4Jdh8OrPuBX2MVy3X3A== X-UI-Out-Filterresults: notjunk:1;V03:K0:7gvHo7+nZ8g=:KlQ5qqE6dQ5s7ISN0gBmqb 0pmgssOVIDVjTQlfZSA8qsNRaMT/gBzaVsaXv71O56PuElkEAqk4mJVB2zdo89UchHmXAdB22 mWGnh6rZqMtQccU+Cyq710hl8vMZ62iulBU/X7EdAnPEnAoj/z/mHLHoMPa32xQ0a/KXH6GW/ JiEvfnOmF62fnpQACGo8JeumuQiVMSzy3684J/x67lsiuryVv5HQnejeHZ/AkdAtu2cXZbD+A SErWcew2FK+PFrACgddyl/fKe8nPQplf85G2jmSjA4687uVCVNb5WIIIjUKBPKAb33zAHRg3a iiCdaL7M1zzOzP3VhPYcpLNa0vnCEkJIeqW5ytij6HUjyTLal9/6aJQzVIZ4thq1shTklcW0B aBDscLcd/h+WL2t8iyR75crHfudk+iOJwdbfcB1HmSNYHjZl7/HqDxtmJ7pZdRqEtX0cr36IE 4cYw+F61D0/590dRPNdB7Twq5b0YSpVWeOle3xapSylhhebKQbky5MEddAOSUxn209r0UVKOt 5mNso6azkUQAHb8FBH/zY/lW/jNBSTlWCYqF7J8hVipNRfYS2Rljx5mqqKh0Af8ROFCOYcKFK eg3QmWUbvBezfCv1ks/b1BKRqX9HqIODUqaUzmJJFtx8BRxI4WMTiPBzkdnicXAInnjgi7bay o98fcCuRx/Ox/NqhgDgPh5ZgSX9RWnxUacEB2jvUYZKjkoUQoAvdZW9f+rM5zQ/JdYqyTYokS VbutjSQ58A6zI/GIAbsRGK3Bj3Pyp+3i9ephMw== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Support the recently introduced gpio lookup tables for attaching to gpio lines. So, harcoded gpio numbers aren't needed anymore. Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Signed-off-by: Enrico Weigelt, metux IT consult --- drivers/input/keyboard/gpio_keys_polled.c | 167 +++++++++++++++++++++--------- 1 file changed, 119 insertions(+), 48 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 3312186..3f773b2 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -227,6 +228,119 @@ static void gpio_keys_polled_set_abs_params(struct input_dev *input, }; MODULE_DEVICE_TABLE(of, gpio_keys_polled_of_match); +static struct gpio_desc *gpio_keys_polled_get_gpiod_fwnode( + struct device *dev, + int idx, + const char *desc) +{ + struct gpio_desc *gpiod; + struct fwnode_handle *child; + int x; + + /* get the idx'th child node */ + child = device_get_next_child_node(dev, NULL); + while (child && x) { + child = device_get_next_child_node(dev, child); + x--; + } + + if (!child) { + dev_err(dev, "missing oftree child node #%d\n", idx); + return ERR_PTR(-EINVAL); + } + + gpiod = devm_fwnode_get_gpiod_from_child(dev, + NULL, + child, + GPIOD_IN, + desc); + if (IS_ERR(gpiod)) { + if (PTR_ERR(gpiod) != -EPROBE_DEFER) + dev_err(dev, + "failed to get gpio: %ld\n", + PTR_ERR(gpiod)); + fwnode_handle_put(child); + return gpiod; + } + + return gpiod; +} + +static struct gpio_desc *gpio_keys_polled_get_gpiod_legacy( + struct device *dev, + int idx, + const struct gpio_keys_button *button) +{ + /* + * Legacy GPIO number so request the GPIO here and + * convert it to descriptor. + */ + unsigned int flags = GPIOF_IN; + struct gpio_desc *gpiod; + int error; + + dev_info(dev, "hardcoded gpio IDs are deprecated.\n"); + + if (button->active_low) + flags |= GPIOF_ACTIVE_LOW; + + error = devm_gpio_request_one(dev, button->gpio, + flags, button->desc ? : DRV_NAME); + if (error) { + dev_err(dev, + "unable to claim gpio %u, err=%d\n", + button->gpio, error); + return ERR_PTR(error); + } + + gpiod = gpio_to_desc(button->gpio); + if (!gpiod) { + dev_err(dev, + "unable to convert gpio %u to descriptor\n", + button->gpio); + return ERR_PTR(-EINVAL); + } + + return gpiod; +} + +static struct gpio_desc *gpio_keys_polled_get_gpiod( + struct device *dev, + int idx, + const struct gpio_keys_button *button) +{ + struct gpio_desc *gpiod = NULL; + int error; + + /* No legacy static platform data - use oftree */ + if (!dev_get_platdata(dev)) { + return gpio_keys_polled_get_gpiod_fwnode( + dev, idx, button->desc); + } + + gpiod = devm_gpiod_get_index(dev, NULL, idx, GPIOF_IN); + + if (!IS_ERR(gpiod)) { + dev_info(dev, "picked gpiod idx %d from gpio table\n", idx); + gpiod_set_consumer_name(gpiod, button->desc ? : DRV_NAME); + return gpiod; + } + + if (PTR_ERR(gpiod) != -ENOENT) { + dev_err(dev, "failed fetching gpiod #%d: %d\n", + idx, PTR_ERR(gpiod)); + return gpiod; + } + + /* Use legacy gpio id, if defined */ + if (gpio_is_valid(button->gpio)) { + return gpio_keys_polled_get_gpiod_legacy( + dev, idx, button); + } + + return ERR_PTR(-ENOENT); +} + static int gpio_keys_polled_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -291,57 +405,14 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) if (button->wakeup) { dev_err(dev, DRV_NAME " does not support wakeup\n"); - fwnode_handle_put(child); return -EINVAL; } - if (!dev_get_platdata(dev)) { - /* No legacy static platform data */ - child = device_get_next_child_node(dev, child); - if (!child) { - dev_err(dev, "missing child device node\n"); - return -EINVAL; - } - - bdata->gpiod = devm_fwnode_get_gpiod_from_child(dev, - NULL, child, - GPIOD_IN, - button->desc); - if (IS_ERR(bdata->gpiod)) { - error = PTR_ERR(bdata->gpiod); - if (error != -EPROBE_DEFER) - dev_err(dev, - "failed to get gpio: %d\n", - error); - fwnode_handle_put(child); - return error; - } - } else if (gpio_is_valid(button->gpio)) { - /* - * Legacy GPIO number so request the GPIO here and - * convert it to descriptor. - */ - unsigned flags = GPIOF_IN; - - if (button->active_low) - flags |= GPIOF_ACTIVE_LOW; - - error = devm_gpio_request_one(dev, button->gpio, - flags, button->desc ? : DRV_NAME); - if (error) { - dev_err(dev, - "unable to claim gpio %u, err=%d\n", - button->gpio, error); - return error; - } - - bdata->gpiod = gpio_to_desc(button->gpio); - if (!bdata->gpiod) { - dev_err(dev, - "unable to convert gpio %u to descriptor\n", - button->gpio); - return -EINVAL; - } + bdata->gpiod = gpio_keys_polled_get_gpiod(dev, i, button); + + if (IS_ERR(bdata->gpiod)) { + dev_err(dev, "failed to fetch gpiod #%d\n", i); + return PTR_ERR(bdata->gpiod); } bdata->last_state = -1; From patchwork Tue Apr 16 19:57:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 10904007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7086B13B5 for ; Tue, 16 Apr 2019 19:57:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A5F428A03 for ; Tue, 16 Apr 2019 19:57:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EF9B28A0C; Tue, 16 Apr 2019 19:57:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4ACE28A03 for ; Tue, 16 Apr 2019 19:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727136AbfDPT5n (ORCPT ); Tue, 16 Apr 2019 15:57:43 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:47519 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728781AbfDPT5m (ORCPT ); Tue, 16 Apr 2019 15:57:42 -0400 Received: from orion.localdomain ([95.117.99.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N4i7l-1gosy33tjz-011f1Y; Tue, 16 Apr 2019 21:57:41 +0200 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org Subject: [PATCH 4/4] input: keyboard: gpio-keys-polled: skip oftree code when CONFIG_OF disabled Date: Tue, 16 Apr 2019 21:57:25 +0200 Message-Id: <1555444645-15156-5-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555444645-15156-1-git-send-email-info@metux.net> References: <1555444645-15156-1-git-send-email-info@metux.net> X-Provags-ID: V03:K1:mvqVlM/Ve9qfMnQh0P0SBJ3tmiUqICi2lk/C5OUytIrVpdTa4SZ LsNBXSDfD8Za8Tf6lGTRsF24S9BNAvpOieRP2KaFttZ0QDI4qXyQSKbN+ROP5jOI0KoClKN GPAHcZYMMwelHcbFbikWVGTAUEqrsfQL5NuAmVHdsOmwiQqKdWtrgOOhSnTeNp+4D+ZmTfb hfYxVgvuCVXgHxjdw8VkQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:YJ/bmDr3HXk=:0CtQ9OEf8RQvJuxyTHOS7u A/yRQaovxLUYV1fMit9AUL+62hbqa0enIxs9Dd8WHt+eZUzeo4AapTN6ylg0lgYN0K9oOPYG3 rqjpXesJJ7rs37XEsK04ryHUazH27PogxzWucXVQcF1I/vbpL5GqpR7kp79i2a/P4775tSVOl GHvsTU0IlwrRMyGKr4ThFXK7K4O0U7lgVhLvSPZJt48rHsMEgOVRpToQH96PVwQE1tAcdod70 wwVb0ccnncfrsm/mHaPH6WTxzRty1H3PoOXXZ1TO+cnLW4ERcN5LrbNl00Z21918nom2u6PDt IuYjA44Z3Y22dQx/ldKvF/KMASYRLGjSR6PWcRrPLZFhVP1HTWoK9zRQB5tUHajIbOT984Zko 3VrGahkMDbxz+vhCeCyz/JvZOlRz494DUVYF4Bagxn3Exq6/HzI3gUIiIw2KOomriiHbXEvFm a4Staq2gwN/MCCVKEgZLu1vY433NuP+GGo/KAPN7NaJqH/KOAWbiQ2C2Q/Mjw8t6r0z2oRcOZ a8jH/JSNku1uu8HZh1Tlnntgmz0PygKthFpWoksezYDoJDDkoQr1EUlSODWlMuhHwd3stWxHn OqrceO8Acj4GjQvrjhjtE276SwJR1wa/M6wiaBTT3CC1GITRX21/4P7jheajxwhzyqEbx1f8y pAaz5glwSSe1AjPqMwjEuNC/sKZ7gK0XBx9HCl/3oz/YVKPbHt4bbXl71bWXMXK3pfyrc04LO DVlmujk8pDHga75iiCg5ZV8Ph7cOuBOBn4Lk/Q== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP we don't need to build in oftree probing stuff when oftree isn't enabled at all. Signed-off-by: Enrico Weigelt, metux IT consult --- drivers/input/keyboard/gpio_keys_polled.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 3f773b2..fbccb89 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -147,6 +147,7 @@ static void gpio_keys_polled_close(struct input_polled_dev *dev) static struct gpio_keys_platform_data * gpio_keys_polled_get_devtree_pdata(struct device *dev) { +#ifdef CONFIG_OF struct gpio_keys_platform_data *pdata; struct gpio_keys_button *button; struct fwnode_handle *child; @@ -200,6 +201,9 @@ static void gpio_keys_polled_close(struct input_polled_dev *dev) } return pdata; +#else /* CONFIG_OF */ + return ERR_PTR(-ENOENT); +#endif /* CONFIG_OF */ } static void gpio_keys_polled_set_abs_params(struct input_dev *input, @@ -226,7 +230,7 @@ static void gpio_keys_polled_set_abs_params(struct input_dev *input, { .compatible = "gpio-keys-polled", }, { }, }; -MODULE_DEVICE_TABLE(of, gpio_keys_polled_of_match); +MODULE_DEVICE_TABLE_OF(gpio_keys_polled_of_match); static struct gpio_desc *gpio_keys_polled_get_gpiod_fwnode( struct device *dev, @@ -452,7 +456,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) .probe = gpio_keys_polled_probe, .driver = { .name = DRV_NAME, +#ifdef CONFIG_OF .of_match_table = gpio_keys_polled_of_match, +#endif /* CONFIG_OF */ }, }; module_platform_driver(gpio_keys_polled_driver);