Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/715908/?format=api
{ "id": 715908, "url": "http://patchwork.ozlabs.org/api/patches/715908/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170116204122.5858-2-robh@kernel.org/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<20170116204122.5858-2-robh@kernel.org>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170116204122.5858-2-robh@kernel.org/", "date": "2017-01-16T20:41:22", "name": "[2/2] of: Add function for generating a DT modalias with a newline", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "429d477c8d965849830f6d830fa949c9f2eaacc3", "submitter": { "id": 62529, "url": "http://patchwork.ozlabs.org/api/people/62529/?format=api", "name": "Rob Herring", "email": "robh@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170116204122.5858-2-robh@kernel.org/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/715908/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/715908/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3v2QCh0WCYz9t0Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 17 Jan 2017 07:42:40 +1100 (AEDT)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3v2QCg6WZbzDqZ3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 17 Jan 2017 07:42:39 +1100 (AEDT)", "from mail-oi0-f65.google.com (mail-oi0-f65.google.com\n\t[209.85.218.65])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3v2QBH0CckzDqRN\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 17 Jan 2017 07:41:27 +1100 (AEDT)", "by mail-oi0-f65.google.com with SMTP id u143so13406430oif.3\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 16 Jan 2017 12:41:26 -0800 (PST)", "from rob-hp-laptop.herring.priv\n\t(72-48-98-129.dyn.grandenetworks.net. [72.48.98.129])\n\tby smtp.googlemail.com with ESMTPSA id\n\tv14sm1686881otv.0.2017.01.16.12.41.24\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 16 Jan 2017 12:41:24 -0800 (PST)" ], "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=bPYF7caYD8oezYfPsNNtzli770eajDsXGrl+l1oQ8rM=;\n\tb=OHmPwUteKsOUpw6bH3z/KBP65OnZqrm/GN7T5JYirJQZFK+zSjvuMl/E+ryhB6icT4\n\t/LlQUUHjE+i2P5b+duBZlyoApLsk8dHSApH9W4eAIut9Ns0WP/EPSPsFnQRNuUo3pCux\n\thJFn1Ae9pwI9j10fhqdM3OP157Q4lYn6XRdPyQ4gNTaPgnzG1Dsaa9z8VEMZHSQ9Cgcf\n\tyq3VtZnTNM/bfysQAVk+28LXtEe9hUiIzI0p67VApv3egbJRR5D3m4A15xrRQLSS1/Q5\n\tLRChVgmdiihO95zbYvTJvwEuJUbTdFzfx/04fhTNIsnowX5phsmcpxbRnMer5PzzSYgR\n\ttzXw==", "X-Gm-Message-State": "AIkVDXL7oZO6Wr/4tlP8ljVixqtT8zslZB5Qr2dA2IvIuyxj/NfLTcj5viiFSqTGDhhLNw==", "X-Received": "by 10.202.222.11 with SMTP id v11mr17841541oig.194.1484599284973;\n\tMon, 16 Jan 2017 12:41:24 -0800 (PST)", "From": "Rob Herring <robh@kernel.org>", "To": "devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tFrank Rowand <frowand.list@gmail.com>", "Subject": "[PATCH 2/2] of: Add function for generating a DT modalias with a\n\tnewline", "Date": "Mon, 16 Jan 2017 14:41:22 -0600", "Message-Id": "<20170116204122.5858-2-robh@kernel.org>", "X-Mailer": "git-send-email 2.10.1", "In-Reply-To": "<20170116204122.5858-1-robh@kernel.org>", "References": "<20170116204122.5858-1-robh@kernel.org>", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.23", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>", "Cc": "linuxppc-dev@lists.ozlabs.org, Paul Mackerras <paulus@samba.org>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org", "Sender": "\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>" }, "content": "The modalias sysfs attr is lacking a newline for DT aliases on platform\ndevices. The macio and ibmebus correctly add the newline, but open code it.\nIntroduce a new function, of_device_modalias(), that fills the buffer with\nthe modalias including the newline and update users of the old\nof_device_get_modalias function.\n\nSigned-off-by: Rob Herring <robh@kernel.org>\nCc: Benjamin Herrenschmidt <benh@kernel.crashing.org>\nCc: Paul Mackerras <paulus@samba.org>\nCc: Michael Ellerman <mpe@ellerman.id.au>\nCc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nCc: Frank Rowand <frowand.list@gmail.com>\nCc: linuxppc-dev@lists.ozlabs.org\n---\n arch/powerpc/platforms/pseries/ibmebus.c | 5 +----\n drivers/base/platform.c | 2 +-\n drivers/macintosh/macio_sysfs.c | 7 +------\n drivers/of/device.c | 16 +++++++++++++++-\n include/linux/of_device.h | 7 +++----\n 5 files changed, 21 insertions(+), 16 deletions(-)", "diff": "diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c\nindex 614c28537141..18f5a7a2896f 100644\n--- a/arch/powerpc/platforms/pseries/ibmebus.c\n+++ b/arch/powerpc/platforms/pseries/ibmebus.c\n@@ -410,10 +410,7 @@ static ssize_t name_show(struct device *dev,\n static ssize_t modalias_show(struct device *dev,\n \t\t\t\tstruct device_attribute *attr, char *buf)\n {\n-\tssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);\n-\tbuf[len] = '\\n';\n-\tbuf[len+1] = 0;\n-\treturn len+1;\n+\treturn of_device_modalias(dev, buf, PAGE_SIZE);\n }\n \n static struct device_attribute ibmebus_bus_device_attrs[] = {\ndiff --git a/drivers/base/platform.c b/drivers/base/platform.c\nindex c4af00385502..d92f60d7f15d 100644\n--- a/drivers/base/platform.c\n+++ b/drivers/base/platform.c\n@@ -837,7 +837,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,\n \tstruct platform_device\t*pdev = to_platform_device(dev);\n \tint len;\n \n-\tlen = of_device_get_modalias(dev, buf, PAGE_SIZE -1);\n+\tlen = of_device_modalias(dev, buf, PAGE_SIZE);\n \tif (len != -ENODEV)\n \t\treturn len;\n \ndiff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c\nindex 8eb40afbd0f5..0b1f9c76c68d 100644\n--- a/drivers/macintosh/macio_sysfs.c\n+++ b/drivers/macintosh/macio_sysfs.c\n@@ -41,12 +41,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)\n static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,\n \t\t\t char *buf)\n {\n-\tint len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);\n-\n-\tbuf[len] = '\\n';\n-\tbuf[len+1] = 0;\n-\n-\treturn len+1;\n+\treturn of_device_modalias(dev, buf, PAGE_SIZE);\n }\n \n static ssize_t devspec_show(struct device *dev,\ndiff --git a/drivers/of/device.c b/drivers/of/device.c\nindex bd620452f255..f3c3108d5a3a 100644\n--- a/drivers/of/device.c\n+++ b/drivers/of/device.c\n@@ -176,7 +176,7 @@ const void *of_device_get_match_data(const struct device *dev)\n }\n EXPORT_SYMBOL(of_device_get_match_data);\n \n-ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)\n+static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)\n {\n \tconst char *compat;\n \tint cplen, i;\n@@ -227,6 +227,20 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)\n }\n \n /**\n+ * of_device_modalias - Fill buffer with newline terminated modalias string\n+ */\n+ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len)\n+{\n+\tssize_t sl = of_device_get_modalias(dev, str, len - 2);\n+\tif (sl < 0)\n+\t\treturn sl;\n+\n+\tstr[sl++] = '\\n';\n+\tstr[sl] = 0;\n+\treturn sl;\n+}\n+\n+/**\n * of_device_uevent - Display OF related uevent information\n */\n void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)\ndiff --git a/include/linux/of_device.h b/include/linux/of_device.h\nindex cc7dd687a89d..971d7250a8a4 100644\n--- a/include/linux/of_device.h\n+++ b/include/linux/of_device.h\n@@ -35,8 +35,7 @@ extern void of_device_unregister(struct platform_device *ofdev);\n \n extern const void *of_device_get_match_data(const struct device *dev);\n \n-extern ssize_t of_device_get_modalias(struct device *dev,\n-\t\t\t\t\tchar *str, ssize_t len);\n+extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len);\n \n extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);\n extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);\n@@ -72,8 +71,8 @@ static inline const void *of_device_get_match_data(const struct device *dev)\n \treturn NULL;\n }\n \n-static inline int of_device_get_modalias(struct device *dev,\n-\t\t\t\t char *str, ssize_t len)\n+static inline int of_device_modalias(struct device *dev,\n+\t\t\t\t char *str, ssize_t len)\n {\n \treturn -ENODEV;\n }\n", "prefixes": [ "2/2" ] }