From: Hemant Kumar <hemantk@codeaurora.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: bbhatt@codeaurora.org, jhugo@codeaurora.org,
linux-arm-msm@vger.kernel.org, manivannan.sadhasivam@linaro.org
Subject: Re: [PATCH v4 01/10] mhi: Add mhi_controller_initialize helper
Date: Fri, 11 Dec 2020 12:00:36 -0800 [thread overview]
Message-ID: <2c756db7-563b-2af8-e9b3-324a58770d96@codeaurora.org> (raw)
In-Reply-To: <CAMZdPi8+UFmTOeivvZXefm-UHuN+v5zNJBQuZAOw0omiWY-ifw@mail.gmail.com>
Hi Loic,
On 12/11/20 11:13 AM, Loic Poulain wrote:
> Hi Hemant,
>
> Le ven. 11 déc. 2020 à 19:57, Hemant Kumar <hemantk@codeaurora.org
> <mailto:hemantk@codeaurora.org>> a écrit :
>
>
>
> On 12/10/20 2:02 AM, 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.
> >
> > Signed-off-by: Loic Poulain <loic.poulain@linaro.org
> <mailto:loic.poulain@linaro.org>>
> > ---
> > drivers/bus/mhi/core/init.c | 7 +++++++
> > include/linux/mhi.h | 6 ++++++
> > 2 files changed, 13 insertions(+)
> >
> > diff --git a/drivers/bus/mhi/core/init.c
> b/drivers/bus/mhi/core/init.c
> > index 96cde9c..4acad28 100644
> > --- a/drivers/bus/mhi/core/init.c
> > +++ b/drivers/bus/mhi/core/init.c
> > @@ -1021,11 +1021,18 @@ 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;
> >
> > mhi_cntrl = kzalloc(sizeof(*mhi_cntrl), GFP_KERNEL);
> > + mhi_initialize_controller(mhi_cntrl);
> Considering the kzalloc, do we really need to call here as well ?
>
>
> To summary back and forth on that change, the point is that mhi_cntrl
> may have some extra initialization in the futur (e.g mutex init...) and
> so a helper is needed to correctly initialize the structure, though
> today it does nothing except zeroing.
I am aware of the discussion and reason for introducing new exported
API. Based on my understanding, as of now you are going to call the new
exported API in MHI controller driver. I was thinking of adding new API
in mhi_alloc_controller only after introducing extra initialization in
future, without that it was looking redundant to me at this point of time.
>
> Regards,
> Loïc
>
>
> >
> > return 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
> > */
> >
>
> Thanks,
> Hemant
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum,
> a Linux Foundation Collaborative Project
>
Thanks,
Hemant
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2020-12-11 21:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 10:02 [PATCH v4 00/10] mhi: pci_generic: Misc improvements Loic Poulain
2020-12-10 10:02 ` [PATCH v4 01/10] mhi: Add mhi_controller_initialize helper Loic Poulain
2020-12-11 18:57 ` Hemant Kumar
[not found] ` <CAMZdPi8+UFmTOeivvZXefm-UHuN+v5zNJBQuZAOw0omiWY-ifw@mail.gmail.com>
2020-12-11 20:00 ` Hemant Kumar [this message]
2020-12-14 14:01 ` Loic Poulain
2020-12-10 10:02 ` [PATCH v4 02/10] bus: mhi: core: Add device hardware reset support Loic Poulain
2020-12-10 10:02 ` [PATCH v4 03/10] mhi: pci-generic: Increase number of hardware events Loic Poulain
2020-12-10 10:02 ` [PATCH v4 04/10] mhi: pci_generic: Enable burst mode for hardware channels Loic Poulain
2020-12-10 10:02 ` [PATCH v4 05/10] mhi: pci_generic: Add support for reset Loic Poulain
2020-12-11 20:15 ` Hemant Kumar
2020-12-14 14:04 ` Loic Poulain
2020-12-10 10:02 ` [PATCH v4 06/10] mhi: pci_generic: Add suspend/resume/recovery procedure Loic Poulain
2020-12-11 20:22 ` Hemant Kumar
2020-12-14 14:06 ` Loic Poulain
2020-12-10 10:02 ` [PATCH v4 07/10] mhi: pci_generic: Add PCI error handlers Loic Poulain
2020-12-11 20:25 ` Hemant Kumar
2020-12-10 10:02 ` [PATCH v4 08/10] mhi: pci_generic: Add health-check Loic Poulain
2020-12-10 10:02 ` [PATCH v4 09/10] mhi: pci_generic: Increase controller timeout value Loic Poulain
2020-12-10 10:02 ` [PATCH v4 10/10] mhi: pci_generic: Add diag channels Loic Poulain
2020-12-11 20:28 ` Hemant Kumar
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=2c756db7-563b-2af8-e9b3-324a58770d96@codeaurora.org \
--to=hemantk@codeaurora.org \
--cc=bbhatt@codeaurora.org \
--cc=jhugo@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=manivannan.sadhasivam@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;
as well as URLs for NNTP newsgroup(s).