public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, sameo@linux.intel.com,
	broonie@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org, kyungmin.park@samsung.com,
	myungjoo.ham@samsung.com
Subject: Re: [PATCH v3 2/2] input: add driver support for MAX8997-haptic
Date: Wed, 14 Mar 2012 20:54:11 +0900	[thread overview]
Message-ID: <4F6086E3.2060906@samsung.com> (raw)
In-Reply-To: <20120314084652.GC3964@core.coreip.homeip.net>

On 03/14/2012 05:46 PM, Dmitry Torokhov wrote:
> Hi Chanwoo,
> 
> On Mon, Mar 12, 2012 at 05:31:21PM +0900, Chanwoo Choi wrote:
>> +
>> +static int __devexit max8997_haptic_remove(struct platform_device *pdev)
>> +{
>> +	struct max8997_haptic *chip = platform_get_drvdata(pdev);
>> +
>> +	destroy_work_on_stack(&chip->work);
> 
> This does not make sense because:
> 
> - chip->work is not on stack
> - even if you "destroy" work nothing stops play effect to schedule a new
>   one - you need to cancel work in close method.
> 
Agreed, I will fix it.

>> +	input_unregister_device(chip->input_dev);
>> +	regulator_put(chip->regulator);
>> +
>> +	if (chip->mode == MAX8997_EXTERNAL_MODE)
>> +		pwm_free(chip->pwm);
>> +
>> +	kfree(chip);
>> +
>> +	return 0;
>> +}
>> +
>> +static int max8997_haptic_suspend(struct device *dev)
>> +{
>> +	struct platform_device *pdev = to_platform_device(dev);
>> +	struct max8997_haptic *chip = platform_get_drvdata(pdev);
>> +	struct input_dev *input_dev = chip->input_dev;
>> +	unsigned long flags;
>> +
>> +	spin_lock_irqsave(&input_dev->event_lock, flags);
>> +	max8997_haptic_enable(chip, false);
>> +	spin_unlock_irqrestore(&input_dev->event_lock, flags);
>> +
> 
> This is not proper locking between playing effect and suspend. Now that
> you are using workqueue you need to synchronize access with it, not with
> play_effect method.
> 
> Does the following patch work for you?
You're right. As you said, I face with the kernel panic when enter
suspend state
while testing max8997-haptic by using fftest at once.

Previously, I  tested for each operation of max8997-haptic and
suspend/resume.
I will fix it according to your comment.

Thank you for your comment.

Best Regards,
Chanwoo Choi

  reply	other threads:[~2012-03-14 11:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12  8:31 [PATCH v3 2/2] input: add driver support for MAX8997-haptic Chanwoo Choi
2012-03-14  8:46 ` Dmitry Torokhov
2012-03-14 11:54   ` Chanwoo Choi [this message]
2012-03-14 14:47   ` Chanwoo Choi
2012-03-14 15:48     ` Dmitry Torokhov
2012-03-16 17:48       ` Samuel Ortiz
2012-03-16 17:55         ` Dmitry Torokhov
2012-03-16 18:56           ` Samuel Ortiz
2012-03-16 19:27             ` Dmitry Torokhov

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=4F6086E3.2060906@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=sameo@linux.intel.com \
    /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