Skip to contentSkip to conversation

USB: core: fix missing include <linux/usb/of.h>

PATCH In review Ben Dooks 5 participants 8 messages Jun 7, 2016 – Jun 17, 2016 USB

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 USB: core: fix missing include <linux/usb/of.h>

The helper function usb_of_get_child_node() is defined in the header <linux/usb/of.h> but this was not included. Fix the warning about usb_of_get_child_node() not being declared by adding the right include. Fixes:

drivers/usb/core/of.c:31:20: warning: symbol 'usb_of_get_child_node' was not declared. Should it be static?

---
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: Peter Chen <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/usb/core/of.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/core/of.c +1 -0
index 2289700..3de4f88 100644
@@ -18,6 +18,7 @@
  */
 
 #include <linux/of.h>
+#include <linux/usb/of.h>
 
 /**
  * usb_of_get_child_node - Find the device node match port number
Signature · 1 line
2.8.1
#1 lore raw
reproduce:

Hi,

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.7-rc2 next-20160607]
[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/Ben-Dooks/USB-core-fix-missing-include-linux-usb-of-h/20160608-022844
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-defconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> drivers/usb/core/of.c:32:21: error: redefinition of 'usb_of_get_child_node'

struct device_node *usb_of_get_child_node(struct device_node *parent,
^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/core/of.c:21:0:
include/linux/usb/of.h:36:35: note: previous definition of 'usb_of_get_child_node' was here
static inline struct device_node *usb_of_get_child_node
^~~~~~~~~~~~~~~~~~~~~

vim +/usb_of_get_child_node +32 drivers/usb/core/of.c

69bec725 Peter Chen 2016-02-19  26   * @portnum: the port number which device is connecting
69bec725 Peter Chen 2016-02-19  27   *
69bec725 Peter Chen 2016-02-19  28   * Find the node from device tree according to its port number.
69bec725 Peter Chen 2016-02-19  29   *
69bec725 Peter Chen 2016-02-19  30   * Return: On success, a pointer to the device node, %NULL on failure.
69bec725 Peter Chen 2016-02-19  31   */
69bec725 Peter Chen 2016-02-19 @32  struct device_node *usb_of_get_child_node(struct device_node *parent,
69bec725 Peter Chen 2016-02-19  33  					int portnum)
69bec725 Peter Chen 2016-02-19  34  {
69bec725 Peter Chen 2016-02-19  35  	struct device_node *node;

:::::: The code at line 32 was first introduced by commit
:::::: 69bec725985324e79b1c47ea287815ac4ddb0521 USB: core: let USB device know device node

:::::: TO: Peter Chen <[email protected]> :::::: CC: Greg Kroah-Hartman <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#7 lore raw
In reply to Ben Dooks
Quoted 8 lines · Ben Dooks

The helper function usb_of_get_child_node() is defined in the header <linux/usb/of.h> but this was not included. Fix the warning about usb_of_get_child_node() not being declared by adding the right include. Fixes:

drivers/usb/core/of.c:31:20: warning: symbol 'usb_of_get_child_node' was not declared. Should it be static?

Given that the kbuild robot broke with this patch, I'm not going to take it...

#2 lore raw
In reply to kbuild test robot
Quoted 10 lines · CEST kbuild test robot
Quoted 1 line
Quoted 1 line

drivers/usb/core/of.c:32:21: error: redefinition of 'usb_of_get_child_node'

struct device_node *usb_of_get_child_node(struct device_node *parent,
^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/core/of.c:21:0:
include/linux/usb/of.h:36:35: note: previous definition of 'usb_of_get_child_node' was here
static inline struct device_node *usb_of_get_child_node
^~~~~~~~~~~~~~~~~~~~~

vim +/usb_of_get_child_node +32 drivers/usb/core/of.c

Quoted 12 lines
69bec725 Peter Chen 2016-02-19  26   * @portnum: the port number which device is connecting
69bec725 Peter Chen 2016-02-19  27   *
69bec725 Peter Chen 2016-02-19  28   * Find the node from device tree according to its port number.
69bec725 Peter Chen 2016-02-19  29   *
69bec725 Peter Chen 2016-02-19  30   * Return: On success, a pointer to the device node, %NULL on failure.
69bec725 Peter Chen 2016-02-19  31   */
69bec725 Peter Chen 2016-02-19 @32  struct device_node *usb_of_get_child_node(struct device_node *parent,
69bec725 Peter Chen 2016-02-19  33                                      int portnum)
69bec725 Peter Chen 2016-02-19  34  {
69bec725 Peter Chen 2016-02-19  35      struct device_node *node;

I think what we want here is to make the compilation of of.o conditional on CONFIG_OF, so we get only one of the two definitions.

Arnd

#3 lore raw
Quoted 24 lines · Arnd Bergmann
Quoted 10 lines · CEST kbuild test robot
Quoted 1 line
Quoted 1 line

drivers/usb/core/of.c:32:21: error: redefinition of 'usb_of_get_child_node'

struct device_node *usb_of_get_child_node(struct device_node *parent,
^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/core/of.c:21:0:
include/linux/usb/of.h:36:35: note: previous definition of 'usb_of_get_child_node' was here
static inline struct device_node *usb_of_get_child_node
^~~~~~~~~~~~~~~~~~~~~

vim +/usb_of_get_child_node +32 drivers/usb/core/of.c

Quoted 12 lines
69bec725 Peter Chen 2016-02-19  26   * @portnum: the port number which device is connecting
69bec725 Peter Chen 2016-02-19  27   *
69bec725 Peter Chen 2016-02-19  28   * Find the node from device tree according to its port number.
69bec725 Peter Chen 2016-02-19  29   *
69bec725 Peter Chen 2016-02-19  30   * Return: On success, a pointer to the device node, %NULL on failure.
69bec725 Peter Chen 2016-02-19  31   */
69bec725 Peter Chen 2016-02-19 @32  struct device_node *usb_of_get_child_node(struct device_node *parent,
69bec725 Peter Chen 2016-02-19  33                                      int portnum)
69bec725 Peter Chen 2016-02-19  34  {
69bec725 Peter Chen 2016-02-19  35      struct device_node *node;
Quoted 4 lines

I think what we want here is to make the compilation of of.o conditional on CONFIG_OF, so we get only one of the two definitions.

Arnd

Thanks, Arnd. It is the correct solution, I will send patch soon.

Signature · 2 lines
Best Regards,
Peter Chen
author
#4 lore raw
Quoted 25 lines · Peter Chen
Quoted 24 lines · Arnd Bergmann
Quoted 22 lines · CEST kbuild test robot
Quoted 1 line
Quoted 1 line

drivers/usb/core/of.c:32:21: error: redefinition of 'usb_of_get_child_node'

struct device_node *usb_of_get_child_node(struct device_node *parent,
^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/core/of.c:21:0:
include/linux/usb/of.h:36:35: note: previous definition of 'usb_of_get_child_node' was here
static inline struct device_node *usb_of_get_child_node
^~~~~~~~~~~~~~~~~~~~~

vim +/usb_of_get_child_node +32 drivers/usb/core/of.c

69bec725 Peter Chen 2016-02-19  26   * @portnum: the port number which device is connecting
69bec725 Peter Chen 2016-02-19  27   *
69bec725 Peter Chen 2016-02-19  28   * Find the node from device tree according to its port number.
69bec725 Peter Chen 2016-02-19  29   *
69bec725 Peter Chen 2016-02-19  30   * Return: On success, a pointer to the device node, %NULL on failure.
69bec725 Peter Chen 2016-02-19  31   */
69bec725 Peter Chen 2016-02-19 @32  struct device_node *usb_of_get_child_node(struct device_node *parent,
69bec725 Peter Chen 2016-02-19  33                                      int portnum)
69bec725 Peter Chen 2016-02-19  34  {
69bec725 Peter Chen 2016-02-19  35      struct device_node *node;
Quoted 6 lines
Quoted 4 lines

I think what we want here is to make the compilation of of.o conditional on CONFIG_OF, so we get only one of the two definitions.

Arnd

Thanks, Arnd. It is the correct solution, I will send patch soon.

Aha, I didn't think of that. Thanks.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
author
#5 lore raw
In reply to Arnd Bergmann
Quoted 24 lines · Arnd Bergmann
Quoted 10 lines · CEST kbuild test robot
Quoted 1 line
Quoted 1 line

drivers/usb/core/of.c:32:21: error: redefinition of 'usb_of_get_child_node'

struct device_node *usb_of_get_child_node(struct device_node *parent,
^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/core/of.c:21:0:
include/linux/usb/of.h:36:35: note: previous definition of 'usb_of_get_child_node' was here
static inline struct device_node *usb_of_get_child_node
^~~~~~~~~~~~~~~~~~~~~

vim +/usb_of_get_child_node +32 drivers/usb/core/of.c

Quoted 12 lines
69bec725 Peter Chen 2016-02-19  26   * @portnum: the port number which device is connecting
69bec725 Peter Chen 2016-02-19  27   *
69bec725 Peter Chen 2016-02-19  28   * Find the node from device tree according to its port number.
69bec725 Peter Chen 2016-02-19  29   *
69bec725 Peter Chen 2016-02-19  30   * Return: On success, a pointer to the device node, %NULL on failure.
69bec725 Peter Chen 2016-02-19  31   */
69bec725 Peter Chen 2016-02-19 @32  struct device_node *usb_of_get_child_node(struct device_node *parent,
69bec725 Peter Chen 2016-02-19  33                                      int portnum)
69bec725 Peter Chen 2016-02-19  34  {
69bec725 Peter Chen 2016-02-19  35      struct device_node *node;
Quoted 2 lines

I think what we want here is to make the compilation of of.o conditional on CONFIG_OF, so we get only one of the two definitions.

Ah, so make the of.o conditional, and also apply my patch for when it is compiled.

Should I submit one for that, or is someone else on the case?

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#6 lore raw
Quoted 25 lines · Ben Dooks
Quoted 24 lines · Arnd Bergmann
Quoted 22 lines · CEST kbuild test robot
Quoted 1 line
Quoted 1 line

drivers/usb/core/of.c:32:21: error: redefinition of 'usb_of_get_child_node'

struct device_node *usb_of_get_child_node(struct device_node *parent,
^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/core/of.c:21:0:
include/linux/usb/of.h:36:35: note: previous definition of 'usb_of_get_child_node' was here
static inline struct device_node *usb_of_get_child_node
^~~~~~~~~~~~~~~~~~~~~

vim +/usb_of_get_child_node +32 drivers/usb/core/of.c

69bec725 Peter Chen 2016-02-19  26   * @portnum: the port number which device is connecting
69bec725 Peter Chen 2016-02-19  27   *
69bec725 Peter Chen 2016-02-19  28   * Find the node from device tree according to its port number.
69bec725 Peter Chen 2016-02-19  29   *
69bec725 Peter Chen 2016-02-19  30   * Return: On success, a pointer to the device node, %NULL on failure.
69bec725 Peter Chen 2016-02-19  31   */
69bec725 Peter Chen 2016-02-19 @32  struct device_node *usb_of_get_child_node(struct device_node *parent,
69bec725 Peter Chen 2016-02-19  33                                      int portnum)
69bec725 Peter Chen 2016-02-19  34  {
69bec725 Peter Chen 2016-02-19  35      struct device_node *node;
Quoted 8 lines
Quoted 2 lines

I think what we want here is to make the compilation of of.o conditional on CONFIG_OF, so we get only one of the two definitions.

Ah, so make the of.o conditional, and also apply my patch for when it is compiled.

Should I submit one for that, or is someone else on the case?

Yes, Ben. I have already done it.

http://www.spinics.net/lists/linux-usb/msg142676.html

Signature · 2 lines
Best Regards,
Peter Chen