Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/812186/?format=api
{ "id": 812186, "url": "http://patchwork.ozlabs.org/api/patches/812186/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20170910214424.14945-6-linus.walleij@linaro.org/", "project": { "id": 35, "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api", "name": "Linux I2C development", "link_name": "linux-i2c", "list_id": "linux-i2c.vger.kernel.org", "list_email": "linux-i2c@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170910214424.14945-6-linus.walleij@linaro.org>", "list_archive_url": null, "date": "2017-09-10T21:44:24", "name": "[5/5] i2c: gpio: Local vars in probe", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "283319aba0247a8c2d19dff4e407b783332d030d", "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-i2c/patch/20170910214424.14945-6-linus.walleij@linaro.org/mbox/", "series": [ { "id": 2418, "url": "http://patchwork.ozlabs.org/api/series/2418/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=2418", "date": "2017-09-10T21:44:19", "name": "I2C GPIO to use gpiolibs open drain", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2418/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812186/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812186/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-i2c-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-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"CbcTVlfm\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xr4N55k2yz9s4s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 07:44:53 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751918AbdIJVox (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 10 Sep 2017 17:44:53 -0400", "from mail-lf0-f41.google.com ([209.85.215.41]:33400 \"EHLO\n\tmail-lf0-f41.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751827AbdIJVow (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Sun, 10 Sep 2017 17:44:52 -0400", "by mail-lf0-f41.google.com with SMTP id c80so14448725lfh.0\n\tfor <linux-i2c@vger.kernel.org>; Sun, 10 Sep 2017 14:44:51 -0700 (PDT)", "from fabina.bredbandsbolaget.se\n\t(c-2209e055.014-348-6c756e10.cust.bredbandsbolaget.se.\n\t[85.224.9.34]) by smtp.gmail.com with ESMTPSA id\n\tc69sm1461546ljd.42.2017.09.10.14.44.49\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 10 Sep 2017 14:44:50 -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=erzgjhU0ezSIivaubwnwB+XCJNNifZqiUpJZ7kylSg0=;\n\tb=CbcTVlfm6t23WEwprTHtw710tIDAdxGwWka0o+xOgBycTzqXNZKDNR5fbiA3oHkE2G\n\t2lebTDU8LviJoEVLCafNaOFpcUGMEKmmvD9AXbjh8ULStwz7WlBx+YRW37ziK1WafTgo\n\tzuCFJgUV1oPd89LhIqPQDZUX3BbJy1K5kSOOE=", "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=erzgjhU0ezSIivaubwnwB+XCJNNifZqiUpJZ7kylSg0=;\n\tb=n/4bBf4C/O/il4K0Rm7nYvvAZRTQM5+2SulfQF/NZ/6k0aQOR2xrFCEsGx3bZIg0Pm\n\tLaMIDf/iqTMcLOzGXGhwcMRHyO3bpdlhQhOyJj5yVKkNDAmGK0RkBMH5Ye3t9NwCWS5g\n\ts0MjNwEuT/HK5CsSdws1T4k7Tc83Vw4lM76BZY8AwlNH33hWafz/PMW2qZ39jFOLV1Sc\n\ttq95+8gAgSOaZD1OqqGyZL+QZWi5l79fWsnMoO+sgSivjYtI5/Gn1MoqrcbEwugnunzT\n\tIWhYmCkuArtaGHQN/869c7fjqJO16m2qR6GasMQ8Z4/Kb9X0RnObIHdI701IpJvT783l\n\tkLaQ==", "X-Gm-Message-State": "AHPjjUhdjDxDS+cvsLWqKjv4UJFmupNWcsPwOrfkp64S/+CnpYEGW+Y3\n\t8ggIsmQ+Z7AtUpNaAenMCw==", "X-Google-Smtp-Source": "ADKCNb773bhIteqT6T7lwK2r6V3lBceeQP/MPy84KM/y3ABleZhZdlj59GSA5uxCX1qJ3spg9lGxKg==", "X-Received": "by 10.46.6.18 with SMTP id 18mr3081395ljg.117.1505079890970;\n\tSun, 10 Sep 2017 14:44:50 -0700 (PDT)", "From": "Linus Walleij <linus.walleij@linaro.org>", "To": "Wolfram Sang <wsa@the-dreams.de>, linux-i2c@vger.kernel.org", "Cc": "linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org,\n\tadi-buildroot-devel@lists.sourceforge.net,\n\tLinus Walleij <linus.walleij@linaro.org>", "Subject": "[PATCH 5/5] i2c: gpio: Local vars in probe", "Date": "Sun, 10 Sep 2017 23:44:24 +0200", "Message-Id": "<20170910214424.14945-6-linus.walleij@linaro.org>", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170910214424.14945-1-linus.walleij@linaro.org>", "References": "<20170910214424.14945-1-linus.walleij@linaro.org>", "Sender": "linux-i2c-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-i2c.vger.kernel.org>", "X-Mailing-List": "linux-i2c@vger.kernel.org" }, "content": "By creating local variables for *dev and *np, the code become\nmuch easier to read, in my opinion.\n\nSigned-off-by: Linus Walleij <linus.walleij@linaro.org>\n---\nI put this at the end of the series because compared to the\nrest of the patches it is completely unimportant.\n---\n drivers/i2c/busses/i2c-gpio.c | 26 ++++++++++++++------------\n 1 file changed, 14 insertions(+), 12 deletions(-)", "diff": "diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c\nindex 18ac4cf2ee75..7fe599f4fdb0 100644\n--- a/drivers/i2c/busses/i2c-gpio.c\n+++ b/drivers/i2c/busses/i2c-gpio.c\n@@ -88,10 +88,12 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \tstruct i2c_gpio_platform_data *pdata;\n \tstruct i2c_algo_bit_data *bit_data;\n \tstruct i2c_adapter *adap;\n+\tstruct device *dev = &pdev->dev;\n+\tstruct device_node *np = dev->of_node;\n \tenum gpiod_flags gflags;\n \tint ret;\n \n-\tpriv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);\n+\tpriv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);\n \tif (!priv)\n \t\treturn -ENOMEM;\n \n@@ -99,15 +101,15 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \tbit_data = &priv->bit_data;\n \tpdata = &priv->pdata;\n \n-\tif (pdev->dev.of_node) {\n-\t\tof_i2c_gpio_get_props(pdev->dev.of_node, pdata);\n+\tif (np) {\n+\t\tof_i2c_gpio_get_props(np, pdata);\n \t} else {\n \t\t/*\n \t\t * If all platform data settings are zero it is OK\n \t\t * to not provide any platform data from the board.\n \t\t */\n-\t\tif (dev_get_platdata(&pdev->dev))\n-\t\t\tmemcpy(pdata, dev_get_platdata(&pdev->dev),\n+\t\tif (dev_get_platdata(dev))\n+\t\t\tmemcpy(pdata, dev_get_platdata(dev),\n \t\t\t sizeof(*pdata));\n \t}\n \n@@ -123,7 +125,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \t\tgflags = GPIOD_OUT_HIGH;\n \telse\n \t\tgflags = GPIOD_OUT_HIGH_OPEN_DRAIN;\n-\tpriv->sda = devm_gpiod_get_index(&pdev->dev, NULL, 0, gflags);\n+\tpriv->sda = devm_gpiod_get_index(dev, NULL, 0, gflags);\n \tif (IS_ERR(priv->sda)) {\n \t\tret = PTR_ERR(priv->sda);\n \t\t/* FIXME: hack in the old code, is this really necessary? */\n@@ -142,7 +144,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \t\tgflags = GPIOD_OUT_LOW;\n \telse\n \t\tgflags = GPIOD_OUT_LOW_OPEN_DRAIN;\n-\tpriv->scl = devm_gpiod_get_index(&pdev->dev, NULL, 1, gflags);\n+\tpriv->scl = devm_gpiod_get_index(dev, NULL, 1, gflags);\n \tif (IS_ERR(priv->scl)) {\n \t\tret = PTR_ERR(priv->sda);\n \t\t/* FIXME: hack in the old code, is this really necessary? */\n@@ -173,15 +175,15 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \tbit_data->data = priv;\n \n \tadap->owner = THIS_MODULE;\n-\tif (pdev->dev.of_node)\n-\t\tstrlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name));\n+\tif (np)\n+\t\tstrlcpy(adap->name, dev_name(dev), sizeof(adap->name));\n \telse\n \t\tsnprintf(adap->name, sizeof(adap->name), \"i2c-gpio%d\", pdev->id);\n \n \tadap->algo_data = bit_data;\n \tadap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;\n-\tadap->dev.parent = &pdev->dev;\n-\tadap->dev.of_node = pdev->dev.of_node;\n+\tadap->dev.parent = dev;\n+\tadap->dev.of_node = np;\n \n \tadap->nr = pdev->id;\n \tret = i2c_bit_add_numbered_bus(adap);\n@@ -195,7 +197,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \t * get accessors to get the actual name of the GPIO line,\n \t * from the descriptor, then provide that instead.\n \t */\n-\tdev_info(&pdev->dev, \"using lines %u (SDA) and %u (SCL%s)\\n\",\n+\tdev_info(dev, \"using lines %u (SDA) and %u (SCL%s)\\n\",\n \t\t desc_to_gpio(priv->sda), desc_to_gpio(priv->scl),\n \t\t pdata->scl_is_output_only\n \t\t ? \", no clock stretching\" : \"\");\n", "prefixes": [ "5/5" ] }