[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50ba7cd8-0e14-d8b7-a10c-5dee17946722@linux.intel.com>
Date: Tue, 3 Apr 2018 14:00:29 +0800
From: "Wang, Haiyue" <haiyue.wang@...ux.intel.com>
To: minyard@....org, openipmi-developer@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH ipmi/kcs_bmc v1] ipmi: kcs_bmc: optimize the data buffers
allocation
Hi Corey,
The 4.17 merge window is opened now, this patch is not yet in linux-next
tree,
so it will be merged into 4.18 ?
Thanks & Regards,
Haiyue
On 2018-03-15 20:20, Haiyue Wang wrote:
> Allocate a continuous memory block for the three KCS data buffers with
> related index assignment.
>
> Signed-off-by: Haiyue Wang <haiyue.wang@...ux.intel.com>
> ---
> drivers/char/ipmi/kcs_bmc.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c
> index fbfc05e..dc19c0d 100644
> --- a/drivers/char/ipmi/kcs_bmc.c
> +++ b/drivers/char/ipmi/kcs_bmc.c
> @@ -435,6 +435,7 @@ static const struct file_operations kcs_bmc_fops = {
> struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel)
> {
> struct kcs_bmc *kcs_bmc;
> + void *buf;
>
> kcs_bmc = devm_kzalloc(dev, sizeof(*kcs_bmc) + sizeof_priv, GFP_KERNEL);
> if (!kcs_bmc)
> @@ -448,11 +449,12 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel)
> mutex_init(&kcs_bmc->mutex);
> init_waitqueue_head(&kcs_bmc->queue);
>
> - kcs_bmc->data_in = devm_kmalloc(dev, KCS_MSG_BUFSIZ, GFP_KERNEL);
> - kcs_bmc->data_out = devm_kmalloc(dev, KCS_MSG_BUFSIZ, GFP_KERNEL);
> - kcs_bmc->kbuffer = devm_kmalloc(dev, KCS_MSG_BUFSIZ, GFP_KERNEL);
> - if (!kcs_bmc->data_in || !kcs_bmc->data_out || !kcs_bmc->kbuffer)
> + buf = devm_kmalloc_array(dev, 3, KCS_MSG_BUFSIZ, GFP_KERNEL);
> + if (!buf)
> return NULL;
> + kcs_bmc->data_in = buf;
> + kcs_bmc->data_out = buf + KCS_MSG_BUFSIZ;
> + kcs_bmc->kbuffer = buf + KCS_MSG_BUFSIZ * 2;
>
> kcs_bmc->miscdev.minor = MISC_DYNAMIC_MINOR;
> kcs_bmc->miscdev.name = dev_name(dev);
Powered by blists - more mailing lists