From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, ath11k@lists.infradead.org,
bbhatt@codeaurora.org, kvalo@codeaurora.org,
hemantk@codeaurora.org
Subject: Re: [PATCH v6 01/10] mhi: Add mhi_controller_initialize helper
Date: Thu, 31 Dec 2020 12:18:05 +0530 [thread overview]
Message-ID: <20201231064805.GA4006@thinkpad> (raw)
In-Reply-To: <1609231431-10048-2-git-send-email-loic.poulain@linaro.org>
Hi Loic,
+ath11k, kalle
On Tue, Dec 29, 2020 at 09:43:42AM +0100, Loic Poulain wrote:
> This function allows to initialize a mhi_controller structure.
> Today, it only zeroing the structure.
>
> Use this function from mhi_alloc_controller so that any further
> initialization can be factorized in initalize function.
>
I know that this has been discussed in earlier revisions but I'm still not
convinced to have 2 APIs doing a similar job. Since we don't have any usecase
currently to initialize extra fields other than the struct, we should be using
the alloc_controller API.
If you want to have a devres managed allocation, then the API should be extended
as below:
struct mhi_controller *mhi_alloc_controller(struct device *dev)
{
struct mhi_controller *mhi_cntrl;
if (!dev)
mhi_cntrl = kzalloc(sizeof(*mhi_cntrl), GFP_KERNEL);
else
mhi_cntrl = devm_kzalloc(dev, sizeof(*mhi_cntrl), GFP_KERNEL);
return mhi_cntrl;
}
In this case, the ath11k MHI controller also need to be adjusted but we can use
the same immutable branch way.
Thanks,
Mani
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> drivers/bus/mhi/core/init.c | 6 ++++++
> include/linux/mhi.h | 6 ++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index 96cde9c..a75ab8c 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -1021,6 +1021,12 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl)
> }
> EXPORT_SYMBOL_GPL(mhi_unregister_controller);
>
> +void mhi_initialize_controller(struct mhi_controller *mhi_cntrl)
> +{
> + memset(mhi_cntrl, 0, sizeof(*mhi_cntrl));
> +}
> +EXPORT_SYMBOL_GPL(mhi_initialize_controller);
> +
> struct mhi_controller *mhi_alloc_controller(void)
> {
> struct mhi_controller *mhi_cntrl;
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index 04cf7f3..2754742 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -537,6 +537,12 @@ struct mhi_driver {
> #define to_mhi_device(dev) container_of(dev, struct mhi_device, dev)
>
> /**
> + * mhi_initialize_controller - Initialize MHI Controller structure
> + * @mhi_cntrl: MHI controller structure to initialize
> + */
> +void mhi_initialize_controller(struct mhi_controller *mhi_cntrl);
> +
> +/**
> * mhi_alloc_controller - Allocate the MHI Controller structure
> * Allocate the mhi_controller structure using zero initialized memory
> */
> --
> 2.7.4
>
--
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
parent reply other threads:[~2020-12-31 6:48 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1609231431-10048-2-git-send-email-loic.poulain@linaro.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201231064805.GA4006@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=ath11k@lists.infradead.org \
--cc=bbhatt@codeaurora.org \
--cc=hemantk@codeaurora.org \
--cc=kvalo@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=loic.poulain@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox