From: Mark Brown <broonie@kernel.org>
To: "hyunhee.kim" <hyunhee.kim@samsung.com>
Cc: dmitry.torokhov@gmail.com, peter.ujfalusi@ti.com,
wfp5p@virginia.edu, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] Input: add regulator haptic driver
Date: Thu, 24 Oct 2013 14:38:36 +0100 [thread overview]
Message-ID: <20131024133836.GG18506@sirena.org.uk> (raw)
In-Reply-To: <000101cec628$aaff69a0$00fe3ce0$%kim@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]
On Fri, Oct 11, 2013 at 11:22:00AM +0900, hyunhee.kim wrote:
> + if (enable && !haptic->enabled) {
> + haptic->enabled = true;
> + ret = regulator_enable(haptic->regulator);
> + if (ret)
> + pr_err("haptic: %s failed to enable regulator\n",
> + __func__);
These should probably set the flag after the regulator API call has
succeeded, otherwise if the call fails the driver will incorrectly
remember that the regulator is enabled and never disable it (or vice
versa on disable).
> +static void regulator_haptic_work(struct work_struct *work)
> +{
> + struct regulator_haptic *haptic = container_of(work,
> + struct
> regulator_haptic,
> + work);
> + if (haptic->level)
> + regulator_haptic_enable(haptic, true);
> + else
> + regulator_haptic_enable(haptic, false);
> +
> +}
Should the mutex for the level be at this level rather than in the
subfunctions? Though it'd probably be just as well to inline the true
and false cases since there's basically two equivalent forks in the
enable function anyway.
> +
> + haptic = kzalloc(sizeof(*haptic), GFP_KERNEL);
> + if (!haptic) {
> + dev_err(&pdev->dev, "unable to allocate memory for
> haptic\n");
> + return -ENOMEM;
> + }
Might be better to use devm_ functions throughout here, saves error
handling and cleanup code...
> +static int regulator_haptic_remove(struct platform_device *pdev)
> +{
> + struct regulator_haptic *haptic = platform_get_drvdata(pdev);
> +
> + input_unregister_device(haptic->input_dev);
> +
> + return 0;
...which is currently missing.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-10-24 13:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 2:22 hyunhee.kim
2013-10-24 13:38 ` Mark Brown [this message]
2013-10-25 6:29 ` [PATCH v4] " Hyunhee Kim
2013-10-25 8:29 ` Mark Brown
2013-10-28 8:31 ` [PATCH v5] " Hyunhee Kim
2013-10-11 2:26 [PATCH] " hyunhee.kim
2013-10-21 12:06 ` Aristeu Sergio Rozanski Filho
2013-10-21 12:10 ` Aristeu Sergio Rozanski Filho
2013-10-21 15:55 ` 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=20131024133836.GG18506@sirena.org.uk \
--to=broonie@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hyunhee.kim@samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.ujfalusi@ti.com \
--cc=wfp5p@virginia.edu \
/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
all inboxes | Powered by JetHome®