[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140423172413.GA18181@core.coreip.homeip.net>
Date: Wed, 23 Apr 2014 10:24:13 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Oliver Neukum <oneukum@...e.de>
Cc: Michal Malý <madcatxster@...oid-pointer.net>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
jkosina@...e.cz, elias.vds@...il.com, anssi.hannula@....fi,
simon@...gewell.org
Subject: Re: [PATCH v2 01/24] input: Add ff-memless-next module
On Wed, Apr 23, 2014 at 07:06:08PM +0200, Oliver Neukum wrote:
> On Wed, 2014-04-23 at 08:59 -0700, Dmitry Torokhov wrote:
> > On Wed, Apr 23, 2014 at 02:12:59PM +0200, Oliver Neukum wrote:
> > > On Tue, 2014-04-22 at 15:59 +0200, Michal Malý wrote:
> > > > +/* Some devices might have a limit on how many uncombinable effects
> > > > + * can be played at once */
> > > > +static int mlnx_upload_conditional(struct mlnx_device *mlnxdev,
> > > > + const struct ff_effect *effect)
> > > > +{
> > > > + struct mlnx_effect_command ecmd = {
> > > > + .cmd = MLNX_UPLOAD_UNCOMB,
> > > > + .u.uncomb.id = effect->id,
> > > > + .u.uncomb.effect = effect
> > > > + };
> > > > + return mlnxdev->control_effect(mlnxdev->dev, mlnxdev->private,
> > > > &ecmd);
> > > > +}
> > > > +
> > >
> > > This mean you are building the structure on the stack
> > >
> > > 1. Are you sure nobody retains a reference?
> > > 2. That is needlessly inefficient
> >
> > Why is it inefficient?
>
> The compiler has to include the data structure and then make
> a memcopy to the stack. Instead a pointer to the predined structure
> could be passed.
No, it does not do that. Memory on stack is reserved and zeroed out,
then individual members are filled in as requested. There is no memcopy.
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists