Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666301
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Guenter Roeck <linux@roeck-us.net> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH linux v1 1/3] drivers: w1: add hwmon support structures |
| Date | Thu, 15 Jun 2017 00:40:02 +0200 |
| Message-ID | <tSp7c-2DF-29@gated-at.bofh.it> (permalink) |
| References | <tSoE9-2rK-1@gated-at.bofh.it> <tSoEa-2rK-7@gated-at.bofh.it> |
| X-Original-To | Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> |
| Dkim-Signature | v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=In-Reply-To:Content-Type:MIME-Version:References :Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding :Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Qx7XCfUKgPKbcd9qyNNI9PrdflBZVmlc1cRgpx8jRmU=; b=blECPxadTGMIuVGXCaVgeJRRWn MQARDyyIHOqH/RPF4MQMLvy7IeS9+CX6xBIAMSlqktO17OZFt95cSjTG64DHEEodJR3wbbJXUaP10 8R1Prh2O/VUlhfDebjiHbC5rspkba/ZlwaJgC5GotBbvA5PRJA4cCC13zj93AYbq6dTjvebfDwOVp Hkw47DseQzAEmpvI0cNkSrj7aEkD7E/kIQfUE9CxmJ4TLTt8rF6eqvyyczbN/gRyJwezIrOMLx+s5 apwV80RdkXachrTwELex20cQuEfzaHYiqw9dd0AMtaqqeXHz5i1pqxwEcrUkwx/6X4lh841RLaMZa a+QZ2vdw==; |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| X-Antiabuse | This header was added to track abuse, please include it with any abuse report |
| X-Antiabuse | Primary Hostname - bh-25.webhostbox.net |
| X-Antiabuse | Original Domain - vger.kernel.org |
| X-Antiabuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-Antiabuse | Sender Address Domain - roeck-us.net |
| X-Get-Message-Sender-Via | bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net |
| X-Authenticated-Sender | bh-25.webhostbox.net: guenter@roeck-us.net |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 103 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | zbr@ioremap.net, linux-kernel@vger.kernel.org, jdelvare@suse.com, linux-hwmon@vger.kernel.org |
| X-Original-Date | Wed, 14 Jun 2017 15:38:43 -0700 |
| X-Original-Message-ID | <20170614223843.GB19172@roeck-us.net> |
| X-Original-References | <20170614215944.24984-1-jaghu@google.com> <20170614215944.24984-2-jaghu@google.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1666301 |
Show key headers only | View raw
On Wed, Jun 14, 2017 at 02:59:42PM -0700, Jaghathiswari Rankappagounder Natarajan wrote:
> This patch has changes to w1.h/w1.c/w1_family.h generic files to
> add (optional) hwmon support structures
>
> Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
> Change-Id: I17f7c670e5cd7a3826add720ffa928c3e1aa0abc
> ---
> drivers/w1/w1.c | 20 +++++++++++++++++++-
> drivers/w1/w1.h | 2 ++
> drivers/w1/w1_family.h | 2 ++
> 3 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index e213c678bbfe..e3efabccd284 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -32,6 +32,7 @@
> #include <linux/sched.h>
> #include <linux/kthread.h>
> #include <linux/freezer.h>
> +#include <linux/hwmon.h>
>
> #include <linux/atomic.h>
>
> @@ -659,13 +660,30 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl)
> return err;
> }
> }
> -
> +#ifdef CONFIG_HWMON
> + if (fops->hwmon_groups && sl->hwmon) {
> + struct device *hwmon
> + = hwmon_device_register_with_groups(&sl->dev,
You should really use hwmon_device_register_with_info().
Also, would devm_hwmon_device_register_with_info() work ?
> + "w1_slave_temp", sl,
> + fops->hwmon_groups);
> + if (IS_ERR(hwmon)) {
> + dev_warn(&sl->dev,
> + "could not create hwmon device\n");
> + } else {
> + sl->hwmon = hwmon;
> + }
> + }
> +#endif
> break;
> case BUS_NOTIFY_DEL_DEVICE:
> if (fops->remove_slave)
> sl->family->fops->remove_slave(sl);
> if (fops->groups)
> sysfs_remove_groups(&sl->dev.kobj, fops->groups);
> +#ifdef CONFIG_HWMON
> + if (fops->hwmon_groups && sl->hwmon)
> + hwmon_device_unregister(sl->hwmon);
> +#endif
> break;
> }
> return 0;
> diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h
> index 129895f562b0..74ef1a543856 100644
> --- a/drivers/w1/w1.h
> +++ b/drivers/w1/w1.h
> @@ -83,6 +83,7 @@ struct w1_reg_num
> * @family: module for device family type
> * @family_data: pointer for use by the family module
> * @dev: kernel device identifier
> + * @hwmon: pointer to hwmon device
> *
> */
> struct w1_slave
> @@ -99,6 +100,7 @@ struct w1_slave
> struct w1_family *family;
> void *family_data;
> struct device dev;
> + struct device *hwmon;
> };
>
> typedef void (*w1_slave_found_callback)(struct w1_master *, u64);
> diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
> index 10a7a0767187..fc582df5c28e 100644
> --- a/drivers/w1/w1_family.h
> +++ b/drivers/w1/w1_family.h
> @@ -55,12 +55,14 @@ struct w1_slave;
> * @add_slave: add_slave
> * @remove_slave: remove_slave
> * @groups: sysfs group
> + * @hwmon_groups: hwmon sysfs group
> */
> struct w1_family_ops
> {
> int (* add_slave)(struct w1_slave *);
> void (* remove_slave)(struct w1_slave *);
> const struct attribute_group **groups;
> + const struct attribute_group **hwmon_groups;
> };
>
> /**
> --
> 2.13.1.508.gb3defc5cc-goog
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH linux v1 0/3] Export 1-wire thermal sensors as hwmon device Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> - 2017-06-15 00:10 +0200
[PATCH linux v1 3/3] drivers: w1: add hwmon temp support for w1_therm Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> - 2017-06-15 00:10 +0200
[PATCH linux v1 2/3] drivers: w1: refactor w1_slave_show to make the temp reading functionality separate Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> - 2017-06-15 00:10 +0200
[PATCH linux v1 1/3] drivers: w1: add hwmon support structures Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> - 2017-06-15 00:10 +0200
Re: [PATCH linux v1 1/3] drivers: w1: add hwmon support structures Guenter Roeck <linux@roeck-us.net> - 2017-06-15 00:40 +0200
Re: [PATCH linux v1 0/3] Export 1-wire thermal sensors as hwmon device Evgeniy Polyakov <zbr@ioremap.net> - 2017-06-17 16:40 +0200
csiph-web