Changeset 33dbbd2 in mainline


Ignore:
Timestamp:
2010-10-23T18:11:18Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dfda6a1
Parents:
d93aafed
Message:

More cstyle in ns8250.

File:
1 edited

Legend:

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

    rd93aafed r33dbbd2  
    123123static void delete_ns8250_dev_data(ns8250_dev_data_t *data)
    124124{
    125         if (NULL != data)
     125        if (data != NULL)
    126126                free(data);
    127127}
     
    251251static void ns8250_dev_cleanup(device_t *dev)
    252252{
    253         if (NULL != dev->driver_data) {
     253        if (dev->driver_data != NULL) {
    254254                delete_ns8250_dev_data((ns8250_dev_data_t*) dev->driver_data);
    255255                dev->driver_data = NULL;
     
    332332        /* Allocate driver data for the device. */
    333333        ns8250_dev_data_t *data = create_ns8250_dev_data();
    334         if (NULL == data)
     334        if (data == NULL)
    335335                return ENOMEM;
    336336        dev->driver_data = data;
     
    436436        /* Enable interrupt globally. */
    437437        res = interrupt_enable(data->irq);
    438         if (EOK != res)
     438        if (res != EOK)
    439439                return res;
    440440       
     
    480480        uint8_t div_low, div_high;
    481481       
    482         if (50 > baud_rate || 0 != MAX_BAUD_RATE % baud_rate) {
     482        if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) {
    483483                printf(NAME ": error - somebody tried to set invalid baud rate "
    484484                    "%d\n", baud_rate);
     
    534534 * @param stop_bits     The number of stop bits used (one or two).
    535535 */
    536 static void
    537 ns8250_port_get_com_props(ioport8_t *port, unsigned int *parity,
     536static void ns8250_port_get_com_props(ioport8_t *port, unsigned int *parity,
    538537    unsigned int *word_length, unsigned int *stop_bits)
    539538{
     
    572571 *                      is invalid.
    573572 */
    574 static int
    575 ns8250_port_set_com_props(ioport8_t *port, unsigned int parity,
     573static int ns8250_port_set_com_props(ioport8_t *port, unsigned int parity,
    576574    unsigned int word_length, unsigned int stop_bits)
    577575{
     
    691689 * @param dev           The serial port device.
    692690 */
    693 static inline void
    694 ns8250_interrupt_handler(device_t *dev, ipc_callid_t iid, ipc_call_t *icall)
     691static inline void ns8250_interrupt_handler(device_t *dev, ipc_callid_t iid,
     692    ipc_call_t *icall)
    695693{
    696694        ns8250_read_from_device(dev);
     
    726724 * @param dev           The serial port device.
    727725 */
    728 static int ns8250_add_device(device_t *dev) 
     726static int ns8250_add_device(device_t *dev)
    729727{
    730728        printf(NAME ": ns8250_add_device %s (handle = %d)\n",
     
    732730       
    733731        int res = ns8250_dev_initialize(dev);
    734         if (EOK != res)
     732        if (res != EOK)
    735733                return res;
    736734       
     
    750748       
    751749        /* Register interrupt handler. */
    752         if (EOK != ns8250_register_interrupt_handler(dev)) {
     750        if (ns8250_register_interrupt_handler(dev) != EOK) {
    753751                printf(NAME ": failed to register interrupt handler.\n");
    754752                ns8250_dev_cleanup(dev);
     
    758756        /* Enable interrupt. */
    759757        res = ns8250_interrupt_enable(dev);
    760         if (EOK != res) {
     758        if (res != EOK) {
    761759                printf(NAME ": failed to enable the interrupt. Error code = "
    762760                    "%d.\n", res);
     
    859857 * @param stop_bits     The number of stop bits to be used.
    860858 */
    861 static int
    862 ns8250_set_props(device_t *dev, unsigned int baud_rate, unsigned int parity,
    863     unsigned int word_length, unsigned int stop_bits)
     859static int ns8250_set_props(device_t *dev, unsigned int baud_rate,
     860    unsigned int parity, unsigned int word_length, unsigned int stop_bits)
    864861{
    865862        printf(NAME ": ns8250_set_props: baud rate %d, parity 0x%x, word "
     
    874871        ns8250_port_interrupts_disable(port);
    875872        ret = ns8250_port_set_baud_rate(port, baud_rate);
    876         if (EOK == ret)
     873        if (ret == EOK)
    877874                ret = ns8250_port_set_com_props(port, parity, word_length, stop_bits);
    878875        ns8250_port_interrupts_enable(port);
     
    887884 * Configure the parameters of the serial communication.
    888885 */
    889 static void
    890 ns8250_default_handler(device_t *dev, ipc_callid_t callid, ipc_call_t *call)
     886static void ns8250_default_handler(device_t *dev, ipc_callid_t callid,
     887    ipc_call_t *call)
    891888{
    892889        ipcarg_t method = IPC_GET_METHOD(*call);
Note: See TracChangeset for help on using the changeset viewer.