Changeset bb8f69d in mainline
- Timestamp:
- 2012-04-12T15:54:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95060d5b
- Parents:
- 85f2064
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
r85f2064 rbb8f69d 55 55 56 56 #define RTC_FROM_FNODE(fnode) ((rtc_t *) ((fnode)->dev->driver_data)) 57 #define RTC_FROM_DEV(devnode) ((rtc_t *) ((devnode)->driver_data)) 57 58 58 59 typedef struct rtc { … … 69 70 /** true if a client is connected to the device */ 70 71 bool client_connected; 72 /** true if device is removed */ 73 bool removed; 71 74 } rtc_t; 72 75 … … 85 88 static void rtc_default_handler(ddf_fun_t *fun, 86 89 ipc_callid_t callid, ipc_call_t *call); 90 static int rtc_dev_remove(ddf_dev_t *dev); 87 91 88 92 … … 92 96 static driver_ops_t rtc_ops = { 93 97 .dev_add = rtc_dev_add, 94 .dev_remove = NULL, /* XXX */98 .dev_remove = rtc_dev_remove, 95 99 }; 96 100 … … 394 398 } 395 399 400 /** The dev_remove callback for the rtc driver 401 * 402 * @param dev The RTC device 403 * 404 * @return EOK on success or a negative error code 405 */ 406 static int 407 rtc_dev_remove(ddf_dev_t *dev) 408 { 409 rtc_t *rtc = RTC_FROM_DEV(dev); 410 int rc; 411 412 fibril_mutex_lock(&rtc->mutex); 413 if (rtc->client_connected) { 414 fibril_mutex_unlock(&rtc->mutex); 415 return EBUSY; 416 } 417 418 rtc->removed = true; 419 fibril_mutex_unlock(&rtc->mutex); 420 421 rc = ddf_fun_unbind(rtc->fun); 422 if (rc != EOK) { 423 ddf_msg(LVL_ERROR, "Failed to unbind function"); 424 return rc; 425 } 426 427 ddf_fun_destroy(rtc->fun); 428 rtc_dev_cleanup(rtc); 429 430 return rc; 431 } 432 396 433 /** Default handler for client requests not handled 397 434 * by the standard interface … … 430 467 431 468 if (rtc->client_connected) 432 rc = EBUSY; 469 rc = ELIMIT; 470 else if (rtc->removed) 471 rc = ENXIO; 433 472 else { 434 473 rc = EOK;
Note:
See TracChangeset
for help on using the changeset viewer.