[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200807051538.GC3230@Mani-XPS-13-9360>
Date: Fri, 7 Aug 2020 10:45:38 +0530
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: Bhaumik Bhatt <bbhatt@...eaurora.org>
Cc: linux-arm-msm@...r.kernel.org, hemantk@...eaurora.org,
jhugo@...eaurora.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 10/11] bus: mhi: core: Introduce APIs to allocate and
free the MHI controller
On Mon, Jul 27, 2020 at 07:02:19PM -0700, Bhaumik Bhatt wrote:
> Client devices should use the APIs provided to allocate and free
> the MHI controller structure. This will help ensure that the
> structure is zero-initialized and there are no false positives
> with respect to reading any values such as the serial number or
> the OEM PK hash.
>
> Signed-off-by: Bhaumik Bhatt <bbhatt@...eaurora.org>
Can you please also add the Suggested-by tag?
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Thanks,
Mani
> ---
> drivers/bus/mhi/core/init.c | 16 ++++++++++++++++
> include/linux/mhi.h | 12 ++++++++++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index d2c0f6e..972dbf0 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -959,6 +959,22 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl)
> }
> EXPORT_SYMBOL_GPL(mhi_unregister_controller);
>
> +struct mhi_controller *mhi_alloc_controller(void)
> +{
> + struct mhi_controller *mhi_cntrl;
> +
> + mhi_cntrl = kzalloc(sizeof(*mhi_cntrl), GFP_KERNEL);
> +
> + return mhi_cntrl;
> +}
> +EXPORT_SYMBOL_GPL(mhi_alloc_controller);
> +
> +void mhi_free_controller(struct mhi_controller *mhi_cntrl)
> +{
> + kfree(mhi_cntrl);
> +}
> +EXPORT_SYMBOL_GPL(mhi_free_controller);
> +
> int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
> {
> struct device *dev = &mhi_cntrl->mhi_dev->dev;
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index d15e9ce..a35d876 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -530,6 +530,18 @@ struct mhi_driver {
> #define to_mhi_device(dev) container_of(dev, struct mhi_device, dev)
>
> /**
> + * mhi_alloc_controller - Allocate the MHI Controller structure
> + * Allocate the mhi_controller structure using zero initialized memory
> + */
> +struct mhi_controller *mhi_alloc_controller(void);
> +
> +/**
> + * mhi_free_controller - Free the MHI Controller structure
> + * Free the mhi_controller structure which was previously allocated
> + */
> +void mhi_free_controller(struct mhi_controller *mhi_cntrl);
> +
> +/**
> * mhi_register_controller - Register MHI controller
> * @mhi_cntrl: MHI controller to register
> * @config: Configuration to use for the controller
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
Powered by blists - more mailing lists