Re: [PATCH v2 02/16] bus: mhi: core: Add support for registering MHI controllers
From: Greg KH
Date: Mon Feb 17 2020 - 11:32:10 EST
On Mon, Feb 17, 2020 at 05:04:52PM +0100, Arnd Bergmann wrote:
> On Mon, Feb 17, 2020 at 3:15 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Mon, Feb 17, 2020 at 06:34:19PM +0530, Manivannan Sadhasivam wrote:
> > > On Mon, Feb 17, 2020 at 12:59:30PM +0100, Greg KH wrote:
> > > ```
> > > struct mhi_device *mhi_alloc_device(struct mhi_controller *mhi_cntrl)
> > > {
> > > ...
> > > dev->parent = mhi_cntrl->dev;
> > > ...
> > > ```
> > >
> > > Hence, having the parent dev pointer really helps.
> >
> > Yes, saving the parent device is fine, but you should be doing your own
> > dma calls using _your_ device, not the parents. Only mess with the
> > parent pointer if you need to do something "normal" for a parent.
>
> The MHI device is not involved in DMA at all, as it is not a DMA master,
> and has no knowledge of the memory management or whether there
> is any DMA at all. I think it is the right abstraction for an MHI driver to
> pass kernel pointers into the subsystem interfaces, which then get
> mapped by the bus driver that owns the DMA master.
>
> This is similar to how e.g. USB drivers pass data into the USB core
> interfaces, which then get the HCI driver to map/unmap it into the
> DMA masters.
Ok, then this needs to be named a whole lot better than the original
"dev" name had it. Heck, even "parent" does not show that type of
representation, make it "controller" or something else a whole lot more
descriptive of what it really is please.
thanks,
greg k-h