Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/ns8250/ns8250.c

    rb7fd2a0 r38d150e  
    4040#include <stdio.h>
    4141#include <errno.h>
    42 #include <str_error.h>
    4342#include <stdbool.h>
    4443#include <fibril_synch.h>
     
    251250 * @return              EOK on success or non-zero error code
    252251 */
    253 static errno_t ns8250_read(chardev_srv_t *srv, void *buf, size_t count, size_t *nread)
     252static int ns8250_read(chardev_srv_t *srv, void *buf, size_t count, size_t *nread)
    254253{
    255254        ns8250_t *ns = srv_ns8250(srv);
     
    295294 * @return              EOK on success or non-zero error code
    296295 */
    297 static errno_t ns8250_write(chardev_srv_t *srv, const void *buf, size_t count,
     296static int ns8250_write(chardev_srv_t *srv, const void *buf, size_t count,
    298297    size_t *nwritten)
    299298{
     
    309308}
    310309
    311 static errno_t ns8250_open(chardev_srvs_t *, chardev_srv_t *);
    312 static errno_t ns8250_close(chardev_srv_t *);
     310static int ns8250_open(chardev_srvs_t *, chardev_srv_t *);
     311static int ns8250_close(chardev_srv_t *);
    313312static void ns8250_default_handler(chardev_srv_t *, ipc_callid_t, ipc_call_t *);
    314313
     
    324323static void ns8250_char_conn(ipc_callid_t, ipc_call_t *, void *);
    325324
    326 static errno_t ns8250_dev_add(ddf_dev_t *dev);
    327 static errno_t ns8250_dev_remove(ddf_dev_t *dev);
     325static int ns8250_dev_add(ddf_dev_t *dev);
     326static int ns8250_dev_remove(ddf_dev_t *dev);
    328327
    329328/** The serial port device driver's standard operations. */
     
    405404 *
    406405 * @param ns            Serial port device
    407  * @return              Zero on success, error number otherwise
    408  */
    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 */
     408static int ns8250_dev_initialize(ns8250_t *ns)
     409{
     410        int ret = EOK;
    412411       
    413412        ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ddf_dev_get_name(ns->dev));
     
    499498 *
    500499 * @param ns            Serial port device
    501  * @return              Zero on success, error number otherwise
    502  */
    503 static errno_t ns8250_interrupt_enable(ns8250_t *ns)
     500 * @return              Zero on success, negative error number otherwise
     501 */
     502static int ns8250_interrupt_enable(ns8250_t *ns)
    504503{
    505504        /* 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);
    507506        if (rc != EOK)
    508507                return EIO;
     
    544543 * @param port          The base address of the serial port device's ports.
    545544 * @param baud_rate     The baud rate to be used by the device.
    546  * @return              Zero on success, error number otherwise (EINVAL
     545 * @return              Zero on success, negative error number otherwise (EINVAL
    547546 *                      if the specified baud_rate is not valid).
    548547 */
    549 static errno_t ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)
     548static int ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)
    550549{
    551550        uint16_t divisor;
     
    646645 *                      is invalid.
    647646 */
    648 static errno_t ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,
     647static int ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,
    649648    unsigned int word_length, unsigned int stop_bits)
    650649{
     
    803802 * @param ns            Serial port device
    804803 */
    805 static inline errno_t ns8250_register_interrupt_handler(ns8250_t *ns,
    806     cap_handle_t *handle)
     804static inline int ns8250_register_interrupt_handler(ns8250_t *ns)
    807805{
    808806        return register_interrupt_handler(ns->dev, ns->irq,
    809             ns8250_interrupt_handler, NULL, handle);
     807            ns8250_interrupt_handler, NULL);
    810808}
    811809
     
    814812 * @param ns            Serial port device
    815813 */
    816 static inline errno_t ns8250_unregister_interrupt_handler(ns8250_t *ns)
     814static inline int ns8250_unregister_interrupt_handler(ns8250_t *ns)
    817815{
    818816        return unregister_interrupt_handler(ns->dev, ns->irq_cap);
     
    825823 * @param dev           The serial port device.
    826824 */
    827 static errno_t ns8250_dev_add(ddf_dev_t *dev)
     825static int ns8250_dev_add(ddf_dev_t *dev)
    828826{
    829827        ns8250_t *ns = NULL;
     
    831829        bool need_cleanup = false;
    832830        bool need_unreg_intr_handler = false;
    833         errno_t rc;
     831        int rc;
    834832       
    835833        ddf_msg(LVL_DEBUG, "ns8250_dev_add %s (handle = %d)",
     
    876874       
    877875        /* 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) {
    880878                ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
    881879                rc = EADDRNOTAVAIL;
     
    888886        if (rc != EOK) {
    889887                ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = "
    890                     "%s.", str_error_name(rc));
     888                    "%d.", rc);
    891889                goto fail;
    892890        }
     
    928926}
    929927
    930 static errno_t ns8250_dev_remove(ddf_dev_t *dev)
     928static int ns8250_dev_remove(ddf_dev_t *dev)
    931929{
    932930        ns8250_t *ns = dev_ns8250(dev);
    933         errno_t rc;
     931        int rc;
    934932       
    935933        fibril_mutex_lock(&ns->mutex);
     
    963961 * @param srv           Server-side connection structure
    964962 */
    965 static errno_t ns8250_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
     963static int ns8250_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
    966964{
    967965        ns8250_t *ns = srv_ns8250(srv);
    968         errno_t res;
     966        int res;
    969967       
    970968        fibril_mutex_lock(&ns->mutex);
     
    987985 * @param srv           Server-side connection structure
    988986 */
    989 static errno_t ns8250_close(chardev_srv_t *srv)
     987static int ns8250_close(chardev_srv_t *srv)
    990988{
    991989        ns8250_t *data = srv_ns8250(srv);
     
    10401038 * @param stop_bits     The number of stop bits to be used.
    10411039 */
    1042 static errno_t ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate,
     1040static int ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate,
    10431041    unsigned int parity, unsigned int word_length, unsigned int stop_bits)
    10441042{
     
    10491047        ns8250_t *data = dev_ns8250(dev);
    10501048        ns8250_regs_t *regs = data->regs;
    1051         errno_t ret;
     1049        int ret;
    10521050       
    10531051        fibril_mutex_lock(&data->mutex);
     
    10721070        ns8250_t *ns8250 = srv_ns8250(srv);
    10731071        sysarg_t method = IPC_GET_IMETHOD(*call);
    1074         errno_t ret;
     1072        int ret;
    10751073        unsigned int baud_rate, parity, word_length, stop_bits;
    10761074       
Note: See TracChangeset for help on using the changeset viewer.