* Re: [PATCH] staging: typec: tcpm: Consider port_type while determining unattached_state
2017-08-10 22:06 [PATCH] staging: typec: tcpm: Consider port_type while determining unattached_state Badhri Jagan Sridharan
@ 2017-08-10 22:16 ` Badhri Jagan Sridharan
2017-08-11 23:42 ` kbuild test robot
2017-08-11 23:43 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: Badhri Jagan Sridharan @ 2017-08-10 22:16 UTC (permalink / raw)
To: Guenter Roeck, Greg Kroah-Hartman; +Cc: devel, LKML, Badhri Jagan Sridharan
Please hold off on reviewing this patch.
Patch went wrong while rebasing.
Thanks,
Badhri
On Thu, Aug 10, 2017 at 3:06 PM, Badhri Jagan Sridharan
<badhri@google.com> wrote:
> While performing PORT_RESET, upon receiving the cc disconnect
> signal from the underlaying tcpc device, TCPM transitions into
> unattached state. Consider, the current type of port while determining
> the unattached state.
>
> In the below logs, although the port_type was set to sink, TCPM
> transitioned into SRC_UNATTACHED.
>
> [ 762.290654] state change SRC_READY -> PORT_RESET
> [ 762.324531] Setting voltage/current limit 0 mV 0 mA
> [ 762.327912] polarity 0
> [ 762.334864] cc:=0
> [ 762.347193] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
> [ 762.347200] VBUS off
> [ 762.347203] CC1: 2 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
> [ 762.347206] state change PORT_RESET -> SRC_UNATTACHED
>
> Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
> ---
> drivers/staging/typec/tcpm.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
> index 20eb4ebcf8c3..4c526341d850 100644
> --- a/drivers/staging/typec/tcpm.c
> +++ b/drivers/staging/typec/tcpm.c
> @@ -2099,10 +2099,16 @@ static inline enum tcpm_state ready_state(struct tcpm_port *port)
>
> static inline enum tcpm_state unattached_state(struct tcpm_port *port)
> {
> - if (port->pwr_role == TYPEC_SOURCE)
> + if (port->port_type == TYPEC_PORT_DRP) {
> + if (port->pwr_role == TYPEC_SOURCE)
> + return SRC_UNATTACHED;
> + else
> + return SNK_UNATTACHED;
> + } else if (port->port_type == TYPEC_PORT_DFP) {
> return SRC_UNATTACHED;
> - else
> + } else {
> return SNK_UNATTACHED;
> + }
> }
>
> static void tcpm_check_send_discover(struct tcpm_port *port)
> --
> 2.14.0.434.g98096fd7a8-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: typec: tcpm: Consider port_type while determining unattached_state
2017-08-10 22:06 [PATCH] staging: typec: tcpm: Consider port_type while determining unattached_state Badhri Jagan Sridharan
2017-08-10 22:16 ` Badhri Jagan Sridharan
2017-08-11 23:42 ` kbuild test robot
@ 2017-08-11 23:43 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2017-08-11 23:43 UTC (permalink / raw)
To: Badhri Jagan Sridharan
Cc: kbuild-all, Guenter Roeck, Greg Kroah-Hartman, devel,
Badhri Jagan Sridharan, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 8227 bytes --]
Hi Badhri,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.13-rc4 next-20170811]
[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/Badhri-Jagan-Sridharan/staging-typec-tcpm-Consider-port_type-while-determining-unattached_state/20170812-071822
config: i386-randconfig-x019-201732 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/wait.h:6,
from include/linux/completion.h:11,
from drivers/staging/typec/tcpm.c:17:
drivers/staging/typec/tcpm.c: In function 'unattached_state':
drivers/staging/typec/tcpm.c:2101:10: error: 'struct tcpm_port' has no member named 'port_type'
if (port->port_type == TYPEC_PORT_DRP) {
^
include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers/staging/typec/tcpm.c:2101:2: note: in expansion of macro 'if'
if (port->port_type == TYPEC_PORT_DRP) {
^~
drivers/staging/typec/tcpm.c:2101:10: error: 'struct tcpm_port' has no member named 'port_type'
if (port->port_type == TYPEC_PORT_DRP) {
^
include/linux/compiler.h:156:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers/staging/typec/tcpm.c:2101:2: note: in expansion of macro 'if'
if (port->port_type == TYPEC_PORT_DRP) {
^~
drivers/staging/typec/tcpm.c:2101:10: error: 'struct tcpm_port' has no member named 'port_type'
if (port->port_type == TYPEC_PORT_DRP) {
^
include/linux/compiler.h:167:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^~~~
>> drivers/staging/typec/tcpm.c:2101:2: note: in expansion of macro 'if'
if (port->port_type == TYPEC_PORT_DRP) {
^~
drivers/staging/typec/tcpm.c:2106:17: error: 'struct tcpm_port' has no member named 'port_type'
} else if (port->port_type == TYPEC_PORT_DFP) {
^
include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
drivers/staging/typec/tcpm.c:2106:9: note: in expansion of macro 'if'
} else if (port->port_type == TYPEC_PORT_DFP) {
^~
drivers/staging/typec/tcpm.c:2106:17: error: 'struct tcpm_port' has no member named 'port_type'
} else if (port->port_type == TYPEC_PORT_DFP) {
^
include/linux/compiler.h:156:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
drivers/staging/typec/tcpm.c:2106:9: note: in expansion of macro 'if'
} else if (port->port_type == TYPEC_PORT_DFP) {
^~
drivers/staging/typec/tcpm.c:2106:17: error: 'struct tcpm_port' has no member named 'port_type'
} else if (port->port_type == TYPEC_PORT_DFP) {
^
include/linux/compiler.h:167:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^~~~
drivers/staging/typec/tcpm.c:2106:9: note: in expansion of macro 'if'
} else if (port->port_type == TYPEC_PORT_DFP) {
^~
drivers/staging/typec/tcpm.c: At top level:
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:390:2: note: in expansion of macro 'if'
if (p_size == (size_t)-1 && q_size == (size_t)-1)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:380:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:378:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:369:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:367:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:358:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:356:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:348:2: note: in expansion of macro 'if'
vim +/if +2101 drivers/staging/typec/tcpm.c
2098
2099 static inline enum tcpm_state unattached_state(struct tcpm_port *port)
2100 {
> 2101 if (port->port_type == TYPEC_PORT_DRP) {
2102 if (port->pwr_role == TYPEC_SOURCE)
2103 return SRC_UNATTACHED;
2104 else
2105 return SNK_UNATTACHED;
2106 } else if (port->port_type == TYPEC_PORT_DFP) {
2107 return SRC_UNATTACHED;
2108 } else {
2109 return SNK_UNATTACHED;
2110 }
2111 }
2112
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28018 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread