diff mbox

[v2,6/6] rpmsg: glink: Expose rpmsg name attr for glink

Message ID 1524708472-18263-7-git-send-email-clew@codeaurora.org (mailing list archive)
State Superseded
Headers show

Commit Message

Chris Lew April 26, 2018, 2:07 a.m. UTC
Expose the name field as an attr so clients listening to uevents for
rpmsg can identify the edge the events correspond to.

Signed-off-by: Chris Lew <clew@codeaurora.org>
---

Changes since v1:
- Add const to attribute struct
- Get name from glink channel

 drivers/rpmsg/qcom_glink_native.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

kernel test robot April 26, 2018, 10:15 p.m. UTC | #1
Hi Chris,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.17-rc2 next-20180426]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Lew/Add-chrdev-and-name-query-support-for-GLINK/20180427-023202
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-randconfig-x016-201816 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from include/linux/kobject.h:20:0,
                    from include/linux/irqdesc.h:6,
                    from include/linux/irq.h:517,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from drivers/rpmsg/qcom_glink_native.c:15:
>> drivers/rpmsg/qcom_glink_native.c:1569:18: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
    ATTRIBUTE_GROUPS(qcom_glink);
                     ^
   include/linux/sysfs.h:154:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
     .attrs = _name##_attrs,     \
              ^~~~~
   drivers/rpmsg/qcom_glink_native.c:1569:18: note: (near initialization for 'qcom_glink_group.attrs')
    ATTRIBUTE_GROUPS(qcom_glink);
                     ^
   include/linux/sysfs.h:154:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
     .attrs = _name##_attrs,     \
              ^~~~~
   cc1: some warnings being treated as errors

vim +1569 drivers/rpmsg/qcom_glink_native.c

  1564	
  1565	static const struct attribute *qcom_glink_attrs[] = {
  1566		&dev_attr_rpmsg_name.attr,
  1567		NULL
  1568	};
> 1569	ATTRIBUTE_GROUPS(qcom_glink);
  1570	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot April 27, 2018, 12:10 a.m. UTC | #2
Hi Chris,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.17-rc2 next-20180426]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Lew/Add-chrdev-and-name-query-support-for-GLINK/20180427-023202
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-randconfig-b0-04270034 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kobject.h:20:0,
                    from include/linux/irqdesc.h:6,
                    from include/linux/irq.h:517,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from drivers/rpmsg/qcom_glink_native.c:15:
>> include/linux/sysfs.h:153:21: warning: initialization from incompatible pointer type
    static const struct attribute_group _name##_group = {  \
                        ^
>> drivers/rpmsg/qcom_glink_native.c:1569:1: note: in expansion of macro 'ATTRIBUTE_GROUPS'
    ATTRIBUTE_GROUPS(qcom_glink);
    ^
   include/linux/sysfs.h:153:21: warning: (near initialization for 'qcom_glink_group.attrs')
    static const struct attribute_group _name##_group = {  \
                        ^
>> drivers/rpmsg/qcom_glink_native.c:1569:1: note: in expansion of macro 'ATTRIBUTE_GROUPS'
    ATTRIBUTE_GROUPS(qcom_glink);
    ^
--
   In file included from include/linux/kobject.h:20:0,
                    from include/linux/irqdesc.h:6,
                    from include/linux/irq.h:517,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from drivers//rpmsg/qcom_glink_native.c:15:
>> include/linux/sysfs.h:153:21: warning: initialization from incompatible pointer type
    static const struct attribute_group _name##_group = {  \
                        ^
   drivers//rpmsg/qcom_glink_native.c:1569:1: note: in expansion of macro 'ATTRIBUTE_GROUPS'
    ATTRIBUTE_GROUPS(qcom_glink);
    ^
   include/linux/sysfs.h:153:21: warning: (near initialization for 'qcom_glink_group.attrs')
    static const struct attribute_group _name##_group = {  \
                        ^
   drivers//rpmsg/qcom_glink_native.c:1569:1: note: in expansion of macro 'ATTRIBUTE_GROUPS'
    ATTRIBUTE_GROUPS(qcom_glink);
    ^

vim +/ATTRIBUTE_GROUPS +1569 drivers/rpmsg/qcom_glink_native.c

  1564	
  1565	static const struct attribute *qcom_glink_attrs[] = {
  1566		&dev_attr_rpmsg_name.attr,
  1567		NULL
  1568	};
> 1569	ATTRIBUTE_GROUPS(qcom_glink);
  1570	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot April 27, 2018, 1:24 a.m. UTC | #3
