Changeset 46b881c in mainline for uspace/lib/drv/generic/driver.c


Ignore:
Timestamp:
2011-01-29T11:36:41Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b6931a, 8add9ca5
Parents:
e26a4633 (diff), ffa2c8ef (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

IPC/async: strictly isolate the use of low-level IPC methods (ipc_*) and async framework methods (async_*) in user code, do not allow a mixture of both in a single source file

Benefits for future plans

  • The async framework could use different communication style under the hood, but keeping the same high-level API
  • The async framework can be integrated more tightly with sessions without potential problems of intermixing session-aware async methods with session-unaware low-level methods in user code
  • The async_serialize_start()/_end() can be deprecated more easily
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    re26a4633 r46b881c  
    186186                pseudocode = &default_pseudocode;
    187187       
    188         int res = ipc_register_irq(irq, dev->handle, ctx->id, pseudocode);
     188        int res = register_irq(irq, dev->handle, ctx->id, pseudocode);
    189189        if (res != EOK) {
    190190                remove_interrupt_context(&interrupt_contexts, ctx);
     
    199199        interrupt_context_t *ctx = find_interrupt_context(&interrupt_contexts,
    200200            dev, irq);
    201         int res = ipc_unregister_irq(irq, dev->handle);
     201        int res = unregister_irq(irq, dev->handle);
    202202       
    203203        if (ctx != NULL) {
     
    272272        }
    273273       
    274         ipc_answer_0(iid, res);
     274        async_answer_0(iid, res);
    275275}
    276276
     
    278278{
    279279        /* Accept connection */
    280         ipc_answer_0(iid, EOK);
     280        async_answer_0(iid, EOK);
    281281       
    282282        bool cont = true;
     
    293293                        break;
    294294                default:
    295                         ipc_answer_0(callid, ENOENT);
     295                        async_answer_0(callid, ENOENT);
    296296                }
    297297        }
     
    316316                printf("%s: driver_connection_gen error - no device with handle"
    317317                    " %" PRIun " was found.\n", driver->name, handle);
    318                 ipc_answer_0(iid, ENOENT);
     318                async_answer_0(iid, ENOENT);
    319319                return;
    320320        }
     
    331331                ret = (*dev->ops->open)(dev);
    332332       
    333         ipc_answer_0(iid, ret);
     333        async_answer_0(iid, ret);
    334334        if (ret != EOK)
    335335                return;
     
    347347                        if (dev->ops != NULL && dev->ops->close != NULL)
    348348                                (*dev->ops->close)(dev);
    349                         ipc_answer_0(callid, EOK);
     349                        async_answer_0(callid, EOK);
    350350                        return;
    351351                default:
     
    368368                                    "invalid interface id %d.",
    369369                                    driver->name, iface_idx);
    370                                 ipc_answer_0(callid, ENOTSUP);
     370                                async_answer_0(callid, ENOTSUP);
    371371                                break;
    372372                        }
     
    381381                                printf("device with handle %" PRIun " has no interface "
    382382                                    "with id %d.\n", handle, iface_idx);
    383                                 ipc_answer_0(callid, ENOTSUP);
     383                                async_answer_0(callid, ENOTSUP);
    384384                                break;
    385385                        }
     
    400400                                printf("%s: driver_connection_gen error - "
    401401                                    "invalid interface method.", driver->name);
    402                                 ipc_answer_0(callid, ENOTSUP);
     402                                async_answer_0(callid, ENOTSUP);
    403403                                break;
    404404                        }
     
    446446        default:
    447447                /* No such interface */
    448                 ipc_answer_0(iid, ENOENT);
     448                async_answer_0(iid, ENOENT);
    449449        }
    450450}
Note: See TracChangeset for help on using the changeset viewer.