Re: [peter.chen-usb:pwrseq-lib 2/10] drivers/power/pwrseq/core.c:62:6: error: redefinition of 'pwrseq_register'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 06, 2017 at 07:03:41PM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git pwrseq-lib
> head:   06903db00af7968ff4960ab380c45a7788fee1d5
> commit: 778d7e6997538601e8ad364188bf007768922bd4 [2/10] power: add power sequence library
> config: x86_64-lkp (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         git checkout 778d7e6997538601e8ad364188bf007768922bd4
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 

The problem of this issue is I added IS_ENABLE(CONFIG_OF) at
below patches at v12 wrongly, so if the platform does
not define OF, it will has below redefinition error.
I will fix it at v13.

+#if IS_ENABLED(CONFIG_POWER_SEQUENCE) && IS_ENABLED(CONFIG_OF)
+void pwrseq_register(struct pwrseq *pwrseq);
+void pwrseq_unregister(struct pwrseq *pwrseq);
+struct pwrseq *of_pwrseq_on(struct device_node *np);
+void of_pwrseq_off(struct pwrseq *pwrseq);
+int of_pwrseq_on_list(struct device_node *np, struct list_head
		*head);
+void of_pwrseq_off_list(struct list_head *head);
+int pwrseq_suspend(struct pwrseq *p);
+int pwrseq_resume(struct pwrseq *p);
+int pwrseq_suspend_list(struct list_head *head);
+int pwrseq_resume_list(struct list_head *head);
+#else
+static inline void pwrseq_register(struct pwrseq *pwrseq) {}
+static inline void pwrseq_unregister(struct pwrseq *pwrseq) {}
+static inline struct pwrseq *of_pwrseq_on(struct device_node
		*np)
+{
+       return NULL;
+}
...
+#endif

> All errors (new ones prefixed by >>):
> 
> >> drivers/power/pwrseq/core.c:62:6: error: redefinition of 'pwrseq_register'
>     void pwrseq_register(struct pwrseq *pwrseq)
>          ^~~~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:51:20: note: previous definition of 'pwrseq_register' was here
>     static inline void pwrseq_register(struct pwrseq *pwrseq) {}
>                        ^~~~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:75:6: error: redefinition of 'pwrseq_unregister'
>     void pwrseq_unregister(struct pwrseq *pwrseq)
>          ^~~~~~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:52:20: note: previous definition of 'pwrseq_unregister' was here
>     static inline void pwrseq_unregister(struct pwrseq *pwrseq) {}
>                        ^~~~~~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:126:16: error: redefinition of 'of_pwrseq_on'
>     struct pwrseq *of_pwrseq_on(struct device_node *np)
>                    ^~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:53:30: note: previous definition of 'of_pwrseq_on' was here
>     static inline struct pwrseq *of_pwrseq_on(struct device_node *np)
>                                  ^~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:162:6: error: redefinition of 'of_pwrseq_off'
>     void of_pwrseq_off(struct pwrseq *pwrseq)
>          ^~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:57:13: note: previous definition of 'of_pwrseq_off' was here
>     static void of_pwrseq_off(struct pwrseq *pwrseq) {}
>                 ^~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:183:5: error: redefinition of 'of_pwrseq_on_list'
>     int of_pwrseq_on_list(struct device_node *np, struct list_head *head)
>         ^~~~~~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:58:12: note: previous definition of 'of_pwrseq_on_list' was here
>     static int of_pwrseq_on_list(struct device_node *np, struct list_head *head)
>                ^~~~~~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:214:6: error: redefinition of 'of_pwrseq_off_list'
>     void of_pwrseq_off_list(struct list_head *head)
>          ^~~~~~~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:62:13: note: previous definition of 'of_pwrseq_off_list' was here
>     static void of_pwrseq_off_list(struct list_head *head) {}
>                 ^~~~~~~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:237:5: error: redefinition of 'pwrseq_suspend'
>     int pwrseq_suspend(struct pwrseq *p)
>         ^~~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:63:12: note: previous definition of 'pwrseq_suspend' was here
>     static int pwrseq_suspend(struct pwrseq *p)
>                ^~~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:264:5: error: redefinition of 'pwrseq_resume'
>     int pwrseq_resume(struct pwrseq *p)
>         ^~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:67:12: note: previous definition of 'pwrseq_resume' was here
>     static int pwrseq_resume(struct pwrseq *p)
>                ^~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:290:5: error: redefinition of 'pwrseq_suspend_list'
>     int pwrseq_suspend_list(struct list_head *head)
>         ^~~~~~~~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:71:12: note: previous definition of 'pwrseq_suspend_list' was here
>     static int pwrseq_suspend_list(struct list_head *head)
>                ^~~~~~~~~~~~~~~~~~~
> >> drivers/power/pwrseq/core.c:322:5: error: redefinition of 'pwrseq_resume_list'
>     int pwrseq_resume_list(struct list_head *head)
>         ^~~~~~~~~~~~~~~~~~
>    In file included from drivers/power/pwrseq/core.c:24:0:
>    include/linux/power/pwrseq.h:75:12: note: previous definition of 'pwrseq_resume_list' was here
>     static int pwrseq_resume_list(struct list_head *head)
>                ^~~~~~~~~~~~~~~~~~
>    include/linux/power/pwrseq.h:75:12: warning: 'pwrseq_resume_list' defined but not used [-Wunused-function]
>    include/linux/power/pwrseq.h:71:12: warning: 'pwrseq_suspend_list' defined but not used [-Wunused-function]
>     static int pwrseq_suspend_list(struct list_head *head)
>                ^~~~~~~~~~~~~~~~~~~
>    include/linux/power/pwrseq.h:67:12: warning: 'pwrseq_resume' defined but not used [-Wunused-function]
>     static int pwrseq_resume(struct pwrseq *p)
>                ^~~~~~~~~~~~~
>    include/linux/power/pwrseq.h:63:12: warning: 'pwrseq_suspend' defined but not used [-Wunused-function]
>     static int pwrseq_suspend(struct pwrseq *p)
>                ^~~~~~~~~~~~~~
>    include/linux/power/pwrseq.h:62:13: warning: 'of_pwrseq_off_list' defined but not used [-Wunused-function]
>     static void of_pwrseq_off_list(struct list_head *head) {}
>                 ^~~~~~~~~~~~~~~~~~
>    include/linux/power/pwrseq.h:58:12: warning: 'of_pwrseq_on_list' defined but not used [-Wunused-function]
>     static int of_pwrseq_on_list(struct device_node *np, struct list_head *head)
>                ^~~~~~~~~~~~~~~~~
>    include/linux/power/pwrseq.h:57:13: warning: 'of_pwrseq_off' defined but not used [-Wunused-function]
>     static void of_pwrseq_off(struct pwrseq *pwrseq) {}
>                 ^~~~~~~~~~~~~
> 
> vim +/pwrseq_register +62 drivers/power/pwrseq/core.c
> 
>     56	
>     57	/**
>     58	 * pwrseq_register - Add pwrseq instance to global pwrseq list
>     59	 *
>     60	 * @pwrseq: the pwrseq instance
>     61	 */
>   > 62	void pwrseq_register(struct pwrseq *pwrseq)
>     63	{
>     64		mutex_lock(&pwrseq_list_mutex);
>     65		list_add(&pwrseq->node, &pwrseq_list);
>     66		mutex_unlock(&pwrseq_list_mutex);
>     67	}
>     68	EXPORT_SYMBOL_GPL(pwrseq_register);
>     69	
>     70	/**
>     71	 * pwrseq_unregister - Remove pwrseq instance from global pwrseq list
>     72	 *
>     73	 * @pwrseq: the pwrseq instance
>     74	 */
>   > 75	void pwrseq_unregister(struct pwrseq *pwrseq)
>     76	{
>     77		mutex_lock(&pwrseq_list_mutex);
>     78		list_del(&pwrseq->node);
>     79		mutex_unlock(&pwrseq_list_mutex);
>     80	}
>     81	EXPORT_SYMBOL_GPL(pwrseq_unregister);
>     82	
>     83	static struct pwrseq *pwrseq_find_available_instance(struct device_node *np)
>     84	{
>     85		struct pwrseq *pwrseq;
>     86	
>     87		mutex_lock(&pwrseq_list_mutex);
>     88		list_for_each_entry(pwrseq, &pwrseq_list, node) {
>     89			if (pwrseq->used)
>     90				continue;
>     91	
>     92			/* compare compatible string for pwrseq node */
>     93			if (of_match_node(pwrseq->pwrseq_of_match_table, np)) {
>     94				pwrseq->used = true;
>     95				mutex_unlock(&pwrseq_list_mutex);
>     96				return pwrseq;
>     97			}
>     98	
>     99			/* return generic pwrseq instance */
>    100			if (!strcmp(pwrseq->pwrseq_of_match_table->compatible,
>    101					"generic")) {
>    102				pr_debug("using generic pwrseq instance for %s\n",
>    103					np->full_name);
>    104				pwrseq->used = true;
>    105				mutex_unlock(&pwrseq_list_mutex);
>    106				return pwrseq;
>    107			}
>    108		}
>    109		mutex_unlock(&pwrseq_list_mutex);
>    110		pr_debug("Can't find any pwrseq instances for %s\n", np->full_name);
>    111	
>    112		return NULL;
>    113	}
>    114	
>    115	/**
>    116	 * of_pwrseq_on - Carry out power sequence on for device node
>    117	 *
>    118	 * @np: the device node would like to power on
>    119	 *
>    120	 * Carry out a single device power on.  If multiple devices
>    121	 * need to be handled, use of_pwrseq_on_list() instead.
>    122	 *
>    123	 * Return a pointer to the power sequence instance on success,
>    124	 * or an error code otherwise.
>    125	 */
>  > 126	struct pwrseq *of_pwrseq_on(struct device_node *np)
>    127	{
>    128		struct pwrseq *pwrseq;
>    129		int ret;
>    130	
>    131		pwrseq = pwrseq_find_available_instance(np);
>    132		if (!pwrseq)
>    133			return ERR_PTR(-ENOENT);
>    134	
>    135		ret = pwrseq_get(np, pwrseq);
>    136		if (ret) {
>    137			/* Mark current pwrseq as unused */
>    138			pwrseq->used = false;
>    139			return ERR_PTR(ret);
>    140		}
>    141	
>    142		ret = pwrseq_on(pwrseq);
>    143		if (ret)
>    144			goto pwr_put;
>    145	
>    146		return pwrseq;
>    147	
>    148	pwr_put:
>    149		pwrseq_put(pwrseq);
>    150		return ERR_PTR(ret);
>    151	}
>    152	EXPORT_SYMBOL_GPL(of_pwrseq_on);
>    153	
>    154	/**
>    155	 * of_pwrseq_off - Carry out power sequence off for this pwrseq instance
>    156	 *
>    157	 * @pwrseq: the pwrseq instance which related device would like to be off
>    158	 *
>    159	 * This API is used to power off single device, it is the opposite
>    160	 * operation for of_pwrseq_on.
>    161	 */
>  > 162	void of_pwrseq_off(struct pwrseq *pwrseq)
>    163	{
>    164		pwrseq_off(pwrseq);
>    165		pwrseq_put(pwrseq);
>    166	}
>    167	EXPORT_SYMBOL_GPL(of_pwrseq_off);
>    168	
>    169	/**
>    170	 * of_pwrseq_on_list - Carry out power sequence on for list
>    171	 *
>    172	 * @np: the device node would like to power on
>    173	 * @head: the list head for pwrseq list on this bus
>    174	 *
>    175	 * This API is used to power on multiple devices at single bus.
>    176	 * If there are several devices on bus (eg, USB bus), uses this
>    177	 * this API. Otherwise, use of_pwrseq_on instead. After the device
>    178	 * is powered on successfully, it will be added to pwrseq list for
>    179	 * this bus. The caller needs to use mutex_lock for concurrent.
>    180	 *
>    181	 * Return 0 on success, or an error value otherwise.
>    182	 */
>  > 183	int of_pwrseq_on_list(struct device_node *np, struct list_head *head)
>    184	{
>    185		struct pwrseq *pwrseq;
>    186		struct pwrseq_list_per_dev *pwrseq_list_node;
>    187	
>    188		pwrseq_list_node = kzalloc(sizeof(*pwrseq_list_node), GFP_KERNEL);
>    189		if (!pwrseq_list_node)
>    190			return -ENOMEM;
>    191	
>    192		pwrseq = of_pwrseq_on(np);
>    193		if (IS_ERR(pwrseq)) {
>    194			kfree(pwrseq_list_node);
>    195			return PTR_ERR(pwrseq);
>    196		}
>    197	
>    198		pwrseq_list_node->pwrseq = pwrseq;
>    199		list_add(&pwrseq_list_node->list, head);
>    200	
>    201		return 0;
>    202	}
>    203	EXPORT_SYMBOL_GPL(of_pwrseq_on_list);
>    204	
>    205	/**
>    206	 * of_pwrseq_off_list - Carry out power sequence off for the list
>    207	 *
>    208	 * @head: the list head for pwrseq instance list on this bus
>    209	 *
>    210	 * This API is used to power off all devices on this bus, it is
>    211	 * the opposite operation for of_pwrseq_on_list.
>    212	 * The caller needs to use mutex_lock for concurrent.
>    213	 */
>  > 214	void of_pwrseq_off_list(struct list_head *head)
>    215	{
>    216		struct pwrseq *pwrseq;
>    217		struct pwrseq_list_per_dev *pwrseq_list_node, *tmp_node;
>    218	
>    219		list_for_each_entry_safe(pwrseq_list_node, tmp_node, head, list) {
>    220			pwrseq = pwrseq_list_node->pwrseq;
>    221			of_pwrseq_off(pwrseq);
>    222			list_del(&pwrseq_list_node->list);
>    223			kfree(pwrseq_list_node);
>    224		}
>    225	}
>    226	EXPORT_SYMBOL_GPL(of_pwrseq_off_list);
>    227	
>    228	/**
>    229	 * pwrseq_suspend - Carry out power sequence suspend for this pwrseq instance
>    230	 *
>    231	 * @pwrseq: the pwrseq instance
>    232	 *
>    233	 * This API is used to do suspend operation on pwrseq instance.
>    234	 *
>    235	 * Return 0 on success, or an error value otherwise.
>    236	 */
>  > 237	int pwrseq_suspend(struct pwrseq *p)
>    238	{
>    239		int ret = 0;
>    240	
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux