/* Requests ownership of an outbound mailbox resource and binds a callback function to the resource. Returns 0 on success.  */
int rio_request_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries, void(*moutb)(struct rio_mport *mport, void *dev_id, int mbox, int slot))
/* Requests ownership of an outbound mailbox resource and binds a callback function to the resource. Returns 0 on success.  */
int rio_request_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries, void(*moutb)(struct rio_mport *mport, void *dev_id, int mbox, int slot))
{
	int rc = 0;
	struct resource *res = kmalloc(sizeof(struct resource), GFP_KERNEL);
	if (res) {
		rio_init_mbox_res(res, mbox, mbox);
		if ((rc =
		     request_resource(&mport->riores[RIO_OUTB_MBOX_RESOURCE],
				      res)) < 0) {
			kfree(res);
			goto out;
		}
		mport->outb_msg[mbox].res = res;
		mport->outb_msg[mbox].mcback = moutb;
		rc = rio_open_outb_mbox(mport, dev_id, mbox, entries);
	} else
		rc = -ENOMEM;
      out:
	return rc;
}