Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/817920/?format=api
{ "id": 817920, "url": "http://patchwork.ozlabs.org/api/patches/817920/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20170924145622.4031-4-linus.walleij@linaro.org/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/projects/42/?format=api", "name": "Linux GPIO development", "link_name": "linux-gpio", "list_id": "linux-gpio.vger.kernel.org", "list_email": "linux-gpio@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170924145622.4031-4-linus.walleij@linaro.org>", "list_archive_url": null, "date": "2017-09-24T14:56:17", "name": "[3/8] extcon: gpio: Move platform data into state container", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3ef63a19f194aba633b87c46cd1285810c7ed037", "submitter": { "id": 7055, "url": "http://patchwork.ozlabs.org/api/people/7055/?format=api", "name": "Linus Walleij", "email": "linus.walleij@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20170924145622.4031-4-linus.walleij@linaro.org/mbox/", "series": [ { "id": 4818, "url": "http://patchwork.ozlabs.org/api/series/4818/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=4818", "date": "2017-09-24T14:56:14", "name": "GPIO extcon modernization", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/4818/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/817920/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/817920/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-gpio-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-gpio-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"irUfUJ2M\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0Vk30ysnz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 00:59:39 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752591AbdIXO7X (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 24 Sep 2017 10:59:23 -0400", "from mail-pg0-f50.google.com ([74.125.83.50]:51712 \"EHLO\n\tmail-pg0-f50.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752493AbdIXO7W (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Sun, 24 Sep 2017 10:59:22 -0400", "by mail-pg0-f50.google.com with SMTP id k193so2724309pgc.8\n\tfor <linux-gpio@vger.kernel.org>;\n\tSun, 24 Sep 2017 07:59:22 -0700 (PDT)", "from genomnajs.saswifi.com ([104.153.224.168])\n\tby smtp.gmail.com with ESMTPSA id\n\tn83sm7386805pfi.163.2017.09.24.07.58.55\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 24 Sep 2017 07:59:21 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=M9XDYYz0gZs1pQCax0DPKAB1f/KOsg+vKI8BIsSW1d0=;\n\tb=irUfUJ2MH2rJmZTNqx6+vL2SbpYjKjMLRMUmuMohRvJsS7NBU67KggDbzLFZVgz2AD\n\tvaFuaUxroMlE+yEjRHQpGDWdtgxwqJnJcsrIbIbQABEFbyg7DisyY98hc63AJbBrpHqE\n\ttvJds2cKRivU6z0q7TSQU9vjXuRz2mjHgqU40=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=M9XDYYz0gZs1pQCax0DPKAB1f/KOsg+vKI8BIsSW1d0=;\n\tb=ueRImnkWofA/eKdqNLRSJisytbuDWcCcVeEqX2ASORk9rFnbiiC5wj9c3mKAf2UZ9T\n\tPr2xxlXcdlbUku31SEPvXZGOGv8PPZT7vBr8o/4HIYlY3DWtlgpRFOUPJA3AuVA/xi8P\n\tsJbPcXMXsxPY7R+6jTideYTDijOygE7buf0TI9SnSaBe5RLGJNA/QOS71ba+j3u7pA9c\n\tn2qi8j7aXHsi4HqUfxnTdJntalgCC3cymbG8wQbUmDPoKu8fub61WGqWBbkFX9YMsy45\n\tqFu4VrNKiy4+xrKZ1tjdhnnAX5We4xrecMw3ECWfcYWj3Y0aTJE9kcJPTb8NrFkassf8\n\tZmNQ==", "X-Gm-Message-State": "AHPjjUjWpkUTrLq9Xau+880co0Y2ZNVMB4BS5LiBAt4o27iiVDSz9e5y\n\thlOeM8CZ3Ifmpu9Tp/FfIvrwyw==", "X-Google-Smtp-Source": "AOwi7QDiw4q5JwFL9AxHZKPO/60rcqAYZn7JXQHbvhyY1Vo+rfyp8zRK9kPGuzt6AzX7iGdKkQj2zQ==", "X-Received": "by 10.84.171.193 with SMTP id l59mr4792507plb.133.1506265161898; \n\tSun, 24 Sep 2017 07:59:21 -0700 (PDT)", "From": "Linus Walleij <linus.walleij@linaro.org>", "To": "MyungJoo Ham <myungjoo.ham@samsung.com>,\n\tChanwoo Choi <cw00.choi@samsung.com>", "Cc": "linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,\n\tJohn Stultz <john.stultz@linaro.org>,\n\tMike Lockwood <lockwood@google.com>, Guenter Roeck <linux@roeck-us.net>,\n\tLinus Walleij <linus.walleij@linaro.org>", "Subject": "[PATCH 3/8] extcon: gpio: Move platform data into state container", "Date": "Sun, 24 Sep 2017 16:56:17 +0200", "Message-Id": "<20170924145622.4031-4-linus.walleij@linaro.org>", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170924145622.4031-1-linus.walleij@linaro.org>", "References": "<20170924145622.4031-1-linus.walleij@linaro.org>", "Sender": "linux-gpio-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-gpio.vger.kernel.org>", "X-Mailing-List": "linux-gpio@vger.kernel.org" }, "content": "This moves the platform data settings from the platform data\nstruct and into the state container, saving some unnecessary\nreferences and simplifying things a bit.\n\nSigned-off-by: Linus Walleij <linus.walleij@linaro.org>\n---\n drivers/extcon/extcon-gpio.c | 56 ++++++++++++++++++++------------------------\n 1 file changed, 26 insertions(+), 30 deletions(-)", "diff": "diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c\nindex 6abf5f70fdbf..9c4094edd123 100644\n--- a/drivers/extcon/extcon-gpio.c\n+++ b/drivers/extcon/extcon-gpio.c\n@@ -29,7 +29,13 @@\n #include <linux/workqueue.h>\n \n /**\n- * struct gpio_extcon_pdata - A simple GPIO-controlled extcon device.\n+ * struct gpio_extcon_data - A simple GPIO-controlled extcon device state container.\n+ * @edev:\t\tExtcon device.\n+ * @irq:\t\tInterrupt line for the external connector.\n+ * @work:\t\tWork fired by the interrupt.\n+ * @debounce_jiffies:\tNumber of jiffies to wait for the GPIO to stabilize, from the debounce\n+ *\t\t\tvalue.\n+ * @id_gpiod:\t\tGPIO descriptor for this external connector.\n * @extcon_id:\t\tThe unique id of specific external connector.\n * @gpio:\t\tCorresponding GPIO.\n * @gpio_active_low:\tBoolean describing whether gpio active state is 1 or 0\n@@ -40,23 +46,18 @@\n * @check_on_resume:\tBoolean describing whether to check the state of gpio\n *\t\t\twhile resuming from sleep.\n */\n-struct gpio_extcon_pdata {\n-\tunsigned int extcon_id;\n-\tunsigned gpio;\n-\tbool gpio_active_low;\n-\tunsigned long debounce;\n-\tunsigned long irq_flags;\n-\tbool check_on_resume;\n-};\n-\n struct gpio_extcon_data {\n \tstruct extcon_dev *edev;\n \tint irq;\n \tstruct delayed_work work;\n \tunsigned long debounce_jiffies;\n-\n \tstruct gpio_desc *id_gpiod;\n-\tstruct gpio_extcon_pdata *pdata;\n+\tunsigned int extcon_id;\n+\tunsigned gpio;\n+\tbool gpio_active_low;\n+\tunsigned long debounce;\n+\tunsigned long irq_flags;\n+\tbool check_on_resume;\n };\n \n static void gpio_extcon_work(struct work_struct *work)\n@@ -67,10 +68,10 @@ static void gpio_extcon_work(struct work_struct *work)\n \t\t\t work);\n \n \tstate = gpiod_get_value_cansleep(data->id_gpiod);\n-\tif (data->pdata->gpio_active_low)\n+\tif (data->gpio_active_low)\n \t\tstate = !state;\n \n-\textcon_set_state_sync(data->edev, data->pdata->extcon_id, state);\n+\textcon_set_state_sync(data->edev, data->extcon_id, state);\n }\n \n static irqreturn_t gpio_irq_handler(int irq, void *dev_id)\n@@ -84,24 +85,23 @@ static irqreturn_t gpio_irq_handler(int irq, void *dev_id)\n \n static int gpio_extcon_init(struct device *dev, struct gpio_extcon_data *data)\n {\n-\tstruct gpio_extcon_pdata *pdata = data->pdata;\n \tint ret;\n \n-\tret = devm_gpio_request_one(dev, pdata->gpio, GPIOF_DIR_IN,\n+\tret = devm_gpio_request_one(dev, data->gpio, GPIOF_DIR_IN,\n \t\t\t\tdev_name(dev));\n \tif (ret < 0)\n \t\treturn ret;\n \n-\tdata->id_gpiod = gpio_to_desc(pdata->gpio);\n+\tdata->id_gpiod = gpio_to_desc(data->gpio);\n \tif (!data->id_gpiod)\n \t\treturn -EINVAL;\n \n-\tif (pdata->debounce) {\n+\tif (data->debounce) {\n \t\tret = gpiod_set_debounce(data->id_gpiod,\n-\t\t\t\t\tpdata->debounce * 1000);\n+\t\t\t\t\t data->debounce * 1000);\n \t\tif (ret < 0)\n \t\t\tdata->debounce_jiffies =\n-\t\t\t\tmsecs_to_jiffies(pdata->debounce);\n+\t\t\t\tmsecs_to_jiffies(data->debounce);\n \t}\n \n \tdata->irq = gpiod_to_irq(data->id_gpiod);\n@@ -113,20 +113,16 @@ static int gpio_extcon_init(struct device *dev, struct gpio_extcon_data *data)\n \n static int gpio_extcon_probe(struct platform_device *pdev)\n {\n-\tstruct gpio_extcon_pdata *pdata = dev_get_platdata(&pdev->dev);\n \tstruct gpio_extcon_data *data;\n \tint ret;\n \n-\tif (!pdata)\n-\t\treturn -EBUSY;\n-\tif (!pdata->irq_flags || pdata->extcon_id > EXTCON_NONE)\n-\t\treturn -EINVAL;\n-\n \tdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_extcon_data),\n \t\t\t\t GFP_KERNEL);\n \tif (!data)\n \t\treturn -ENOMEM;\n-\tdata->pdata = pdata;\n+\n+\tif (!data->irq_flags || data->extcon_id > EXTCON_NONE)\n+\t\treturn -EINVAL;\n \n \t/* Initialize the gpio */\n \tret = gpio_extcon_init(&pdev->dev, data);\n@@ -134,7 +130,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)\n \t\treturn ret;\n \n \t/* Allocate the memory of extcon devie and register extcon device */\n-\tdata->edev = devm_extcon_dev_allocate(&pdev->dev, &pdata->extcon_id);\n+\tdata->edev = devm_extcon_dev_allocate(&pdev->dev, &data->extcon_id);\n \tif (IS_ERR(data->edev)) {\n \t\tdev_err(&pdev->dev, \"failed to allocate extcon device\\n\");\n \t\treturn -ENOMEM;\n@@ -151,7 +147,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)\n \t * is attached or detached.\n \t */\n \tret = devm_request_any_context_irq(&pdev->dev, data->irq,\n-\t\t\t\t\tgpio_irq_handler, pdata->irq_flags,\n+\t\t\t\t\tgpio_irq_handler, data->irq_flags,\n \t\t\t\t\tpdev->name, data);\n \tif (ret < 0)\n \t\treturn ret;\n@@ -178,7 +174,7 @@ static int gpio_extcon_resume(struct device *dev)\n \tstruct gpio_extcon_data *data;\n \n \tdata = dev_get_drvdata(dev);\n-\tif (data->pdata->check_on_resume)\n+\tif (data->check_on_resume)\n \t\tqueue_delayed_work(system_power_efficient_wq,\n \t\t\t&data->work, data->debounce_jiffies);\n \n", "prefixes": [ "3/8" ] }