diff options
author | Paul Bolle <pebolle@tiscali.nl> | 2012-10-04 20:14:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-05 14:05:07 -0400 |
commit | 48e9766726ebb8f5d98823fe6b32dff570bc04d8 (patch) | |
tree | b9bea4658ca2e7d3f0304a803ceb1195fbaac596 /drivers/rtc | |
parent | 06f77d18e4be0837868ebba8dff4097103e484c4 (diff) |
drivers/rtc/rtc-m41t80.c: remove disabled alarm functionality
Commit c3b79770e51a ("rtc: m41t80: Workaround broken alarm
functionality") disabled m41t80's alarm functions. But since those
functions were not touched, building this driver triggers these GCC
warnings:
drivers/rtc/rtc-m41t80.c:216:12: warning: 'm41t80_rtc_alarm_irq_enable' defined but not used [-Wunused-function]
drivers/rtc/rtc-m41t80.c:238:12: warning: 'm41t80_rtc_set_alarm' defined but not used [-Wunused-function]
drivers/rtc/rtc-m41t80.c:308:12: warning: 'm41t80_rtc_read_alarm' defined but not used [-Wunused-function]
Remove these functions (and the commented out references to them) to
silence these warnings. Anyone wanting to fix the alarm irq functionality
can easily find the removed code in the git log of this file or through
some web searches.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-m41t80.c | 157 |
1 files changed, 4 insertions, 153 deletions
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 4e0f84af99a7..b885bcd08908 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -213,163 +213,14 @@ static int m41t80_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
213 | return m41t80_set_datetime(to_i2c_client(dev), tm); | 213 | return m41t80_set_datetime(to_i2c_client(dev), tm); |
214 | } | 214 | } |
215 | 215 | ||
216 | static int m41t80_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | 216 | /* |
217 | { | 217 | * XXX - m41t80 alarm functionality is reported broken. |
218 | struct i2c_client *client = to_i2c_client(dev); | 218 | * until it is fixed, don't register alarm functions. |
219 | int rc; | 219 | */ |
220 | |||
221 | rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_MON); | ||
222 | if (rc < 0) | ||
223 | goto err; | ||
224 | |||
225 | if (enabled) | ||
226 | rc |= M41T80_ALMON_AFE; | ||
227 | else | ||
228 | rc &= ~M41T80_ALMON_AFE; | ||
229 | |||
230 | if (i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, rc) < 0) | ||
231 | goto err; | ||
232 | |||
233 | return 0; | ||
234 | err: | ||
235 | return -EIO; | ||
236 | } | ||
237 | |||
238 | static int m41t80_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t) | ||
239 | { | ||
240 | struct i2c_client *client = to_i2c_client(dev); | ||
241 | u8 wbuf[1 + M41T80_ALARM_REG_SIZE]; | ||
242 | u8 *buf = &wbuf[1]; | ||
243 | u8 *reg = buf - M41T80_REG_ALARM_MON; | ||
244 | u8 dt_addr[1] = { M41T80_REG_ALARM_MON }; | ||
245 | struct i2c_msg msgs_in[] = { | ||
246 | { | ||
247 | .addr = client->addr, | ||
248 | .flags = 0, | ||
249 | .len = 1, | ||
250 | .buf = dt_addr, | ||
251 | }, | ||
252 | { | ||
253 | .addr = client->addr, | ||
254 | .flags = I2C_M_RD, | ||
255 | .len = M41T80_ALARM_REG_SIZE, | ||
256 | .buf = buf, | ||
257 | }, | ||
258 | }; | ||
259 | struct i2c_msg msgs[] = { | ||
260 | { | ||
261 | .addr = client->addr, | ||
262 | .flags = 0, | ||
263 | .len = 1 + M41T80_ALARM_REG_SIZE, | ||
264 | .buf = wbuf, | ||
265 | }, | ||
266 | }; | ||
267 | |||
268 | if (i2c_transfer(client->adapter, msgs_in, 2) < 0) { | ||
269 | dev_err(&client->dev, "read error\n"); | ||
270 | return -EIO; | ||
271 | } | ||
272 | reg[M41T80_REG_ALARM_MON] &= ~(0x1f | M41T80_ALMON_AFE); | ||
273 | reg[M41T80_REG_ALARM_DAY] = 0; | ||
274 | reg[M41T80_REG_ALARM_HOUR] &= ~(0x3f | 0x80); | ||
275 | reg[M41T80_REG_ALARM_MIN] = 0; | ||
276 | reg[M41T80_REG_ALARM_SEC] = 0; | ||
277 | |||
278 | wbuf[0] = M41T80_REG_ALARM_MON; /* offset into rtc's regs */ | ||
279 | reg[M41T80_REG_ALARM_SEC] |= t->time.tm_sec >= 0 ? | ||
280 | bin2bcd(t->time.tm_sec) : 0x80; | ||
281 | reg[M41T80_REG_ALARM_MIN] |= t->time.tm_min >= 0 ? | ||
282 | bin2bcd(t->time.tm_min) : 0x80; | ||
283 | reg[M41T80_REG_ALARM_HOUR] |= t->time.tm_hour >= 0 ? | ||
284 | bin2bcd(t->time.tm_hour) : 0x80; | ||
285 | reg[M41T80_REG_ALARM_DAY] |= t->time.tm_mday >= 0 ? | ||
286 | bin2bcd(t->time.tm_mday) : 0x80; | ||
287 | if (t->time.tm_mon >= 0) | ||
288 | reg[M41T80_REG_ALARM_MON] |= bin2bcd(t->time.tm_mon + 1); | ||
289 | else | ||
290 | reg[M41T80_REG_ALARM_DAY] |= 0x40; | ||
291 | |||
292 | if (i2c_transfer(client->adapter, msgs, 1) != 1) { | ||
293 | dev_err(&client->dev, "write error\n"); | ||
294 | return -EIO; | ||
295 | } | ||
296 | |||
297 | if (t->enabled) { | ||
298 | reg[M41T80_REG_ALARM_MON] |= M41T80_ALMON_AFE; | ||
299 | if (i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, | ||
300 | reg[M41T80_REG_ALARM_MON]) < 0) { | ||
301 | dev_err(&client->dev, "write error\n"); | ||
302 | return -EIO; | ||
303 | } | ||
304 | } | ||
305 | return 0; | ||
306 | } | ||
307 | |||
308 | static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t) | ||
309 | { | ||
310 | struct i2c_client *client = to_i2c_client(dev); | ||
311 | u8 buf[M41T80_ALARM_REG_SIZE + 1]; /* all alarm regs and flags */ | ||
312 | u8 dt_addr[1] = { M41T80_REG_ALARM_MON }; | ||
313 | u8 *reg = buf - M41T80_REG_ALARM_MON; | ||
314 | struct i2c_msg msgs[] = { | ||
315 | { | ||
316 | .addr = client->addr, | ||
317 | .flags = 0, | ||
318 | .len = 1, | ||
319 | .buf = dt_addr, | ||
320 | }, | ||
321 | { | ||
322 | .addr = client->addr, | ||
323 | .flags = I2C_M_RD, | ||
324 | .len = M41T80_ALARM_REG_SIZE + 1, | ||
325 | .buf = buf, | ||
326 | }, | ||
327 | }; | ||
328 | |||
329 | if (i2c_transfer(client->adapter, msgs, 2) < 0) { | ||
330 | dev_err(&client->dev, "read error\n"); | ||
331 | return -EIO; | ||
332 | } | ||
333 | t->time.tm_sec = -1; | ||
334 | t->time.tm_min = -1; | ||
335 | t->time.tm_hour = -1; | ||
336 | t->time.tm_mday = -1; | ||
337 | t->time.tm_mon = -1; | ||
338 | if (!(reg[M41T80_REG_ALARM_SEC] & 0x80)) | ||
339 | t->time.tm_sec = bcd2bin(reg[M41T80_REG_ALARM_SEC] & 0x7f); | ||
340 | if (!(reg[M41T80_REG_ALARM_MIN] & 0x80)) | ||
341 | t->time.tm_min = bcd2bin(reg[M41T80_REG_ALARM_MIN] & 0x7f); | ||
342 | if (!(reg[M41T80_REG_ALARM_HOUR] & 0x80)) | ||
343 | t->time.tm_hour = bcd2bin(reg[M41T80_REG_ALARM_HOUR] & 0x3f); | ||
344 | if (!(reg[M41T80_REG_ALARM_DAY] & 0x80)) | ||
345 | t->time.tm_mday = bcd2bin(reg[M41T80_REG_ALARM_DAY] & 0x3f); | ||
346 | if (!(reg[M41T80_REG_ALARM_DAY] & 0x40)) | ||
347 | t->time.tm_mon = bcd2bin(reg[M41T80_REG_ALARM_MON] & 0x1f) - 1; | ||
348 | t->time.tm_year = -1; | ||
349 | t->time.tm_wday = -1; | ||
350 | t->time.tm_yday = -1; | ||
351 | t->time.tm_isdst = -1; | ||
352 | t->enabled = !!(reg[M41T80_REG_ALARM_MON] & M41T80_ALMON_AFE); | ||
353 | t->pending = !!(reg[M41T80_REG_FLAGS] & M41T80_FLAGS_AF); | ||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | static struct rtc_class_ops m41t80_rtc_ops = { | 220 | static struct rtc_class_ops m41t80_rtc_ops = { |
358 | .read_time = m41t80_rtc_read_time, | 221 | .read_time = m41t80_rtc_read_time, |
359 | .set_time = m41t80_rtc_set_time, | 222 | .set_time = m41t80_rtc_set_time, |
360 | /* | ||
361 | * XXX - m41t80 alarm functionality is reported broken. | ||
362 | * until it is fixed, don't register alarm functions. | ||
363 | * | ||
364 | .read_alarm = m41t80_rtc_read_alarm, | ||
365 | .set_alarm = m41t80_rtc_set_alarm, | ||
366 | */ | ||
367 | .proc = m41t80_rtc_proc, | 223 | .proc = m41t80_rtc_proc, |
368 | /* | ||
369 | * See above comment on broken alarm | ||
370 | * | ||
371 | .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, | ||
372 | */ | ||
373 | }; | 224 | }; |
374 | 225 | ||
375 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) | 226 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) |