Changes in uspace/drv/char/ns8250/ns8250.c [b7fd2a0:38d150e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/ns8250/ns8250.c
rb7fd2a0 r38d150e 40 40 #include <stdio.h> 41 41 #include <errno.h> 42 #include <str_error.h>43 42 #include <stdbool.h> 44 43 #include <fibril_synch.h> … … 251 250 * @return EOK on success or non-zero error code 252 251 */ 253 static errno_t ns8250_read(chardev_srv_t *srv, void *buf, size_t count, size_t *nread)252 static int ns8250_read(chardev_srv_t *srv, void *buf, size_t count, size_t *nread) 254 253 { 255 254 ns8250_t *ns = srv_ns8250(srv); … … 295 294 * @return EOK on success or non-zero error code 296 295 */ 297 static errno_t ns8250_write(chardev_srv_t *srv, const void *buf, size_t count,296 static int ns8250_write(chardev_srv_t *srv, const void *buf, size_t count, 298 297 size_t *nwritten) 299 298 { … … 309 308 } 310 309 311 static errno_t ns8250_open(chardev_srvs_t *, chardev_srv_t *);312 static errno_t ns8250_close(chardev_srv_t *);310 static int ns8250_open(chardev_srvs_t *, chardev_srv_t *); 311 static int ns8250_close(chardev_srv_t *); 313 312 static void ns8250_default_handler(chardev_srv_t *, ipc_callid_t, ipc_call_t *); 314 313 … … 324 323 static void ns8250_char_conn(ipc_callid_t, ipc_call_t *, void *); 325 324 326 static errno_t ns8250_dev_add(ddf_dev_t *dev);327 static errno_t ns8250_dev_remove(ddf_dev_t *dev);325 static int ns8250_dev_add(ddf_dev_t *dev); 326 static int ns8250_dev_remove(ddf_dev_t *dev); 328 327 329 328 /** The serial port device driver's standard operations. */ … … 405 404 * 406 405 * @param ns Serial port device 407 * @return Zero on success, error number otherwise408 */ 409 static errno_t ns8250_dev_initialize(ns8250_t *ns)410 { 411 errno_t ret = EOK;406 * @return Zero on success, negative error number otherwise 407 */ 408 static int ns8250_dev_initialize(ns8250_t *ns) 409 { 410 int ret = EOK; 412 411 413 412 ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ddf_dev_get_name(ns->dev)); … … 499 498 * 500 499 * @param ns Serial port device 501 * @return Zero on success, error number otherwise502 */ 503 static errno_t ns8250_interrupt_enable(ns8250_t *ns)500 * @return Zero on success, negative error number otherwise 501 */ 502 static int ns8250_interrupt_enable(ns8250_t *ns) 504 503 { 505 504 /* Enable interrupt using IRC service. */ 506 errno_t rc = hw_res_enable_interrupt(ns->parent_sess, ns->irq);505 int rc = hw_res_enable_interrupt(ns->parent_sess, ns->irq); 507 506 if (rc != EOK) 508 507 return EIO; … … 544 543 * @param port The base address of the serial port device's ports. 545 544 * @param baud_rate The baud rate to be used by the device. 546 * @return Zero on success, error number otherwise (EINVAL545 * @return Zero on success, negative error number otherwise (EINVAL 547 546 * if the specified baud_rate is not valid). 548 547 */ 549 static errno_t ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)548 static int ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate) 550 549 { 551 550 uint16_t divisor; … … 646 645 * is invalid. 647 646 */ 648 static errno_t ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,647 static int ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity, 649 648 unsigned int word_length, unsigned int stop_bits) 650 649 { … … 803 802 * @param ns Serial port device 804 803 */ 805 static inline errno_t ns8250_register_interrupt_handler(ns8250_t *ns, 806 cap_handle_t *handle) 804 static inline int ns8250_register_interrupt_handler(ns8250_t *ns) 807 805 { 808 806 return register_interrupt_handler(ns->dev, ns->irq, 809 ns8250_interrupt_handler, NULL , handle);807 ns8250_interrupt_handler, NULL); 810 808 } 811 809 … … 814 812 * @param ns Serial port device 815 813 */ 816 static inline errno_t ns8250_unregister_interrupt_handler(ns8250_t *ns)814 static inline int ns8250_unregister_interrupt_handler(ns8250_t *ns) 817 815 { 818 816 return unregister_interrupt_handler(ns->dev, ns->irq_cap); … … 825 823 * @param dev The serial port device. 826 824 */ 827 static errno_t ns8250_dev_add(ddf_dev_t *dev)825 static int ns8250_dev_add(ddf_dev_t *dev) 828 826 { 829 827 ns8250_t *ns = NULL; … … 831 829 bool need_cleanup = false; 832 830 bool need_unreg_intr_handler = false; 833 errno_t rc;831 int rc; 834 832 835 833 ddf_msg(LVL_DEBUG, "ns8250_dev_add %s (handle = %d)", … … 876 874 877 875 /* Register interrupt handler. */ 878 rc = ns8250_register_interrupt_handler(ns, &ns->irq_cap);879 if ( rc != EOK) {876 ns->irq_cap = ns8250_register_interrupt_handler(ns); 877 if (ns->irq_cap < 0) { 880 878 ddf_msg(LVL_ERROR, "Failed to register interrupt handler."); 881 879 rc = EADDRNOTAVAIL; … … 888 886 if (rc != EOK) { 889 887 ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = " 890 "% s.", str_error_name(rc));888 "%d.", rc); 891 889 goto fail; 892 890 } … … 928 926 } 929 927 930 static errno_t ns8250_dev_remove(ddf_dev_t *dev)928 static int ns8250_dev_remove(ddf_dev_t *dev) 931 929 { 932 930 ns8250_t *ns = dev_ns8250(dev); 933 errno_t rc;931 int rc; 934 932 935 933 fibril_mutex_lock(&ns->mutex); … … 963 961 * @param srv Server-side connection structure 964 962 */ 965 static errno_t ns8250_open(chardev_srvs_t *srvs, chardev_srv_t *srv)963 static int ns8250_open(chardev_srvs_t *srvs, chardev_srv_t *srv) 966 964 { 967 965 ns8250_t *ns = srv_ns8250(srv); 968 errno_t res;966 int res; 969 967 970 968 fibril_mutex_lock(&ns->mutex); … … 987 985 * @param srv Server-side connection structure 988 986 */ 989 static errno_t ns8250_close(chardev_srv_t *srv)987 static int ns8250_close(chardev_srv_t *srv) 990 988 { 991 989 ns8250_t *data = srv_ns8250(srv); … … 1040 1038 * @param stop_bits The number of stop bits to be used. 1041 1039 */ 1042 static errno_t ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate,1040 static int ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate, 1043 1041 unsigned int parity, unsigned int word_length, unsigned int stop_bits) 1044 1042 { … … 1049 1047 ns8250_t *data = dev_ns8250(dev); 1050 1048 ns8250_regs_t *regs = data->regs; 1051 errno_t ret;1049 int ret; 1052 1050 1053 1051 fibril_mutex_lock(&data->mutex); … … 1072 1070 ns8250_t *ns8250 = srv_ns8250(srv); 1073 1071 sysarg_t method = IPC_GET_IMETHOD(*call); 1074 errno_t ret;1072 int ret; 1075 1073 unsigned int baud_rate, parity, word_length, stop_bits; 1076 1074
Note:
See TracChangeset
for help on using the changeset viewer.