Re: [PATCH 4/8] bus: mhi: Add inbound buffers allocation flag

Loic Poulain
2021-06-24T18:52:04Z

On Thu, 24 Jun 2021 at 18:48, Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Thu, Jun 24, 2021 at 05:39:58PM +0200, Loic Poulain wrote:
> > Hi Greg,
> >
> > On Thu, 24 Jun 2021 at 15:51, Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Mon, Jun 21, 2021 at 09:46:12PM +0530, Manivannan Sadhasivam wrote:
> > > > From: Loic Poulain <loic.poulain@linaro.org>
> > > >
> > > > Currently, the MHI controller driver defines which channels should
> > > > have their inbound buffers allocated and queued. But ideally, this is
> > > > something that should be decided by the MHI device driver instead,
> > > > which actually deals with that buffers.
> > > >
> > > > Add a flag parameter to mhi_prepare_for_transfer allowing to specify
> > > > if buffers have to be allocated and queued by the MHI stack.
> > > >
> > > > Keep auto_queue flag for now, but should be removed at some point.
> > > >
> > > > Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> > > > Tested-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
> > > > Reviewed-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
> > > > Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>
> > > > Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > > Acked-by: Jakub Kicinski <kuba@kernel.org>
> > > > Link: https://lore.kernel.org/r/1621603519-16773-1-git-send-email-loic.poulain@linaro.org
> > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > [...]
> > > > +/**
> > > > + * enum mhi_chan_flags - MHI channel flags
> > > > + * @MHI_CH_INBOUND_ALLOC_BUFS: Automatically allocate and queue inbound buffers
> > > > + */
> > > > +enum mhi_chan_flags {
> > > > + MHI_CH_INBOUND_ALLOC_BUFS = BIT(0),
> > >
> > > Why is an enumerated type a bitfield?
> > >
> > > Please just use integers for enumerated types.
> >
> > This 'trick' for listing flags is used in other places like drm,
> > mac80211, etc...: grep -r "BIT(0)," ./include/
>
> An enum is a list of values that are unique. Not values you can mush
> together into a single variable and look at the bit masks of.
>
> > I don't understand why it would not be right? should we simply use
> > a list of defines for this?
>
> What are you using this for? If you are going to combine them, then
> yes, use #defines.

Yes, it's for combining, thanks for the clarification.
Loic