aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-11 15:13:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-11 15:13:55 -0400
commitf7cca14bcec49989bcfe7cf2135ac719352d7022 (patch)
tree2c17c70671d1d7c55ba45ede7ea16ccfb89cef2e
parentb70c9d37f6b5e539798699ad4b48ed3fcd9ce282 (diff)
parent4a2e84c6ed85434ce7843e4844b4d3263f7e233b (diff)
Merge tag 'rpmsg-v4.18' of git://github.com/andersson/remoteproc
Pull rpmsg updates from Bjorn Andersson: "This migrates rpmsg to use SPDX license headers and fixes a use-after-free in SMD" * tag 'rpmsg-v4.18' of git://github.com/andersson/remoteproc: rpmsg: smd: do not use mananged resources for endpoints and channels rpmsg: char: Switch to SPDX license identifier rpmsg: glink: Switch to SPDX license identifier rpmsg: smd: Switch to SPDX license identifier rpmsg: virtio_rpmsg_bus: Switch to SPDX license identifier rpmsg: Switch to SPDX license identifier rpmsg: qcom_smd: Access APCS through mailbox framework rpmsg: Add driver_override device attribute for rpmsg_device
-rw-r--r--Documentation/ABI/testing/sysfs-bus-rpmsg20
-rw-r--r--Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt8
-rw-r--r--drivers/rpmsg/Kconfig3
-rw-r--r--drivers/rpmsg/qcom_glink_native.c10
-rw-r--r--drivers/rpmsg/qcom_glink_native.h10
-rw-r--r--drivers/rpmsg/qcom_glink_rpm.c10
-rw-r--r--drivers/rpmsg/qcom_glink_smem.c10
-rw-r--r--drivers/rpmsg/qcom_smd.c96
-rw-r--r--drivers/rpmsg/rpmsg_char.c10
-rw-r--r--drivers/rpmsg/rpmsg_core.c49
-rw-r--r--drivers/rpmsg/rpmsg_internal.h10
-rw-r--r--drivers/rpmsg/virtio_rpmsg_bus.c10
-rw-r--r--include/linux/rpmsg.h27
-rw-r--r--include/linux/rpmsg/qcom_glink.h2
-rw-r--r--include/uapi/linux/rpmsg.h9
15 files changed, 139 insertions, 145 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-rpmsg b/Documentation/ABI/testing/sysfs-bus-rpmsg
index 189e419a5a2d..990fcc420935 100644
--- a/Documentation/ABI/testing/sysfs-bus-rpmsg
+++ b/Documentation/ABI/testing/sysfs-bus-rpmsg
@@ -73,3 +73,23 @@ Description:
73 This sysfs entry tells us whether the channel is a local 73 This sysfs entry tells us whether the channel is a local
74 server channel that is announced (values are either 74 server channel that is announced (values are either
75 true or false). 75 true or false).
76
77What: /sys/bus/rpmsg/devices/.../driver_override
78Date: April 2018
79KernelVersion: 4.18
80Contact: Bjorn Andersson <bjorn.andersson@linaro.org>
81Description:
82 Every rpmsg device is a communication channel with a remote
83 processor. Channels are identified by a textual name (see
84 /sys/bus/rpmsg/devices/.../name above) and have a local
85 ("source") rpmsg address, and remote ("destination") rpmsg
86 address.
87
88 The listening entity (or client) which communicates with a
89 remote processor is referred as rpmsg driver. The rpmsg device
90 and rpmsg driver are matched based on rpmsg device name and
91 rpmsg driver ID table.
92
93 This sysfs entry allows the rpmsg driver for a rpmsg device
94 to be specified which will override standard OF, ID table
95 and name matching.
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt
index ea1dc75ec9ea..234ae2256501 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt
@@ -22,9 +22,15 @@ The edge is described by the following properties:
22 Definition: should specify the IRQ used by the remote processor to 22 Definition: should specify the IRQ used by the remote processor to
23 signal this processor about communication related updates 23 signal this processor about communication related updates
24 24
25- qcom,ipc: 25- mboxes:
26 Usage: required 26 Usage: required
27 Value type: <prop-encoded-array> 27 Value type: <prop-encoded-array>
28 Definition: reference to the associated doorbell in APCS, as described
29 in mailbox/mailbox.txt
30
31- qcom,ipc:
32 Usage: required, unless mboxes is specified
33 Value type: <prop-encoded-array>
28 Definition: three entries specifying the outgoing ipc bit used for 34 Definition: three entries specifying the outgoing ipc bit used for
29 signaling the remote processor: 35 signaling the remote processor:
30 - phandle to a syscon node representing the apcs registers 36 - phandle to a syscon node representing the apcs registers
diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
index 65a9f6b892f0..d0322b41eca5 100644
--- a/drivers/rpmsg/Kconfig
+++ b/drivers/rpmsg/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1menu "Rpmsg drivers" 3menu "Rpmsg drivers"
2 4
3# RPMSG always gets selected by whoever wants it 5# RPMSG always gets selected by whoever wants it
@@ -39,6 +41,7 @@ config RPMSG_QCOM_GLINK_SMEM
39 41
40config RPMSG_QCOM_SMD 42config RPMSG_QCOM_SMD
41 tristate "Qualcomm Shared Memory Driver (SMD)" 43 tristate "Qualcomm Shared Memory Driver (SMD)"
44 depends on MAILBOX
42 depends on QCOM_SMEM 45 depends on QCOM_SMEM
43 select RPMSG 46 select RPMSG
44 help 47 help
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 768ef542a841..f505f58b797d 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1,14 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (c) 2016-2017, Linaro Ltd 3 * Copyright (c) 2016-2017, Linaro Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */ 4 */
13 5
14#include <linux/idr.h> 6#include <linux/idr.h>
diff --git a/drivers/rpmsg/qcom_glink_native.h b/drivers/rpmsg/qcom_glink_native.h
index 0cae8a8199f8..624184fc458e 100644
--- a/drivers/rpmsg/qcom_glink_native.h
+++ b/drivers/rpmsg/qcom_glink_native.h
@@ -1,14 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (c) 2016-2017, Linaro Ltd 3 * Copyright (c) 2016-2017, Linaro Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */ 4 */
13 5
14#ifndef __QCOM_GLINK_NATIVE_H__ 6#ifndef __QCOM_GLINK_NATIVE_H__
diff --git a/drivers/rpmsg/qcom_glink_rpm.c b/drivers/rpmsg/qcom_glink_rpm.c
index 69b25d157d0f..f64f45d1a735 100644
--- a/drivers/rpmsg/qcom_glink_rpm.c
+++ b/drivers/rpmsg/qcom_glink_rpm.c
@@ -1,14 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (c) 2016-2017, Linaro Ltd 3 * Copyright (c) 2016-2017, Linaro Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */ 4 */
13 5
14#include <linux/idr.h> 6#include <linux/idr.h>
diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c
index 3fa9d43e2c87..2b5cf2790954 100644
--- a/drivers/rpmsg/qcom_glink_smem.c
+++ b/drivers/rpmsg/qcom_glink_smem.c
@@ -1,14 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (c) 2016, Linaro Ltd 3 * Copyright (c) 2016, Linaro Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */ 4 */
13 5
14#include <linux/io.h> 6#include <linux/io.h>
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 5ce9bf7b897d..6437bbeebc91 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -1,19 +1,12 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (c) 2015, Sony Mobile Communications AB. 3 * Copyright (c) 2015, Sony Mobile Communications AB.
3 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */ 5 */
14 6
15#include <linux/interrupt.h> 7#include <linux/interrupt.h>
16#include <linux/io.h> 8#include <linux/io.h>
9#include <linux/mailbox_client.h>
17#include <linux/mfd/syscon.h> 10#include <linux/mfd/syscon.h>
18#include <linux/module.h> 11#include <linux/module.h>
19#include <linux/of_irq.h> 12#include <linux/of_irq.h>
@@ -107,6 +100,8 @@ static const struct {
107 * @ipc_regmap: regmap handle holding the outgoing ipc register 100 * @ipc_regmap: regmap handle holding the outgoing ipc register
108 * @ipc_offset: offset within @ipc_regmap of the register for ipc 101 * @ipc_offset: offset within @ipc_regmap of the register for ipc
109 * @ipc_bit: bit in the register at @ipc_offset of @ipc_regmap 102 * @ipc_bit: bit in the register at @ipc_offset of @ipc_regmap
103 * @mbox_client: mailbox client handle
104 * @mbox_chan: apcs ipc mailbox channel handle
110 * @channels: list of all channels detected on this edge 105 * @channels: list of all channels detected on this edge
111 * @channels_lock: guard for modifications of @channels 106 * @channels_lock: guard for modifications of @channels
112 * @allocated: array of bitmaps representing already allocated channels 107 * @allocated: array of bitmaps representing already allocated channels
@@ -129,6 +124,9 @@ struct qcom_smd_edge {
129 int ipc_offset; 124 int ipc_offset;
130 int ipc_bit; 125 int ipc_bit;
131 126
127 struct mbox_client mbox_client;
128 struct mbox_chan *mbox_chan;
129
132 struct list_head channels; 130 struct list_head channels;
133 spinlock_t channels_lock; 131 spinlock_t channels_lock;
134 132
@@ -366,7 +364,17 @@ static void qcom_smd_signal_channel(struct qcom_smd_channel *channel)
366{ 364{
367 struct qcom_smd_edge *edge = channel->edge; 365 struct qcom_smd_edge *edge = channel->edge;
368 366
369 regmap_write(edge->ipc_regmap, edge->ipc_offset, BIT(edge->ipc_bit)); 367 if (edge->mbox_chan) {
368 /*
369 * We can ignore a failing mbox_send_message() as the only
370 * possible cause is that the FIFO in the framework is full of
371 * other writes to the same bit.
372 */
373 mbox_send_message(edge->mbox_chan, NULL);
374 mbox_client_txdone(edge->mbox_chan, 0);
375 } else {
376 regmap_write(edge->ipc_regmap, edge->ipc_offset, BIT(edge->ipc_bit));
377 }
370} 378}
371 379
372/* 380/*
@@ -1100,12 +1108,12 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed
1100 void *info; 1108 void *info;
1101 int ret; 1109 int ret;
1102 1110
1103 channel = devm_kzalloc(&edge->dev, sizeof(*channel), GFP_KERNEL); 1111 channel = kzalloc(sizeof(*channel), GFP_KERNEL);
1104 if (!channel) 1112 if (!channel)
1105 return ERR_PTR(-ENOMEM); 1113 return ERR_PTR(-ENOMEM);
1106 1114
1107 channel->edge = edge; 1115 channel->edge = edge;
1108 channel->name = devm_kstrdup(&edge->dev, name, GFP_KERNEL); 1116 channel->name = kstrdup(name, GFP_KERNEL);
1109 if (!channel->name) 1117 if (!channel->name)
1110 return ERR_PTR(-ENOMEM); 1118 return ERR_PTR(-ENOMEM);
1111 1119
@@ -1156,8 +1164,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed
1156 return channel; 1164 return channel;
1157 1165
1158free_name_and_channel: 1166free_name_and_channel:
1159 devm_kfree(&edge->dev, channel->name); 1167 kfree(channel->name);
1160 devm_kfree(&edge->dev, channel); 1168 kfree(channel);
1161 1169
1162 return ERR_PTR(ret); 1170 return ERR_PTR(ret);
1163} 1171}
@@ -1326,27 +1334,37 @@ static int qcom_smd_parse_edge(struct device *dev,
1326 key = "qcom,remote-pid"; 1334 key = "qcom,remote-pid";
1327 of_property_read_u32(node, key, &edge->remote_pid); 1335 of_property_read_u32(node, key, &edge->remote_pid);
1328 1336
1329 syscon_np = of_parse_phandle(node, "qcom,ipc", 0); 1337 edge->mbox_client.dev = dev;
1330 if (!syscon_np) { 1338 edge->mbox_client.knows_txdone = true;
1331 dev_err(dev, "no qcom,ipc node\n"); 1339 edge->mbox_chan = mbox_request_channel(&edge->mbox_client, 0);
1332 return -ENODEV; 1340 if (IS_ERR(edge->mbox_chan)) {
1333 } 1341 if (PTR_ERR(edge->mbox_chan) != -ENODEV)
1342 return PTR_ERR(edge->mbox_chan);
1334 1343
1335 edge->ipc_regmap = syscon_node_to_regmap(syscon_np); 1344 edge->mbox_chan = NULL;
1336 if (IS_ERR(edge->ipc_regmap))
1337 return PTR_ERR(edge->ipc_regmap);
1338 1345
1339 key = "qcom,ipc"; 1346 syscon_np = of_parse_phandle(node, "qcom,ipc", 0);
1340 ret = of_property_read_u32_index(node, key, 1, &edge->ipc_offset); 1347 if (!syscon_np) {
1341 if (ret < 0) { 1348 dev_err(dev, "no qcom,ipc node\n");
1342 dev_err(dev, "no offset in %s\n", key); 1349 return -ENODEV;
1343 return -EINVAL; 1350 }
1344 }
1345 1351
1346 ret = of_property_read_u32_index(node, key, 2, &edge->ipc_bit); 1352 edge->ipc_regmap = syscon_node_to_regmap(syscon_np);
1347 if (ret < 0) { 1353 if (IS_ERR(edge->ipc_regmap))
1348 dev_err(dev, "no bit in %s\n", key); 1354 return PTR_ERR(edge->ipc_regmap);
1349 return -EINVAL; 1355
1356 key = "qcom,ipc";
1357 ret = of_property_read_u32_index(node, key, 1, &edge->ipc_offset);
1358 if (ret < 0) {
1359 dev_err(dev, "no offset in %s\n", key);
1360 return -EINVAL;
1361 }
1362
1363 ret = of_property_read_u32_index(node, key, 2, &edge->ipc_bit);
1364 if (ret < 0) {
1365 dev_err(dev, "no bit in %s\n", key);
1366 return -EINVAL;
1367 }
1350 } 1368 }
1351 1369
1352 ret = of_property_read_string(node, "label", &edge->name); 1370 ret = of_property_read_string(node, "label", &edge->name);
@@ -1378,13 +1396,13 @@ static int qcom_smd_parse_edge(struct device *dev,
1378 */ 1396 */
1379static void qcom_smd_edge_release(struct device *dev) 1397static void qcom_smd_edge_release(struct device *dev)
1380{ 1398{
1381 struct qcom_smd_channel *channel; 1399 struct qcom_smd_channel *channel, *tmp;
1382 struct qcom_smd_edge *edge = to_smd_edge(dev); 1400 struct qcom_smd_edge *edge = to_smd_edge(dev);
1383 1401
1384 list_for_each_entry(channel, &edge->channels, list) { 1402 list_for_each_entry_safe(channel, tmp, &edge->channels, list) {
1385 SET_RX_CHANNEL_INFO(channel, state, SMD_CHANNEL_CLOSED); 1403 list_del(&channel->list);
1386 SET_RX_CHANNEL_INFO(channel, head, 0); 1404 kfree(channel->name);
1387 SET_RX_CHANNEL_INFO(channel, tail, 0); 1405 kfree(channel);
1388 } 1406 }
1389 1407
1390 kfree(edge); 1408 kfree(edge);
@@ -1453,6 +1471,9 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
1453 return edge; 1471 return edge;
1454 1472
1455unregister_dev: 1473unregister_dev:
1474 if (!IS_ERR_OR_NULL(edge->mbox_chan))
1475 mbox_free_channel(edge->mbox_chan);
1476
1456 device_unregister(&edge->dev); 1477 device_unregister(&edge->dev);
1457 return ERR_PTR(ret); 1478 return ERR_PTR(ret);
1458} 1479}
@@ -1481,6 +1502,7 @@ int qcom_smd_unregister_edge(struct qcom_smd_edge *edge)
1481 if (ret) 1502 if (ret)
1482 dev_warn(&edge->dev, "can't remove smd device: %d\n", ret); 1503 dev_warn(&edge->dev, "can't remove smd device: %d\n", ret);
1483 1504
1505 mbox_free_channel(edge->mbox_chan);
1484 device_unregister(&edge->dev); 1506 device_unregister(&edge->dev);
1485 1507
1486 return 0; 1508 return 0;
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 1efdf9ff8679..76a4477c6364 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (c) 2016, Linaro Ltd. 3 * Copyright (c) 2016, Linaro Ltd.
3 * Copyright (c) 2012, Michal Simek <monstr@monstr.eu> 4 * Copyright (c) 2012, Michal Simek <monstr@monstr.eu>
@@ -7,15 +8,6 @@
7 * 8 *
8 * Based on rpmsg performance statistics driver by Michal Simek, which in turn 9 * Based on rpmsg performance statistics driver by Michal Simek, which in turn
9 * was based on TI & Google OMX rpmsg driver. 10 * was based on TI & Google OMX rpmsg driver.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 and
13 * only version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 */ 11 */
20#include <linux/cdev.h> 12#include <linux/cdev.h>
21#include <linux/device.h> 13#include <linux/device.h>
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index 920a02f0462c..b714a543a91d 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * remote processor messaging bus 3 * remote processor messaging bus
3 * 4 *
@@ -6,15 +7,6 @@
6 * 7 *
7 * Ohad Ben-Cohen <ohad@wizery.com> 8 * Ohad Ben-Cohen <ohad@wizery.com>
8 * Brian Swetland <swetland@google.com> 9 * Brian Swetland <swetland@google.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */ 10 */
19 11
20#define pr_fmt(fmt) "%s: " fmt, __func__ 12#define pr_fmt(fmt) "%s: " fmt, __func__
@@ -333,11 +325,49 @@ field##_show(struct device *dev, \
333} \ 325} \
334static DEVICE_ATTR_RO(field); 326static DEVICE_ATTR_RO(field);
335 327
328#define rpmsg_string_attr(field, member) \
329static ssize_t \
330field##_store(struct device *dev, struct device_attribute *attr, \
331 const char *buf, size_t sz) \
332{ \
333 struct rpmsg_device *rpdev = to_rpmsg_device(dev); \
334 char *new, *old; \
335 \
336 new = kstrndup(buf, sz, GFP_KERNEL); \
337 if (!new) \
338 return -ENOMEM; \
339 new[strcspn(new, "\n")] = '\0'; \
340 \
341 device_lock(dev); \
342 old = rpdev->member; \
343 if (strlen(new)) { \
344 rpdev->member = new; \
345 } else { \
346 kfree(new); \
347 rpdev->member = NULL; \
348 } \
349 device_unlock(dev); \
350 \
351 kfree(old); \
352 \
353 return sz; \
354} \
355static ssize_t \
356field##_show(struct device *dev, \
357 struct device_attribute *attr, char *buf) \
358{ \
359 struct rpmsg_device *rpdev = to_rpmsg_device(dev); \
360 \
361 return sprintf(buf, "%s\n", rpdev->member); \
362} \
363static DEVICE_ATTR_RW(field)
364
336/* for more info, see Documentation/ABI/testing/sysfs-bus-rpmsg */ 365/* for more info, see Documentation/ABI/testing/sysfs-bus-rpmsg */
337rpmsg_show_attr(name, id.name, "%s\n"); 366rpmsg_show_attr(name, id.name, "%s\n");
338rpmsg_show_attr(src, src, "0x%x\n"); 367rpmsg_show_attr(src, src, "0x%x\n");
339rpmsg_show_attr(dst, dst, "0x%x\n"); 368rpmsg_show_attr(dst, dst, "0x%x\n");
340rpmsg_show_attr(announce, announce ? "true" : "false", "%s\n"); 369rpmsg_show_attr(announce, announce ? "true" : "false", "%s\n");
370rpmsg_string_attr(driver_override, driver_override);
341 371
342static ssize_t modalias_show(struct device *dev, 372static ssize_t modalias_show(struct device *dev,
343 struct device_attribute *attr, char *buf) 373 struct device_attribute *attr, char *buf)
@@ -359,6 +389,7 @@ static struct attribute *rpmsg_dev_attrs[] = {
359 &dev_attr_dst.attr, 389 &dev_attr_dst.attr,
360 &dev_attr_src.attr, 390 &dev_attr_src.attr,
361 &dev_attr_announce.attr, 391 &dev_attr_announce.attr,
392 &dev_attr_driver_override.attr,
362 NULL, 393 NULL,
363}; 394};
364ATTRIBUTE_GROUPS(rpmsg_dev); 395ATTRIBUTE_GROUPS(rpmsg_dev);
diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h
index 685aa70e9cbe..0d791c30b7ea 100644
--- a/drivers/rpmsg/rpmsg_internal.h
+++ b/drivers/rpmsg/rpmsg_internal.h
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * remote processor messaging bus internals 3 * remote processor messaging bus internals
3 * 4 *
@@ -6,15 +7,6 @@
6 * 7 *
7 * Ohad Ben-Cohen <ohad@wizery.com> 8 * Ohad Ben-Cohen <ohad@wizery.com>
8 * Brian Swetland <swetland@google.com> 9 * Brian Swetland <swetland@google.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */ 10 */
19 11
20#ifndef __RPMSG_INTERNAL_H__ 12#ifndef __RPMSG_INTERNAL_H__
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 82b83002fcba..664f957012cd 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Virtio-based remote processor messaging bus 3 * Virtio-based remote processor messaging bus
3 * 4 *
@@ -6,15 +7,6 @@
6 * 7 *
7 * Ohad Ben-Cohen <ohad@wizery.com> 8 * Ohad Ben-Cohen <ohad@wizery.com>
8 * Brian Swetland <swetland@google.com> 9 * Brian Swetland <swetland@google.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */ 10 */
19 11
20#define pr_fmt(fmt) "%s: " fmt, __func__ 12#define pr_fmt(fmt) "%s: " fmt, __func__
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
index ca07366c4c33..9fe156d1c018 100644
--- a/include/linux/rpmsg.h
+++ b/include/linux/rpmsg.h
@@ -1,35 +1,10 @@
1/* SPDX-License-Identifier: BSD-3-Clause */
1/* 2/*
2 * Remote processor messaging 3 * Remote processor messaging
3 * 4 *
4 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Copyright (C) 2011 Google, Inc. 6 * Copyright (C) 2011 Google, Inc.
6 * All rights reserved. 7 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name Texas Instruments nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 8 */
34 9
35#ifndef _LINUX_RPMSG_H 10#ifndef _LINUX_RPMSG_H
diff --git a/include/linux/rpmsg/qcom_glink.h b/include/linux/rpmsg/qcom_glink.h
index a622f029836e..96e26d94719f 100644
--- a/include/linux/rpmsg/qcom_glink.h
+++ b/include/linux/rpmsg/qcom_glink.h
@@ -1,3 +1,5 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
1#ifndef _LINUX_RPMSG_QCOM_GLINK_H 3#ifndef _LINUX_RPMSG_QCOM_GLINK_H
2#define _LINUX_RPMSG_QCOM_GLINK_H 4#define _LINUX_RPMSG_QCOM_GLINK_H
3 5
diff --git a/include/uapi/linux/rpmsg.h b/include/uapi/linux/rpmsg.h
index 225eb38705dc..e14c6dab4223 100644
--- a/include/uapi/linux/rpmsg.h
+++ b/include/uapi/linux/rpmsg.h
@@ -1,15 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (c) 2016, Linaro Ltd. 3 * Copyright (c) 2016, Linaro Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */ 4 */
14 5
15#ifndef _UAPI_RPMSG_H_ 6#ifndef _UAPI_RPMSG_H_