aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2005-04-08 09:06:39 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-22 00:51:51 -0400
commitd01b79d0613ebb6810bb48baf6e53e9319701fea (patch)
tree49f92093fae3b372011b1f2855cf581d9a1ad1e4 /drivers
parent6069ffde15472da9d041a58df490d388bb175d51 (diff)
[PATCH] I2C: ds1337 3/4
dev_{dbg,err} functions should print client's device name. data->id can be dropped from message, because device is determined by bus it hangs on (it has fixed address). Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/chips/ds1337.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
index 8a9e751d609b..89fc02b3c6d9 100644
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -95,7 +95,6 @@ static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
95 */ 95 */
96static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt) 96static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
97{ 97{
98 struct ds1337_data *data = i2c_get_clientdata(client);
99 int result; 98 int result;
100 u8 buf[7]; 99 u8 buf[7];
101 u8 val; 100 u8 val;
@@ -103,9 +102,7 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
103 u8 offs = 0; 102 u8 offs = 0;
104 103
105 if (!dt) { 104 if (!dt) {
106 dev_dbg(&client->adapter->dev, "%s: EINVAL: dt=NULL\n", 105 dev_dbg(&client->dev, "%s: EINVAL: dt=NULL\n", __FUNCTION__);
107 __FUNCTION__);
108
109 return -EINVAL; 106 return -EINVAL;
110 } 107 }
111 108
@@ -121,8 +118,7 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
121 118
122 result = i2c_transfer(client->adapter, msg, 2); 119 result = i2c_transfer(client->adapter, msg, 2);
123 120
124 dev_dbg(&client->adapter->dev, 121 dev_dbg(&client->dev, "%s: [%d] %02x %02x %02x %02x %02x %02x %02x\n",
125 "%s: [%d] %02x %02x %02x %02x %02x %02x %02x\n",
126 __FUNCTION__, result, buf[0], buf[1], buf[2], buf[3], 122 __FUNCTION__, result, buf[0], buf[1], buf[2], buf[3],
127 buf[4], buf[5], buf[6]); 123 buf[4], buf[5], buf[6]);
128 124
@@ -139,14 +135,13 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
139 if (buf[5] & 0x80) 135 if (buf[5] & 0x80)
140 dt->tm_year += 100; 136 dt->tm_year += 100;
141 137
142 dev_dbg(&client->adapter->dev, "%s: secs=%d, mins=%d, " 138 dev_dbg(&client->dev, "%s: secs=%d, mins=%d, "
143 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n", 139 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
144 __FUNCTION__, dt->tm_sec, dt->tm_min, 140 __FUNCTION__, dt->tm_sec, dt->tm_min,
145 dt->tm_hour, dt->tm_mday, 141 dt->tm_hour, dt->tm_mday,
146 dt->tm_mon, dt->tm_year, dt->tm_wday); 142 dt->tm_mon, dt->tm_year, dt->tm_wday);
147 } else { 143 } else {
148 dev_err(&client->adapter->dev, "ds1337[%d]: error reading " 144 dev_err(&client->dev, "error reading data! %d\n", result);
149 "data! %d\n", data->id, result);
150 result = -EIO; 145 result = -EIO;
151 } 146 }
152 147
@@ -155,20 +150,17 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
155 150
156static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt) 151static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
157{ 152{
158 struct ds1337_data *data = i2c_get_clientdata(client);
159 int result; 153 int result;
160 u8 buf[8]; 154 u8 buf[8];
161 u8 val; 155 u8 val;
162 struct i2c_msg msg[1]; 156 struct i2c_msg msg[1];
163 157
164 if (!dt) { 158 if (!dt) {
165 dev_dbg(&client->adapter->dev, "%s: EINVAL: dt=NULL\n", 159 dev_dbg(&client->dev, "%s: EINVAL: dt=NULL\n", __FUNCTION__);
166 __FUNCTION__);
167
168 return -EINVAL; 160 return -EINVAL;
169 } 161 }
170 162
171 dev_dbg(&client->adapter->dev, "%s: secs=%d, mins=%d, hours=%d, " 163 dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, "
172 "mday=%d, mon=%d, year=%d, wday=%d\n", __FUNCTION__, 164 "mday=%d, mon=%d, year=%d, wday=%d\n", __FUNCTION__,
173 dt->tm_sec, dt->tm_min, dt->tm_hour, 165 dt->tm_sec, dt->tm_min, dt->tm_hour,
174 dt->tm_mday, dt->tm_mon, dt->tm_year, dt->tm_wday); 166 dt->tm_mday, dt->tm_mon, dt->tm_year, dt->tm_wday);
@@ -195,8 +187,7 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
195 187
196 result = i2c_transfer(client->adapter, msg, 1); 188 result = i2c_transfer(client->adapter, msg, 1);
197 if (result < 0) { 189 if (result < 0) {
198 dev_err(&client->adapter->dev, "ds1337[%d]: error " 190 dev_err(&client->dev, "error writing data! %d\n", result);
199 "writing data! %d\n", data->id, result);
200 result = -EIO; 191 result = -EIO;
201 } else { 192 } else {
202 result = 0; 193 result = 0;
@@ -208,7 +199,7 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
208static int ds1337_command(struct i2c_client *client, unsigned int cmd, 199static int ds1337_command(struct i2c_client *client, unsigned int cmd,
209 void *arg) 200 void *arg)
210{ 201{
211 dev_dbg(&client->adapter->dev, "%s: cmd=%d\n", __FUNCTION__, cmd); 202 dev_dbg(&client->dev, "%s: cmd=%d\n", __FUNCTION__, cmd);
212 203
213 switch (cmd) { 204 switch (cmd) {
214 case DS1337_GET_DATE: 205 case DS1337_GET_DATE: