From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, Jean Delvare <jdelvare@suse.com>
Subject: Re: [PATCH] lm87: Use hwmon to create the sysfs groups
Date: Tue, 25 Oct 2016 20:54:28 -0600 [thread overview]
Message-ID: <20161026025428.GB4929@obsidianresearch.com> (raw)
In-Reply-To: <db1b73af-8560-0739-a873-16774eed2a12@roeck-us.net>
On Tue, Oct 25, 2016 at 06:50:01PM -0700, Guenter Roeck wrote:
> >+
> >+ const struct attribute_group *attr_groups[5];
>
> There can be up to 5 active groups total, so this array needs to have
> 6 entries (it needs to be NULL_terminated).
Agh right, I forgot about that. I will send a v2
> > {
> > struct lm87_data *data = i2c_get_clientdata(client);
> >
> >- hwmon_device_unregister(data->hwmon_dev);
> >- lm87_remove_files(client);
> >-
> > lm87_write_value(client, LM87_REG_CONFIG, data->config);
>
> Strictly speaking this is now racy: The sysfs attributes still exist here,
> meaning the chip can still be accessed. Consider using devm_add_action();
> then you can drop the remove function entirely, and simplify error cleanup
> in the probe function.
I guess, but that is very obscure. If you unload the driver while
monitoring it with sysfs and the boot firmware left the chip in the
low power state then a sysfs right might race and return garbage..
I can switch it to use hwmon_device_register_with_groups and put the
hwmon_device_unregister back - I'm not sure wrapping the write in devm
would be a simplification..
Thanks,
Jason
next prev parent reply other threads:[~2016-10-26 2:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 23:26 [PATCH] lm87: Use hwmon to create the sysfs groups Jason Gunthorpe
2016-10-26 1:50 ` Guenter Roeck
2016-10-26 2:54 ` Jason Gunthorpe [this message]
2016-10-26 4:22 ` Guenter Roeck
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=20161026025428.GB4929@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.