FreeBSD/sys/dev/mps/mps.c
/*
 * For both register_events and update_events, the caller supplies a bitmap
 * of events that it _wants_.  These functions then turn that into a bitmask
 * suitable for the controller.
 */
For both register_events and update_events, the caller supplies a bitmap
of events that it _wants_.  These functions then turn that into a bitmask
suitable for the controller.
For both register_events and update_events the caller supplies a bitmap of events that it _wants_ . These functions then turn that into a bitmask suitable for the controller .
int
mps_register_events(struct mps_softc *sc, u32 *mask,
    mps_evt_callback_t *cb, void *data, struct mps_event_handle **handle)
{
	struct mps_event_handle *eh;
	int error = 0;
	eh = malloc(sizeof(struct mps_event_handle), M_MPT2, M_WAITOK|M_ZERO);
	if(!eh) {
		device_printf(sc->mps_dev, "Cannot allocate memory %s %d\n",
		 __func__, __LINE__);
		return (ENOMEM);
	}
	eh->callback = cb;
	eh->data = data;
	TAILQ_INSERT_TAIL(&sc->event_list, eh, eh_list);
	if (mask != NULL)
		error = mps_update_events(sc, eh, mask);
	*handle = eh;
	return (error);
}
int mps_register_events ( struct mps_softc * sc , u32 * mask , mps_evt_callback_t * cb , void * data , struct mps_event_handle * * handle ) { struct mps_event_handle * eh ; int error = 0 ; eh = malloc ( sizeof ( struct mps_event_handle ) , M_MPT2 , M_WAITOK | M_ZERO ) ; if ( ! eh ) { device_printf ( sc -> mps_dev , " \n " , __func__ , __LINE__ ) ; return ( ENOMEM ) ; } eh -> callback = cb ; eh -> data = data ; TAILQ_INSERT_TAIL ( & sc -> event_list , eh , eh_list ) ; if ( mask != NULL ) error = mps_update_events ( sc , eh , mask ) ; * handle = eh ; return ( error ) ; }
For both register_events and update_events, the caller supplies a bitmap
 of events that it _wants_.
For both register_events and update_events the caller supplies a bitmap of events that it _wants_ .