/* Requests ownership of an inbound doorbell resource and binds a callback function to the resource. Returns 0 if the request has been satisfied.  */
int rio_request_inb_dbell(struct rio_mport *mport, void *dev_id, u16 start, u16 end, void(*dinb)(struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info))
/* Requests ownership of an inbound doorbell resource and binds a callback function to the resource. Returns 0 if the request has been satisfied.  */
int rio_request_inb_dbell(struct rio_mport *mport, void *dev_id, u16 start, u16 end, void(*dinb)(struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info))
{
	int rc = 0;
	struct resource *res = kmalloc(sizeof(struct resource), GFP_KERNEL);
	if (res) {
		rio_init_dbell_res(res, start, end);
		if ((rc =
		     request_resource(&mport->riores[RIO_DOORBELL_RESOURCE],
				      res)) < 0) {
			kfree(res);
			goto out;
		}
		rc = rio_setup_inb_dbell(mport, dev_id, res, dinb);
	} else
		rc = -ENOMEM;
      out:
	return rc;
}