linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Michal Malý" <madcatxster@prifuk.cz>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	dmitry.torokhov@gmail.com, elias.vds@gmail.com
Subject: Re: [PATCH] Add ff-memless-next module
Date: Thu, 26 Dec 2013 08:58:37 -0800	[thread overview]
Message-ID: <1388077117.2459.10.camel@joe-AO722> (raw)
In-Reply-To: <4629786.9msWpURVJS@geidi-prime>

On Thu, 2013-12-26 at 17:33 +0100, Michal Malý wrote:
> This patch adds "ff-memless-next" module. This module is based on the current
> "ff-memless" module but it has considerably extended capabilities. These include:
[]
> Why is this written as a new module and not a patch for "ff-memless"? This
> module uses a different API for the HW-specific driver; this was a necessary
> step to make use of the module's additional features. All 25 drivers that
> currently use "ff-memless" would have to be updated. "ff-memless-next" currently
> does not support FF_RUMBLE which is needed to support various joypads.

Thanks for that explanation.

[]

> +static unsigned long mlnx_get_envelope_update_time(const struct mlnx_effect *mlnxeff,
> +						   const unsigned long update_rate_jiffies)
> +{

> +	/* Effect has an envelope with nonzero fade time */
> +	if (mlnxeff->effect.replay.length) {
> +		if (!envelope->fade_length)
> +			return mlnxeff->stop_at;
> +
> +		/* Schedule the next update when the fade begins */
> +		if (time_before(mlnxeff->updated_at, mlnxeff->fade_begin))
> +			return mlnxeff->fade_begin;
> +
> +		/* Already fading */
> +		else {
> +			fade_next = mlnxeff->updated_at + update_rate_jiffies;
> +

There's no need for an else and extra indentation here
 
	if (foo)
		return;
	else {			/* unnecessary else */
		bar...
	}

please just use

	if (foo)
		return;

	bar...

> +			/* Schedule update when the effect stops */
> +			if (time_after(fade_next, mlnxeff->stop_at))
> +				return mlnxeff->stop_at;
> +			/* Schedule update at the next checkpoint */
> +			else
> +				return fade_next;
> +		}
> +	}

      reply	other threads:[~2013-12-26 16:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-26 16:33 [PATCH] Add ff-memless-next module Michal Malý
2013-12-26 16:58 ` Joe Perches [this message]

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=1388077117.2459.10.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=elias.vds@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madcatxster@prifuk.cz \
    /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).