Changeset 33dbbd2 in mainline
- Timestamp:
- 2010-10-23T18:11:18Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dfda6a1
- Parents:
- d93aafed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ns8250/ns8250.c
rd93aafed r33dbbd2 123 123 static void delete_ns8250_dev_data(ns8250_dev_data_t *data) 124 124 { 125 if ( NULL != data)125 if (data != NULL) 126 126 free(data); 127 127 } … … 251 251 static void ns8250_dev_cleanup(device_t *dev) 252 252 { 253 if ( NULL != dev->driver_data) {253 if (dev->driver_data != NULL) { 254 254 delete_ns8250_dev_data((ns8250_dev_data_t*) dev->driver_data); 255 255 dev->driver_data = NULL; … … 332 332 /* Allocate driver data for the device. */ 333 333 ns8250_dev_data_t *data = create_ns8250_dev_data(); 334 if ( NULL == data)334 if (data == NULL) 335 335 return ENOMEM; 336 336 dev->driver_data = data; … … 436 436 /* Enable interrupt globally. */ 437 437 res = interrupt_enable(data->irq); 438 if ( EOK != res)438 if (res != EOK) 439 439 return res; 440 440 … … 480 480 uint8_t div_low, div_high; 481 481 482 if ( 50 > baud_rate || 0 != MAX_BAUD_RATE % baud_rate) {482 if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) { 483 483 printf(NAME ": error - somebody tried to set invalid baud rate " 484 484 "%d\n", baud_rate); … … 534 534 * @param stop_bits The number of stop bits used (one or two). 535 535 */ 536 static void 537 ns8250_port_get_com_props(ioport8_t *port, unsigned int *parity, 536 static void ns8250_port_get_com_props(ioport8_t *port, unsigned int *parity, 538 537 unsigned int *word_length, unsigned int *stop_bits) 539 538 { … … 572 571 * is invalid. 573 572 */ 574 static int 575 ns8250_port_set_com_props(ioport8_t *port, unsigned int parity, 573 static int ns8250_port_set_com_props(ioport8_t *port, unsigned int parity, 576 574 unsigned int word_length, unsigned int stop_bits) 577 575 { … … 691 689 * @param dev The serial port device. 692 690 */ 693 static inline void 694 ns8250_interrupt_handler(device_t *dev, ipc_callid_t iid,ipc_call_t *icall)691 static inline void ns8250_interrupt_handler(device_t *dev, ipc_callid_t iid, 692 ipc_call_t *icall) 695 693 { 696 694 ns8250_read_from_device(dev); … … 726 724 * @param dev The serial port device. 727 725 */ 728 static int ns8250_add_device(device_t *dev) 726 static int ns8250_add_device(device_t *dev) 729 727 { 730 728 printf(NAME ": ns8250_add_device %s (handle = %d)\n", … … 732 730 733 731 int res = ns8250_dev_initialize(dev); 734 if ( EOK != res)732 if (res != EOK) 735 733 return res; 736 734 … … 750 748 751 749 /* Register interrupt handler. */ 752 if ( EOK != ns8250_register_interrupt_handler(dev)) {750 if (ns8250_register_interrupt_handler(dev) != EOK) { 753 751 printf(NAME ": failed to register interrupt handler.\n"); 754 752 ns8250_dev_cleanup(dev); … … 758 756 /* Enable interrupt. */ 759 757 res = ns8250_interrupt_enable(dev); 760 if ( EOK != res) {758 if (res != EOK) { 761 759 printf(NAME ": failed to enable the interrupt. Error code = " 762 760 "%d.\n", res); … … 859 857 * @param stop_bits The number of stop bits to be used. 860 858 */ 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) 859 static int ns8250_set_props(device_t *dev, unsigned int baud_rate, 860 unsigned int parity, unsigned int word_length, unsigned int stop_bits) 864 861 { 865 862 printf(NAME ": ns8250_set_props: baud rate %d, parity 0x%x, word " … … 874 871 ns8250_port_interrupts_disable(port); 875 872 ret = ns8250_port_set_baud_rate(port, baud_rate); 876 if ( EOK == ret)873 if (ret == EOK) 877 874 ret = ns8250_port_set_com_props(port, parity, word_length, stop_bits); 878 875 ns8250_port_interrupts_enable(port); … … 887 884 * Configure the parameters of the serial communication. 888 885 */ 889 static void 890 ns8250_default_handler(device_t *dev, ipc_callid_t callid,ipc_call_t *call)886 static void ns8250_default_handler(device_t *dev, ipc_callid_t callid, 887 ipc_call_t *call) 891 888 { 892 889 ipcarg_t method = IPC_GET_METHOD(*call);
Note:
See TracChangeset
for help on using the changeset viewer.