public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jeffery <andrew@aj.id.au>
To: linux@roeck-us.net, linux-hwmon@vger.kernel.org
Cc: Andrew Jeffery <andrew@aj.id.au>,
	jdelvare@suse.com, linux-kernel@vger.kernel.org, joel@jms.id.au,
	openbmc@lists.ozlabs.org, msbarth@linux.vnet.ibm.com,
	mspinler@linux.vnet.ibm.com
Subject: [RFC PATCH v2 2/3] pmbus: Add and expose pmbus_get_info()
Date: Tue, 18 Jul 2017 13:06:52 +0930	[thread overview]
Message-ID: <20170718033653.10298-3-andrew@aj.id.au> (raw)
In-Reply-To: <20170718033653.10298-1-andrew@aj.id.au>

This allows the caller to hoist themselves out to a containing
structure in e.g. the read/write callbacks without exposing struct
pmbus_data.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
New since v1.

 drivers/hwmon/pmbus/pmbus.h      | 1 +
 drivers/hwmon/pmbus/pmbus_core.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
index 226a37bd525f..8b3a0d43d94d 100644
--- a/drivers/hwmon/pmbus/pmbus.h
+++ b/drivers/hwmon/pmbus/pmbus.h
@@ -420,6 +420,7 @@ extern const struct regulator_ops pmbus_regulator_ops;
 
 /* Function declarations */
 
+const struct pmbus_driver_info *pmbus_get_info(struct i2c_client *client);
 void pmbus_clear_cache(struct i2c_client *client);
 int pmbus_set_page(struct i2c_client *client, u8 page);
 int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg);
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 712a8b6c4bd6..87ad612e4924 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -140,6 +140,12 @@ static const int pmbus_fan_command_registers[] = {
 	PMBUS_FAN_COMMAND_4,
 };
 
+const struct pmbus_driver_info *pmbus_get_info(struct i2c_client *client)
+{
+	return ((struct pmbus_data *)i2c_get_clientdata(client))->info;
+}
+EXPORT_SYMBOL_GPL(pmbus_get_info);
+
 void pmbus_clear_cache(struct i2c_client *client)
 {
 	struct pmbus_data *data = i2c_get_clientdata(client);
-- 
2.11.0


  parent reply	other threads:[~2017-07-18  3:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18  3:36 [RFC PATCH v2 0/3] pmbus: Expand fan support and add MAX31785 driver Andrew Jeffery
2017-07-18  3:36 ` [RFC PATCH v2 1/3] hwmon: pmbus: Add fan control support Andrew Jeffery
2017-07-19 15:05   ` Joel Stanley
2017-07-20  0:50     ` Andrew Jeffery
2017-07-18  3:36 ` Andrew Jeffery [this message]
2017-07-18  3:36 ` [RFC PATCH v2 3/3] pmbus: Add MAX31785 driver Andrew Jeffery
2017-07-19 15:05   ` Joel Stanley
2017-07-19 18:11     ` Guenter Roeck
2017-07-20  1:26       ` Andrew Jeffery

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=20170718033653.10298-3-andrew@aj.id.au \
    --to=andrew@aj.id.au \
    --cc=jdelvare@suse.com \
    --cc=joel@jms.id.au \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=msbarth@linux.vnet.ibm.com \
    --cc=mspinler@linux.vnet.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    /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