From patchwork Fri Apr 26 19:01:20 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: 10919595 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 430131575 for ; Fri, 26 Apr 2019 19:01:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33A5628C5C for ; Fri, 26 Apr 2019 19:01:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2854728E64; Fri, 26 Apr 2019 19:01:30 +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 BDC4A28C5C for ; Fri, 26 Apr 2019 19:01:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726429AbfDZTB3 (ORCPT ); Fri, 26 Apr 2019 15:01:29 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:45181 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbfDZTB2 (ORCPT ); Fri, 26 Apr 2019 15:01:28 -0400 Received: from orion.localdomain ([95.117.100.117]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MFba4-1ha4Pg3DsE-00H8CU; Fri, 26 Apr 2019 21:01:26 +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 v2 1/3] input: keyboard: gpio-keys-polled: use input name from pdata if available Date: Fri, 26 Apr 2019 21:01:20 +0200 Message-Id: <1556305282-24148-2-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1556305282-24148-1-git-send-email-info@metux.net> References: <1556305282-24148-1-git-send-email-info@metux.net> X-Provags-ID: V03:K1:x9esqpp3YBoaywpKAmNa3WAv0fJsnks4rGipocXG8ZQ6SLT9il4 wfvOzoDudWr5vANpA7cF8SwCKAAiawtsRODabU2P6w6vQF9DC/TuWUFUdaAPDPt685StXaR vMZACk8pA2yyt5oj/FYgsx69kZkj9vA85BO0LnIIF1uMKdiK4c6ou0/yd23XGzyXRNJndNB hnZl9XoAAjDpHf81++5mQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:wUl3hgMiD4M=:yPxs61zJI6iGX8zPqWsyV8 1ewUy/lWrlngGFXWtT3sY1hDzruvsF9VyPamN+W0w1KXRnRsqkwMkaxIcqweBatGH/dOhAtPK eFZ2ksNL/DWt48AvDksdyjHDSFOpQRoHjjeMUiovkd0sVWY4Js5RsA4IJiLjLEzKphmW9WpYx ZxgfWkIxKwsRZ4+OrqjYM3QsHJoYmykB7gOg1j8nxWs1dH0sfM5EdkeP6yJtjxhiawgTUTlW3 Nk/odBDdOPehKt3yeCp9KAb67albXT8lM6e47M6TVArdMm3OTUycujLFj/kVDMBnMLwEwin3L EQ6FNA3UQcTw8YLUTbCGuIofb9jqrsAKy0VURiJRD99s3KyEUm9CBwmAifRrhSxDrJpvqTr4q rKbscGvwtSH2KX54UxIGUav0fvc0Cs0tDvmEI4SLVfPS+KffePmRTSOKwJMkTLIhiqgWGDtrz PP/zkb//Skcp0fdJ8w+nQnrhWTgszSugIrKfnwjzanvA1yj5xvE3Mt8Qbg/20t9+PmDKGUdTB ZZWxw5d/NWR4wBNbGD6dRwKGbI5rjKZdCvOWqil8BfTPIVXB2sMoKdV/6JQQI/tP51p57uagn SlSYtOKlPwlsdNXyeO0mWAxu20CLS+EhfyOMSmESWYf0mFY8/RJJs13t2fCI03tr/+3hOZ72X TGmWgZ0WdXWO6HT/E3KKDnure1ILlF7DMW3A4nEkKrQNSC3lFiz0t6NLH3kWmWQKOwlviKvlD 2mPm989ioixqSK7HPiG8E159UshSh/McvJeptw== 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 Fri Apr 26 19:01:21 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: 10919597 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 9488E1398 for ; Fri, 26 Apr 2019 19:01:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8374428E9F for ; Fri, 26 Apr 2019 19:01:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77CCB28EA6; Fri, 26 Apr 2019 19:01:41 +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 E936228EA8 for ; Fri, 26 Apr 2019 19:01:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726632AbfDZTBf (ORCPT ); Fri, 26 Apr 2019 15:01:35 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:57665 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbfDZTB3 (ORCPT ); Fri, 26 Apr 2019 15:01:29 -0400 Received: from orion.localdomain ([95.117.100.117]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N8XLj-1ggJGR4BWb-014PSr; Fri, 26 Apr 2019 21:01:27 +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 v2 2/3] input: keyboard: gpio_keys_polled: use gpio lookup table Date: Fri, 26 Apr 2019 21:01:21 +0200 Message-Id: <1556305282-24148-3-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1556305282-24148-1-git-send-email-info@metux.net> References: <1556305282-24148-1-git-send-email-info@metux.net> X-Provags-ID: V03:K1:J2ag3nKW+PtW8bhRIepQey0AilLeimPXRnm+Cq2yanBt6ytrayc lsHwVOdndf7TOMW6DBPQC7GcxJvNblkyEESJGtHrIR1mGHAHWYhE30FM9WtJr1sn43BbK8b MSL28uTJ+JY6rrqd5TFlXJaQarwdpNE+TrbGdXCPNUF3hRjxjM7jfQOj/y6y9aSWiYuOUSd C73xGXWx0y6mATCl7noLA== X-UI-Out-Filterresults: notjunk:1;V03:K0:fYRC89KxpJY=:G62wOeNWs/eniY/V+3h0eL F+I/NGTqyWSR5v4WjK3dKJE34ukrhYXt94CVbPnFokXHTOjxCj1xyGjWtv+B+kknDnHMVs+VP sWE4xLk2BpdUZXQxr9H4i9iPJXhVHcNvu253NBZyLeZiLn8FjesnFjB2OlW5TWlvXOwlM0ZVn cY4oy7BI+OKKLP3AQ9M+9+PibDMLpq65mVAvsKkLcaaF0s0DHjAfmriL1+JHv3+mgo2vbg8+w J8F9NtEyyHlWyMq1qdy6MtS/uyRSLHwKIC8wG8sA/UOkSYeiAgydhPtw+/5N9xUVC+ULJLppU H20Cbc6g0J+BUm4dEwTiHtHZVBe5KiiqvgRr6W7HHED4jzUirk1xJ2rzEETRVL1Mnnqg8mvh1 Ta20PAm5jViT/kN1NBHtzuCow88vimGmOctK+HAJT29QfhYOECLmuzXR3eJh5Hi/ykXe9/pb6 wvqp0pi8mH1yQjYq8NjkSPE82W9Pnf5DTDR2YOYZqNzNl8KJ9W2YvHQNw7REssMyHH4Gd/aZz 1sHZ/RD5ivgzDBxUEfsFkeswYUI17urFbunkyE8nxPuGQOx3Ek63i78EFOnpKzDDifWEnMoWn x9UBijpBMlzddhCqUsED0nCB++N7ctdBZtYLOVZkRMM1mAjRuggq0F8k0lDyiRpH4I+aOz9MZ njmhqNQxh2/tiiKyTcI7XMzQTwiO8QrOREJo9rw7Of4cp5MuVMEkB/Hf05xHeahyKZY4AgxTu 75/lW9GWu11pLeocfOIH5C4n8taDANDDALbjlA== 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 Fri Apr 26 19:01: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: 10919599 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 60CEF1398 for ; Fri, 26 Apr 2019 19:01:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51DD528D86 for ; Fri, 26 Apr 2019 19:01:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 463FF28EA1; Fri, 26 Apr 2019 19:01:43 +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 E892828E64 for ; Fri, 26 Apr 2019 19:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726503AbfDZTB3 (ORCPT ); Fri, 26 Apr 2019 15:01:29 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:46115 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfDZTB3 (ORCPT ); Fri, 26 Apr 2019 15:01:29 -0400 Received: from orion.localdomain ([95.117.100.117]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MnpwC-1gzuiT0pOU-00pMUM; Fri, 26 Apr 2019 21:01:27 +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 v2 3/3] input: keyboard: gpio-keys-polled: skip oftree code when CONFIG_OF disabled Date: Fri, 26 Apr 2019 21:01:22 +0200 Message-Id: <1556305282-24148-4-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1556305282-24148-1-git-send-email-info@metux.net> References: <1556305282-24148-1-git-send-email-info@metux.net> X-Provags-ID: V03:K1:kMQozdLXEQPghJnE3MO1V+pvs9P/5sD3z4hKWAyEap3u/EO/sJZ U6ouMTZrEUFeOJYKSkMLEJGCaAbvhNPY6UJPbHlYGBq8OFFDMGlizEc1PV7lAW1EbIhsnbA x4V8b99z4VZXwc+CiboZanlYioPcpVwcfuXnaNjqwcGfrdsByg23ATAiJH+Jsa74vF6GTw4 tnEv2MPen+5Gor/PWd7kw== X-UI-Out-Filterresults: notjunk:1;V03:K0:B8GEzLKFPPk=:YlCVPl3+ImJ2KOJ9FNT5bN UxTEzl990kS/yd8p6pU40NsMrkdwNv4FjM3qO+NfZ2HhG7Tg9K+A2pIlX1ybwZPxWOZZFvqys n9p0SwHPG1f3Ataq0dY0mhqJnhmu32FUF7piS2V4mxrrFxO2zsl1mhMLGesoViuR8o01WdWWx uT87aVs5dTcX6mRFkJV7lFWqh1ybrg9NX+fY5QV5/O9h1mdQpQ9siEflR3qnYc6S3n9iVQ02q J2+Dnj+Y3f/k+X6nyyRxi1Cf5A8EfXxZ9VBFW0ucGMHRDtYFywOW+nVL3z6hwpGj7G2hOpHOK pyMU971wev5VBHyC4iVag1njU4O+kmkJ0r5jNoKI0vWsEAtN/7Glpk93EjMGYUHqQb6/rgrM+ UI84gjkHiAGZgnrYiAEyKAHwrai5TFXdxGYEJAq1udj17XEQkJfoOVYreiqKGVNbYjnohg+/c geHb6hS4G1DfsESeU04pAfxrhMZ1KKN7IbZ1rH6rv3L2VyWFsN3kCgQN9/Pzs3x/wlzAFWcJH np968UV7nrymMuPdCOSZI2i3jjiv2Lxy76hFDKq5Ca0Fvyfz+dEj2x68dNgJ1MjxeFOqWaq4Z v2J+BcwQUIQ2tXjCZofHoo303QJmTg3PbDGz+KVXBhp2x5pT5NDskBJLKo228zYTQUWFpFHIC 8p6HlZQSUbq7Y5yzBzA3sgqw6YztDK4pHC/9DxC6ZTpeVz9/K1KoAXmFZZ65tsCUiYmJc9e0Y HJDR4pmbHwFWJT/kTb+0hGut/mUBghQy4xKewg== 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, 8 insertions(+) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 3f773b2..65860bf 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, @@ -222,11 +226,13 @@ static void gpio_keys_polled_set_abs_params(struct input_dev *input, input_set_abs_params(input, code, min, max, 0, 0); } +#ifdef CONFIG_OF static const struct of_device_id gpio_keys_polled_of_match[] = { { .compatible = "gpio-keys-polled", }, { }, }; MODULE_DEVICE_TABLE(of, gpio_keys_polled_of_match); +#endif /* CONFIG_OF */ static struct gpio_desc *gpio_keys_polled_get_gpiod_fwnode( struct device *dev, @@ -452,7 +458,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);