* [PATCH] dmaengine: idxd: correct reserved token calculation
@ 2020-02-18 16:51 Dave Jiang
2020-02-19 9:19 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2020-02-18 16:51 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, jerry.t.chen
The calcuation for limit of reserved token did not take into account the
change the user wanted vs the current group reserved token. This causes
changing of the reserved token to be possible only after we set the value
of the reserved token back to 0. Fix calculation so we can set a value that
is non zero for reserved token.
Fixes: c52ca478233c ("dmaengine: idxd: add configuration component of driver")
Reported-by: Jerry Chen <jerry.t.chen@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
drivers/dma/idxd/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index 298855ca934f..edbfe83325eb 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -519,7 +519,7 @@ static ssize_t group_tokens_reserved_store(struct device *dev,
if (val > idxd->max_tokens)
return -EINVAL;
- if (val > idxd->nr_tokens)
+ if (val > idxd->nr_tokens + group->tokens_reserved)
return -EINVAL;
group->tokens_reserved = val;
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] dmaengine: idxd: correct reserved token calculation
2020-02-18 16:51 [PATCH] dmaengine: idxd: correct reserved token calculation Dave Jiang
@ 2020-02-19 9:19 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-02-19 9:19 UTC (permalink / raw)
To: Dave Jiang; +Cc: dmaengine, jerry.t.chen
On 18-02-20, 09:51, Dave Jiang wrote:
> The calcuation for limit of reserved token did not take into account the
> change the user wanted vs the current group reserved token. This causes
> changing of the reserved token to be possible only after we set the value
> of the reserved token back to 0. Fix calculation so we can set a value that
> is non zero for reserved token.
>
> Fixes: c52ca478233c ("dmaengine: idxd: add configuration component of driver")
>
You don't need empty line here
> Reported-by: Jerry Chen <jerry.t.chen@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Applied after removing the empty line, thanks
> ---
> drivers/dma/idxd/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
> index 298855ca934f..edbfe83325eb 100644
> --- a/drivers/dma/idxd/sysfs.c
> +++ b/drivers/dma/idxd/sysfs.c
> @@ -519,7 +519,7 @@ static ssize_t group_tokens_reserved_store(struct device *dev,
> if (val > idxd->max_tokens)
> return -EINVAL;
>
> - if (val > idxd->nr_tokens)
> + if (val > idxd->nr_tokens + group->tokens_reserved)
> return -EINVAL;
>
> group->tokens_reserved = val;
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-19 9:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18 16:51 [PATCH] dmaengine: idxd: correct reserved token calculation Dave Jiang
2020-02-19 9:19 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox