From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Nick Dyer <nick.dyer@itdev.co.uk>
Cc: linux-input@vger.kernel.org, Alan Bowens <Alan.Bowens@atmel.com>
Subject: Re: [PATCH 4/9] Input: atmel_mxt_ts - move mxt_initialize after sysfs init
Date: Tue, 4 Aug 2015 17:00:41 -0700 [thread overview]
Message-ID: <20150805000041.GA20765@dtor-ws> (raw)
In-Reply-To: <1438615397-17112-5-git-send-email-nick.dyer@itdev.co.uk>
On Mon, Aug 03, 2015 at 04:23:12PM +0100, Nick Dyer wrote:
> An error in the sysfs init may otherwise interfere with the async return
> from the firmware loader
In this case I'd rather we blocked accessing the device via sysfs until
it is settled instead of returning intermittent -EINVAL.
Thanks.
>
> Add guards for sysfs functions
>
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> ---
> drivers/input/touchscreen/atmel_mxt_ts.c | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 800ee0d..869dbb3 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -2092,6 +2092,10 @@ static ssize_t mxt_fw_version_show(struct device *dev,
> {
> struct mxt_data *data = dev_get_drvdata(dev);
> struct mxt_info *info = &data->info;
> +
> + if (!data->object_table)
> + return -EINVAL;
> +
> return scnprintf(buf, PAGE_SIZE, "%u.%u.%02X\n",
> info->version >> 4, info->version & 0xf, info->build);
> }
> @@ -2102,6 +2106,10 @@ static ssize_t mxt_hw_version_show(struct device *dev,
> {
> struct mxt_data *data = dev_get_drvdata(dev);
> struct mxt_info *info = &data->info;
> +
> + if (!data->object_table)
> + return -EINVAL;
> +
> return scnprintf(buf, PAGE_SIZE, "%u.%u\n",
> info->family_id, info->variant_id);
> }
> @@ -2134,6 +2142,9 @@ static ssize_t mxt_object_show(struct device *dev,
> int error;
> u8 *obuf;
>
> + if (!data->object_table)
> + return -EINVAL;
> +
> /* Pre-allocate buffer large enough to hold max sized object. */
> obuf = kmalloc(256, GFP_KERNEL);
> if (!obuf)
> @@ -2603,22 +2614,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
>
> disable_irq(client->irq);
>
> - error = mxt_initialize(data);
> - if (error)
> - goto err_free_irq;
> -
> error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group);
> if (error) {
> dev_err(&client->dev, "Failure %d creating sysfs group\n",
> error);
> - goto err_free_object;
> + goto err_free_irq;
> }
>
> + error = mxt_initialize(data);
> + if (error)
> + goto err_free_irq;
> +
> return 0;
>
> -err_free_object:
> - mxt_free_input_device(data);
> - mxt_free_object_table(data);
> err_free_irq:
> free_irq(client->irq, data);
> err_free_mem:
> --
> 2.4.6
>
--
Dmitry
next prev parent reply other threads:[~2015-08-05 0:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 15:23 atmel_mxt_ts - suspend patch and minor fixes Nick Dyer
2015-08-03 15:23 ` [PATCH 1/9] MAINTAINERS: Add maintainer for atmel_mxt_ts Nick Dyer
2015-08-03 15:23 ` [PATCH 2/9] Input: atmel_mxt_ts - use deep sleep mode when stopped Nick Dyer
2015-08-05 0:02 ` Dmitry Torokhov
2015-08-06 13:04 ` Nick Dyer
2015-08-06 22:57 ` Dmitry Torokhov
2015-08-10 20:11 ` Benjamin Tissoires
2015-08-11 14:24 ` Nick Dyer
2015-08-11 15:55 ` Nick Dyer
2015-08-11 16:29 ` Benjamin Tissoires
2015-08-11 18:32 ` Nick Dyer
2015-08-03 15:23 ` [PATCH 3/9] Input: atmel_mxt_ts - remove unused defines Nick Dyer
2015-08-03 15:23 ` [PATCH 4/9] Input: atmel_mxt_ts - move mxt_initialize after sysfs init Nick Dyer
2015-08-05 0:00 ` Dmitry Torokhov [this message]
2015-08-03 15:23 ` [PATCH 5/9] Input: atmel_mxt_ts - suspend/resume causes panic if input_dev fails to init Nick Dyer
2015-08-03 15:23 ` [PATCH 6/9] Input: atmel_mxt_ts - improve device tree parsing Nick Dyer
2015-08-03 15:23 ` [PATCH 7/9] Input: atmel_mxt_ts - disable interrupt for 50ms after reset Nick Dyer
2015-08-03 15:23 ` [PATCH 8/9] Input: atmel_mxt_ts - initialise input slots with INPUT_MT_DIRECT Nick Dyer
2015-08-03 15:23 ` [PATCH 9/9] Input: atmel_mxt_ts - remove warning on zero T44 count Nick Dyer
2015-08-05 0:03 ` atmel_mxt_ts - suspend patch and minor fixes 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=20150805000041.GA20765@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=Alan.Bowens@atmel.com \
--cc=linux-input@vger.kernel.org \
--cc=nick.dyer@itdev.co.uk \
/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).