[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170718033653.10298-3-andrew@aj.id.au>
Date: Tue, 18 Jul 2017 13:06:52 +0930
From: Andrew Jeffery <andrew@...id.au>
To: linux@...ck-us.net, linux-hwmon@...r.kernel.org
Cc: Andrew Jeffery <andrew@...id.au>, jdelvare@...e.com,
linux-kernel@...r.kernel.org, joel@....id.au,
openbmc@...ts.ozlabs.org, msbarth@...ux.vnet.ibm.com,
mspinler@...ux.vnet.ibm.com
Subject: [RFC PATCH v2 2/3] pmbus: Add and expose pmbus_get_info()
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@...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
Powered by blists - more mailing lists