LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jaewon Kim <jaewon02.kim@samsung.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-input@vger.kernel.org,
	Inki Dae <inki.dae@samsung.com>,
	SangBae Lee <sangbae90.lee@samsung.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Lee Jones <lee.jones@linaro.org>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Sebastian Reichel <sre@kernel.org>,
	Beomho Seo <beomho.seo@samsung.com>
Subject: Re: [PATCH v6 4/5] Input: add haptic drvier on max77843
Date: Fri, 27 Feb 2015 09:49:41 -0800	[thread overview]
Message-ID: <20150227174941.GD6679@dtor-ws> (raw)
In-Reply-To: <54EE89C0.7010507@samsung.com>

On Thu, Feb 26, 2015 at 11:49:36AM +0900, Jaewon Kim wrote:
> Hi Dmitry,
> 
> On 26/02/2015 10:23, Dmitry Torokhov wrote:
> >Hi Jaewon,
> >
> >On Tue, Feb 24, 2015 at 10:29:07AM +0900, Jaewon Kim wrote:
> >>+static void max77843_haptic_play_work(struct work_struct *work)
> >>+{
> >>+	struct max77843_haptic *haptic =
> >>+			container_of(work, struct max77843_haptic, work);
> >>+	int error;
> >>+
> >>+	mutex_lock(&haptic->mutex);
> >>+
> >>+	if (haptic->suspended) {
> >>+		goto err_play;
> >>+	}
> >>+
> >You do not need braces around single statement. Also, this is not error
> >that you are handling, I'd prefer if we called this label out_unlock.
> You are right.
> I will change label name and remove braces.
> >>+	error = max77843_haptic_set_duty_cycle(haptic);
> >>+	if (error) {
> >>+		dev_err(haptic->dev, "failed to set duty cycle: %d\n", error);
> >>+		goto err_play;
> >>+	}
> >Do you need to configure duty cycle if you stopping the playback? Or
> >maybe disabling pwm is enough?
> 
> It do not need to set duty cycle requisitely when disabling haptic.
> 
> I will move this function to front of max77843_haptic_enable().
> 
> >
> >>+
> >>+	if (haptic->magnitude) {
> >>+		error = max77843_haptic_enable(haptic);
> >>+		if (error)
> >>+			dev_err(haptic->dev,
> >>+					"cannot enable haptic: %d\n", error);
> >>+	} else {
> >>+		max77843_haptic_disable(haptic);
> >>+		if (error)
> >>+			dev_err(haptic->dev,
> >>+					"cannot disable haptic: %d\n", error);
> >What error? You did not assign it...
> Detailed error message printed in enable/disable() function.

What I was trying to say is that you do not assign new value to 'error'
variable in this path; it still carries the value from
max77843_haptic_set_duty_cycle() above and so this "if" statement will
never work and the message will never show up.

Thanks.

-- 
Dmitry

  reply	other threads:[~2015-02-27 17:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  1:29 [PATCH v6 0/5] Add new MFD driver for MAX77843 Jaewon Kim
2015-02-24  1:29 ` [PATCH v6 1/5] mfd: max77843: Add max77843 MFD driver core driver Jaewon Kim
2015-02-25 16:47   ` Lee Jones
2015-02-26  2:58     ` Jaewon Kim
2015-02-24  1:29 ` [PATCH v6 2/5] power: max77843_charger: Add Max77843 charger device driver Jaewon Kim
2015-02-28 20:03   ` Paul Bolle
2015-03-02  0:05     ` Beomho Seo
2015-02-24  1:29 ` [PATCH v6 3/5] power: max77843_battery: Add Max77843 fuel gauge " Jaewon Kim
2015-02-28 20:00   ` Paul Bolle
2015-03-02  0:00     ` Beomho Seo
2015-02-24  1:29 ` [PATCH v6 4/5] Input: add haptic drvier on max77843 Jaewon Kim
2015-02-26  1:23   ` Dmitry Torokhov
2015-02-26  2:49     ` Jaewon Kim
2015-02-27 17:49       ` Dmitry Torokhov [this message]
2015-03-02  6:08         ` Jaewon Kim
2015-02-24  1:29 ` [PATCH v6 5/5] Documentation: Add device tree bindings document for max77843 Jaewon Kim

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=20150227174941.GD6679@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=beomho.seo@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=inki.dae@samsung.com \
    --cc=jaewon02.kim@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sangbae90.lee@samsung.com \
    --cc=sre@kernel.org \
    --subject='Re: [PATCH v6 4/5] Input: add haptic drvier on max77843' \
    /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

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).