diff options
| author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2022-10-10 18:04:16 +0300 |
|---|---|---|
| committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2023-06-09 12:07:23 +0300 |
| commit | ef34add89ee4d1473bd0e78f551efa6fc1feb0cd (patch) | |
| tree | acf57061d08804de6c8f901e78ee94cdde70ede9 /drivers/thunderbolt/tmu.c | |
| parent | 4e7b4955cba13bb8b8f63400fbd28081f11179a7 (diff) | |
| download | linux-ef34add89ee4d1473bd0e78f551efa6fc1feb0cd.tar.gz linux-ef34add89ee4d1473bd0e78f551efa6fc1feb0cd.tar.bz2 linux-ef34add89ee4d1473bd0e78f551efa6fc1feb0cd.zip | |
thunderbolt: Check valid TMU configuration in tb_switch_tmu_configure()
Instead of at enable time we can do this already in
tb_switch_tmu_configure().
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tmu.c')
| -rw-r--r-- | drivers/thunderbolt/tmu.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c index 84abb783a6d9..be310d97ea7b 100644 --- a/drivers/thunderbolt/tmu.c +++ b/drivers/thunderbolt/tmu.c @@ -648,9 +648,6 @@ int tb_switch_tmu_enable(struct tb_switch *sw) bool unidirectional = sw->tmu.unidirectional_request; int ret; - if (unidirectional && !sw->tmu.has_ucap) - return -EOPNOTSUPP; - /* * No need to enable TMU on devices that don't support CLx since on * these devices e.g. Alpine Ridge and earlier, the TMU mode HiFi @@ -724,10 +721,16 @@ int tb_switch_tmu_enable(struct tb_switch *sw) * * Selects the rate of the TMU and directionality (uni-directional or * bi-directional). Must be called before tb_switch_tmu_enable(). + * + * Returns %0 in success and negative errno otherwise. */ -void tb_switch_tmu_configure(struct tb_switch *sw, - enum tb_switch_tmu_rate rate, bool unidirectional) +int tb_switch_tmu_configure(struct tb_switch *sw, enum tb_switch_tmu_rate rate, + bool unidirectional) { + if (unidirectional && !sw->tmu.has_ucap) + return -EINVAL; + sw->tmu.unidirectional_request = unidirectional; sw->tmu.rate_request = rate; + return 0; } |
