Commit a826492
usb: typec: tcpm: fix create duplicate source-capabilities file
The kernel will dump in the below cases:
sysfs: cannot create duplicate filename
'/devices/virtual/usb_power_delivery/pd1/source-capabilities'
1. After soft reset has completed, an Explicit Contract negotiation occurs.
The sink device will receive source capabilitys again. This will cause
a duplicate source-capabilities file be created.
2. Power swap twice on a device that is initailly sink role.
This will unregister existing capabilities when above cases occurs.
Fixes: 8203d26 ("usb: typec: tcpm: Register USB Power Delivery Capabilities")
cc: <[email protected]>
Signed-off-by: Xu Yang <[email protected]>
Reviewed-by: Heikki Krogerus <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 6c67ed9 commit a826492
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4570 | 4570 | | |
4571 | 4571 | | |
4572 | 4572 | | |
| 4573 | + | |
| 4574 | + | |
| 4575 | + | |
4573 | 4576 | | |
4574 | 4577 | | |
4575 | 4578 | | |
| |||
4589 | 4592 | | |
4590 | 4593 | | |
4591 | 4594 | | |
| 4595 | + | |
| 4596 | + | |
| 4597 | + | |
4592 | 4598 | | |
4593 | 4599 | | |
4594 | 4600 | | |
| |||
4718 | 4724 | | |
4719 | 4725 | | |
4720 | 4726 | | |
| 4727 | + | |
| 4728 | + | |
| 4729 | + | |
4721 | 4730 | | |
4722 | 4731 | | |
4723 | 4732 | | |
| |||
0 commit comments