Re: [PATCH v5 2/7] mailbox: arm_mhu: add driver for ARM MHU controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wednesday 04 February 2015 08:57:43 Jassi Brar wrote:
> On 3 February 2015 at 20:55, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > On Tuesday 03 February 2015 14:46:11 Russell King - ARM Linux wrote:
> >> On Tue, Feb 03, 2015 at 08:09:34PM +0530, Jassi Brar wrote:

> > I had expected to see here something like:
> >
> > static int mhu_send_data(struct mbox_chan *chan, void *data)
> > {
> >         struct mhu_link *mlink = chan->con_priv;
> >         u32 *arg = data;
> >
> >         writel_relaxed(*arg, mlink->tx_reg + INTR_SET_OFS);
> > }
> >
> > i.e. dereferencing the pointer instead of using the actual value.
> >
> OK, just curious how is this (dereferencing to the u32 variable on
> stack of the client driver) better?

The API as I understand is defined to use the pointer to point to
a chunk of data of fixed size, with the size being known to both
the client driver and the mailbox driver. This is the reason for
having a pointer in the first place.

Using the bits of the pointer as the message instead of pointing
to the message feels like an abuse of the API.

Maybe it would have been better to pass the size explictly as 
a third argument in the API to make that clear.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux