aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 1043b39aa123..351982bcec1b 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -67,26 +67,6 @@ static struct i2c_driver wf_sat_driver = {
67 .detach_client = wf_sat_detach, 67 .detach_client = wf_sat_detach,
68}; 68};
69 69
70/*
71 * XXX i2c_smbus_read_i2c_block_data doesn't pass the requested
72 * length down to the low-level driver, so we use this, which
73 * works well enough with the SMU i2c driver code...
74 */
75static int sat_read_block(struct i2c_client *client, u8 command,
76 u8 *values, int len)
77{
78 union i2c_smbus_data data;
79 int err;
80
81 data.block[0] = len;
82 err = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
83 I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA,
84 &data);
85 if (!err)
86 memcpy(values, data.block, len);
87 return err;
88}
89
90struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id, 70struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
91 unsigned int *size) 71 unsigned int *size)
92{ 72{
@@ -124,8 +104,8 @@ struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
124 return NULL; 104 return NULL;
125 105
126 for (i = 0; i < len; i += 4) { 106 for (i = 0; i < len; i += 4) {
127 err = sat_read_block(&sat->i2c, 0xa, data, 4); 107 err = i2c_smbus_read_i2c_block_data(&sat->i2c, 0xa, 4, data);
128 if (err) { 108 if (err < 0) {
129 printk(KERN_ERR "smu_sat_get_sdb_part rd err %d\n", 109 printk(KERN_ERR "smu_sat_get_sdb_part rd err %d\n",
130 err); 110 err);
131 goto fail; 111 goto fail;
@@ -157,8 +137,8 @@ static int wf_sat_read_cache(struct wf_sat *sat)
157{ 137{
158 int err; 138 int err;
159 139
160 err = sat_read_block(&sat->i2c, 0x3f, sat->cache, 16); 140 err = i2c_smbus_read_i2c_block_data(&sat->i2c, 0x3f, 16, sat->cache);
161 if (err) 141 if (err < 0)
162 return err; 142 return err;
163 sat->last_read = jiffies; 143 sat->last_read = jiffies;
164#ifdef LOTSA_DEBUG 144#ifdef LOTSA_DEBUG