Hi Chris,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.17-rc2 next-20180426]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Lew/Add-chrdev-and-name-query-support-for-GLINK/20180427-023202
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   drivers/rpmsg/qcom_glink_native.c:624:16: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [usertype] id @@    got  short [unsigned] [usertype] id @@
   drivers/rpmsg/qcom_glink_native.c:624:16:    expected unsigned short [unsigned] [usertype] id
   drivers/rpmsg/qcom_glink_native.c:624:16:    got restricted __le16 [usertype] <noident>
   drivers/rpmsg/qcom_glink_native.c:625:18: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [usertype] lcid @@    got  short [unsigned] [usertype] lcid @@
   drivers/rpmsg/qcom_glink_native.c:625:18:    expected unsigned short [unsigned] [usertype] lcid
   drivers/rpmsg/qcom_glink_native.c:625:18:    got restricted __le16 [usertype] <noident>
   drivers/rpmsg/qcom_glink_native.c:626:19: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] count @@    got ed int [unsigned] [usertype] count @@
   drivers/rpmsg/qcom_glink_native.c:626:19:    expected unsigned int [unsigned] [usertype] count
   drivers/rpmsg/qcom_glink_native.c:626:19:    got restricted __le32 [usertype] <noident>
   drivers/rpmsg/qcom_glink_native.c:627:18: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] size @@    got ed int [unsigned] [usertype] size @@
   drivers/rpmsg/qcom_glink_native.c:627:18:    expected unsigned int [unsigned] [usertype] size
   drivers/rpmsg/qcom_glink_native.c:627:18:    got restricted __le32 [usertype] <noident>
   drivers/rpmsg/qcom_glink_native.c:628:18: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] liid @@    got ed int [unsigned] [usertype] liid @@
   drivers/rpmsg/qcom_glink_native.c:628:18:    expected unsigned int [unsigned] [usertype] liid
   drivers/rpmsg/qcom_glink_native.c:628:18:    got restricted __le32 [usertype] <noident>
>> drivers/rpmsg/qcom_glink_native.c:1569:1: sparse: incorrect type in initializer (different modifiers) @@    expected struct attribute **attrs @@    got structstruct attribute **attrs @@
   drivers/rpmsg/qcom_glink_native.c:1569:1:    expected struct attribute **attrs
   drivers/rpmsg/qcom_glink_native.c:1569:1:    got struct attribute const **<noident>
   In file included from include/linux/kobject.h:20:0,
                    from include/linux/irqdesc.h:6,
                    from include/linux/irq.h:517,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from drivers/rpmsg/qcom_glink_native.c:15:
   drivers/rpmsg/qcom_glink_native.c:1569:18: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
    ATTRIBUTE_GROUPS(qcom_glink);
                     ^
   include/linux/sysfs.h:154:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
     .attrs = _name##_attrs,     31-           ^~~~~
   drivers/rpmsg/qcom_glink_native.c:1569:18: note: (near initialization for 'qcom_glink_group.attrs')
    ATTRIBUTE_GROUPS(qcom_glink);
                     ^
   include/linux/sysfs.h:154:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
     .attrs = _name##_attrs,     37-           ^~~~~
   cc1: some warnings being treated as errors

vim +1569 drivers/rpmsg/qcom_glink_native.c

  1564	
  1565	static const struct attribute *qcom_glink_attrs[] = {
  1566		&dev_attr_rpmsg_name.attr,
  1567		NULL
  1568	};
> 1569	ATTRIBUTE_GROUPS(qcom_glink);
  1570	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 1418926f6110..72240614d4ca 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1552,6 +1552,22 @@  static void qcom_glink_work(struct work_struct *work)
 	}
 }
 
+static ssize_t rpmsg_name_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	struct rpmsg_device *rpdev = to_rpmsg_device(dev);
+	struct glink_channel *channel = to_glink_channel(rpdev->ept);
+
+	return snprintf(buf, RPMSG_NAME_SIZE, "%s\n", channel->glink->name);
+}
+static DEVICE_ATTR_RO(rpmsg_name);
+
+static const struct attribute *qcom_glink_attrs[] = {
+	&dev_attr_rpmsg_name.attr,
+	NULL
+};
+ATTRIBUTE_GROUPS(qcom_glink);
+
 static void qcom_glink_device_release(struct device *dev)
 {
 	struct rpmsg_device *rpdev = to_rpmsg_device(dev);
@@ -1601,6 +1617,8 @@  struct qcom_glink *qcom_glink_native_probe(struct device *dev,
 		return ERR_PTR(-ENOMEM);
 
 	glink->dev = dev;
+	glink->dev->groups = qcom_glink_groups;
+
 	glink->tx_pipe = tx;
 	glink->rx_pipe = rx;