/** * kernfs_create_root - create a new kernfs hierarchy * @scops: optional syscall operations for the hierarchy * @flags: KERNFS_ROOT_* flags * @priv: opaque data associated with the new directory * * Returns the root of the new hierarchy on success, ERR_PTR() value on * failure. */ struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops, unsigned int flags, void *priv) { struct kernfs_root *root; struct kernfs_node *kn; root = kzalloc(sizeof(*root), GFP_KERNEL); if (!root) return ERR_PTR(-ENOMEM); ida_init(&root->ino_ida); INIT_LIST_HEAD(&root->supers); kn = __kernfs_new_node(root, "", S_IFDIR | S_IRUGO | S_IXUGO, KERNFS_DIR); if (!kn) { ida_destroy(&root->ino_ida); kfree(root); return ERR_PTR(-ENOMEM); } kn->priv = priv; kn->dir.root = root; root->syscall_ops = scops; root->flags = flags; root->kn = kn; init_waitqueue_head(&root->deactivate_waitq); if (!(root->flags & KERNFS_ROOT_CREATE_DEACTIVATED)) kernfs_activate(kn); return root; }
/*! 2017. 1.07 study -ing */ struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv) { struct kernfs_root *root; struct kernfs_node *kn; root = kzalloc(sizeof(*root), GFP_KERNEL); if (!root) return ERR_PTR(-ENOMEM); ida_init(&root->ino_ida); kn = __kernfs_new_node(root, "", S_IFDIR | S_IRUGO | S_IXUGO, KERNFS_DIR); if (!kn) { ida_destroy(&root->ino_ida); kfree(root); return ERR_PTR(-ENOMEM); } /*! 초기값 대입 */ kn->flags &= ~KERNFS_REMOVED; kn->priv = priv; kn->dir.root = root; root->dir_ops = kdops; root->kn = kn; return root; }
static int __init w1_ds2760_init(void) { printk(KERN_INFO "1-Wire driver for the DS2760 battery monitor " " chip - (c) 2004-2005, Szabolcs Gyurko\n"); ida_init(&bat_ida); return w1_register_family(&w1_ds2760_family); }
int i915_gem_context_init(struct drm_i915_private *dev_priv) { struct i915_gem_context *ctx; /* Init should only be called once per module load. Eventually the * restriction on the context_disabled check can be loosened. */ if (WARN_ON(dev_priv->kernel_context)) return 0; if (intel_vgpu_active(dev_priv) && HAS_LOGICAL_RING_CONTEXTS(dev_priv)) { if (!i915.enable_execlists) { DRM_INFO("Only EXECLIST mode is supported in vgpu.\n"); return -EINVAL; } } /* Using the simple ida interface, the max is limited by sizeof(int) */ BUILD_BUG_ON(MAX_CONTEXT_HW_ID > INT_MAX); ida_init(&dev_priv->context_hw_ida); if (i915.enable_execlists) { /* NB: intentionally left blank. We will allocate our own * backing objects as we need them, thank you very much */ dev_priv->hw_context_size = 0; } else if (HAS_HW_CONTEXTS(dev_priv)) { dev_priv->hw_context_size = round_up(get_context_size(dev_priv), I915_GTT_PAGE_SIZE); if (dev_priv->hw_context_size > (1<<20)) { DRM_DEBUG_DRIVER("Disabling HW Contexts; invalid size %d\n", dev_priv->hw_context_size); dev_priv->hw_context_size = 0; } } ctx = i915_gem_create_context(dev_priv, NULL); if (IS_ERR(ctx)) { DRM_ERROR("Failed to create default global context (error %ld)\n", PTR_ERR(ctx)); return PTR_ERR(ctx); } /* For easy recognisablity, we want the kernel context to be 0 and then * all user contexts will have non-zero hw_id. */ GEM_BUG_ON(ctx->hw_id); i915_gem_context_clear_bannable(ctx); ctx->priority = I915_PRIORITY_MIN; /* lowest priority; idle task */ dev_priv->kernel_context = ctx; GEM_BUG_ON(!i915_gem_context_is_kernel(ctx)); DRM_DEBUG_DRIVER("%s context support initialized\n", i915.enable_execlists ? "LR" : dev_priv->hw_context_size ? "HW" : "fake"); return 0; }
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver, struct device *parent, size_t buffer_size_max) { struct greybus_host_device *hd; /* * Validate that the driver implements all of the callbacks * so that we don't have to every time we make them. */ if ((!driver->message_send) || (!driver->message_cancel)) { pr_err("Must implement all greybus_host_driver callbacks!\n"); return ERR_PTR(-EINVAL); } if (buffer_size_max < GB_OPERATION_MESSAGE_SIZE_MIN) { dev_err(parent, "greybus host-device buffers too small\n"); return NULL; } /* * Make sure to never allocate messages larger than what the Greybus * protocol supports. */ if (buffer_size_max > GB_OPERATION_MESSAGE_SIZE_MAX) { dev_warn(parent, "limiting buffer size to %u\n", GB_OPERATION_MESSAGE_SIZE_MAX); buffer_size_max = GB_OPERATION_MESSAGE_SIZE_MAX; } hd = kzalloc(sizeof(*hd) + driver->hd_priv_size, GFP_KERNEL); if (!hd) return ERR_PTR(-ENOMEM); kref_init(&hd->kref); hd->parent = parent; hd->driver = driver; INIT_LIST_HEAD(&hd->interfaces); INIT_LIST_HEAD(&hd->connections); ida_init(&hd->cport_id_map); hd->buffer_size_max = buffer_size_max; /* * Initialize AP's SVC protocol connection: * * This is required as part of early initialization of the host device * as we need this connection in order to start any kind of message * exchange between the AP and the SVC. SVC will start with a * 'get-version' request followed by a 'svc-hello' message and at that * time we will create a fully initialized svc-connection, as we need * endo-id and AP's interface id for that. */ if (!gb_ap_svc_connection_create(hd)) { kref_put_mutex(&hd->kref, free_hd, &hd_mutex); return ERR_PTR(-ENOMEM); } return hd; }
void mlx5_init_reserved_gids(struct mlx5_core_dev *dev) { unsigned int tblsz = MLX5_CAP_ROCE(dev, roce_address_table_size); ida_init(&dev->roce.reserved_gids.ida); dev->roce.reserved_gids.start = tblsz; dev->roce.reserved_gids.count = 0; }
static int init(void) { ida_init(&ida); class = class_create(THIS_MODULE, "dce6_display"); if (IS_ERR_OR_NULL(class)) { if (IS_ERR(class)) return PTR_ERR(class); else return -ENOMEM; }
static void *new_pts_fs_info(void) { struct pts_fs_info *fsi; fsi = kzalloc(sizeof(struct pts_fs_info), GFP_KERNEL); if (!fsi) return NULL; ida_init(&fsi->allocated_ptys); fsi->mount_opts.mode = DEVPTS_DEFAULT_MODE; fsi->mount_opts.ptmxmode = DEVPTS_DEFAULT_PTMX_MODE; return fsi; }
int main(int argc, char* argv[]) { //freopen( "stderr.log", "w", stderr ); struct timeval tvBegin, tvReceiving, tvEnd, t1, t2, totalTime; // Initial timestamp gettimeofday(&tvBegin, NULL); timeval_print(&tvBegin); //INPUTS: Filename to Decode char * filename = argv[1]; ida_init("../src/zhtNeighborFile", "../lib/ZHT/zht.cfg"); ida_download(filename); // Take final timestamp gettimeofday(&tvEnd, NULL); timeval_print(&tvEnd); // Compute throughput: timeval_subtract(&totalTime, &tvEnd, &tvBegin); // Filesize FILE *file; file = fopen(filename, "rb"); if(!file){ dbgprintf("Metadata Fill ERROR: %s\n", strerror(errno)); exit(EXIT_FAILURE);//maybe a return 1 could be appropriate? } fseek(file, 0L, SEEK_END); int fileSize = ftell(file); fclose(file); double throughputTotal = fileSize / (double)(1000000 * totalTime.tv_sec + totalTime.tv_usec); // printf's separated by commas for the CSV printf("%s,%lu,%f\n", filename, fileSize, throughputTotal); ida_finalize(); return 0; }
static int vmw_gmrid_man_init(struct ttm_mem_type_manager *man, unsigned long p_size) { struct vmw_private *dev_priv = container_of(man->bdev, struct vmw_private, bdev); struct vmwgfx_gmrid_man *gman = kzalloc(sizeof(*gman), GFP_KERNEL); if (unlikely(gman == NULL)) return -ENOMEM; spin_lock_init(&gman->lock); gman->max_gmr_pages = dev_priv->max_gmr_pages; gman->used_gmr_pages = 0; ida_init(&gman->gmr_ida); gman->max_gmr_ids = p_size; man->priv = (void *) gman; return 0; }
static int ida_eisa_attach(device_t dev) { struct ida_softc *ida; struct ida_board *board; int error; int rid; ida = device_get_softc(dev); ida->dev = dev; board = ida_eisa_match(eisa_get_id(dev)); ida->cmd = *board->accessor; ida->flags = board->flags; mtx_init(&ida->lock, "ida", NULL, MTX_DEF); callout_init_mtx(&ida->ch, &ida->lock, 0); ida->regs_res_type = SYS_RES_IOPORT; ida->regs_res_id = 0; ida->regs = bus_alloc_resource_any(dev, ida->regs_res_type, &ida->regs_res_id, RF_ACTIVE); if (ida->regs == NULL) { device_printf(dev, "can't allocate register resources\n"); return (ENOMEM); } error = bus_dma_tag_create( /* parent */ bus_get_dma_tag(dev), /* alignment */ 0, /* boundary */ 0, /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, /* filterarg */ NULL, /* maxsize */ MAXBSIZE, /* nsegments */ IDA_NSEG, /* maxsegsize */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ BUS_DMA_ALLOCNOW, /* lockfunc */ NULL, /* lockarg */ NULL, &ida->parent_dmat); if (error != 0) { device_printf(dev, "can't allocate DMA tag\n"); ida_free(ida); return (ENOMEM); } rid = 0; ida->irq_res_type = SYS_RES_IRQ; ida->irq = bus_alloc_resource_any(dev, ida->irq_res_type, &rid, RF_ACTIVE | RF_SHAREABLE); if (ida->irq == NULL) { ida_free(ida); return (ENOMEM); } error = bus_setup_intr(dev, ida->irq, INTR_TYPE_BIO | INTR_ENTROPY | INTR_MPSAFE, NULL, ida_intr, ida, &ida->ih); if (error) { device_printf(dev, "can't setup interrupt\n"); ida_free(ida); return (ENOMEM); } error = ida_init(ida); if (error) { ida_free(ida); return (error); } return (0); }
static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, struct nd_region_desc *ndr_desc, struct device_type *dev_type, const char *caller) { struct nd_region *nd_region; struct device *dev; void *region_buf; unsigned int i; int ro = 0; for (i = 0; i < ndr_desc->num_mappings; i++) { struct nd_mapping *nd_mapping = &ndr_desc->nd_mapping[i]; struct nvdimm *nvdimm = nd_mapping->nvdimm; if ((nd_mapping->start | nd_mapping->size) % SZ_4K) { dev_err(&nvdimm_bus->dev, "%s: %s mapping%d is not 4K aligned\n", caller, dev_name(&nvdimm->dev), i); return NULL; } if (nvdimm->flags & NDD_UNARMED) ro = 1; } if (dev_type == &nd_blk_device_type) { struct nd_blk_region_desc *ndbr_desc; struct nd_blk_region *ndbr; ndbr_desc = to_blk_region_desc(ndr_desc); ndbr = kzalloc(sizeof(*ndbr) + sizeof(struct nd_mapping) * ndr_desc->num_mappings, GFP_KERNEL); if (ndbr) { nd_region = &ndbr->nd_region; ndbr->enable = ndbr_desc->enable; ndbr->disable = ndbr_desc->disable; ndbr->do_io = ndbr_desc->do_io; } region_buf = ndbr; } else { nd_region = kzalloc(sizeof(struct nd_region) + sizeof(struct nd_mapping) * ndr_desc->num_mappings, GFP_KERNEL); region_buf = nd_region; } if (!region_buf) return NULL; nd_region->id = ida_simple_get(®ion_ida, 0, 0, GFP_KERNEL); if (nd_region->id < 0) goto err_id; nd_region->lane = alloc_percpu(struct nd_percpu_lane); if (!nd_region->lane) goto err_percpu; for (i = 0; i < nr_cpu_ids; i++) { struct nd_percpu_lane *ndl; ndl = per_cpu_ptr(nd_region->lane, i); spin_lock_init(&ndl->lock); ndl->count = 0; } memcpy(nd_region->mapping, ndr_desc->nd_mapping, sizeof(struct nd_mapping) * ndr_desc->num_mappings); for (i = 0; i < ndr_desc->num_mappings; i++) { struct nd_mapping *nd_mapping = &ndr_desc->nd_mapping[i]; struct nvdimm *nvdimm = nd_mapping->nvdimm; get_device(&nvdimm->dev); } nd_region->ndr_mappings = ndr_desc->num_mappings; nd_region->provider_data = ndr_desc->provider_data; nd_region->nd_set = ndr_desc->nd_set; nd_region->num_lanes = ndr_desc->num_lanes; nd_region->flags = ndr_desc->flags; nd_region->ro = ro; nd_region->numa_node = ndr_desc->numa_node; ida_init(&nd_region->ns_ida); ida_init(&nd_region->btt_ida); ida_init(&nd_region->pfn_ida); dev = &nd_region->dev; dev_set_name(dev, "region%d", nd_region->id); dev->parent = &nvdimm_bus->dev; dev->type = dev_type; dev->groups = ndr_desc->attr_groups; nd_region->ndr_size = resource_size(ndr_desc->res); nd_region->ndr_start = ndr_desc->res->start; nd_device_register(dev); return nd_region; err_percpu: ida_simple_remove(®ion_ida, nd_region->id); err_id: kfree(region_buf); return NULL; }
void nouveau_backlight_ctor(void) { ida_init(&bl_ida); }
static int flexrm_mbox_probe(struct platform_device *pdev) { int index, ret = 0; void __iomem *regs; void __iomem *regs_end; struct msi_desc *desc; struct resource *iomem; struct flexrm_ring *ring; struct flexrm_mbox *mbox; struct device *dev = &pdev->dev; /* Allocate driver mailbox struct */ mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); if (!mbox) { ret = -ENOMEM; goto fail; } mbox->dev = dev; platform_set_drvdata(pdev, mbox); /* Get resource for registers */ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!iomem || (resource_size(iomem) < RING_REGS_SIZE)) { ret = -ENODEV; goto fail; } /* Map registers of all rings */ mbox->regs = devm_ioremap_resource(&pdev->dev, iomem); if (IS_ERR(mbox->regs)) { ret = PTR_ERR(mbox->regs); dev_err(&pdev->dev, "Failed to remap mailbox regs: %d\n", ret); goto fail; } regs_end = mbox->regs + resource_size(iomem); /* Scan and count available rings */ mbox->num_rings = 0; for (regs = mbox->regs; regs < regs_end; regs += RING_REGS_SIZE) { if (readl_relaxed(regs + RING_VER) == RING_VER_MAGIC) mbox->num_rings++; } if (!mbox->num_rings) { ret = -ENODEV; goto fail; } /* Allocate driver ring structs */ ring = devm_kcalloc(dev, mbox->num_rings, sizeof(*ring), GFP_KERNEL); if (!ring) { ret = -ENOMEM; goto fail; } mbox->rings = ring; /* Initialize members of driver ring structs */ regs = mbox->regs; for (index = 0; index < mbox->num_rings; index++) { ring = &mbox->rings[index]; ring->num = index; ring->mbox = mbox; while ((regs < regs_end) && (readl_relaxed(regs + RING_VER) != RING_VER_MAGIC)) regs += RING_REGS_SIZE; if (regs_end <= regs) { ret = -ENODEV; goto fail; } ring->regs = regs; regs += RING_REGS_SIZE; ring->irq = UINT_MAX; ring->irq_requested = false; ring->msi_timer_val = MSI_TIMER_VAL_MASK; ring->msi_count_threshold = 0x1; ida_init(&ring->requests_ida); memset(ring->requests, 0, sizeof(ring->requests)); ring->bd_base = NULL; ring->bd_dma_base = 0; ring->cmpl_base = NULL; ring->cmpl_dma_base = 0; spin_lock_init(&ring->lock); ring->last_pending_msg = NULL; ring->cmpl_read_offset = 0; } /* FlexRM is capable of 40-bit physical addresses only */ ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); if (ret) { ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); if (ret) goto fail; } /* Create DMA pool for ring BD memory */ mbox->bd_pool = dma_pool_create("bd", dev, RING_BD_SIZE, 1 << RING_BD_ALIGN_ORDER, 0); if (!mbox->bd_pool) { ret = -ENOMEM; goto fail; } /* Create DMA pool for ring completion memory */ mbox->cmpl_pool = dma_pool_create("cmpl", dev, RING_CMPL_SIZE, 1 << RING_CMPL_ALIGN_ORDER, 0); if (!mbox->cmpl_pool) { ret = -ENOMEM; goto fail_destroy_bd_pool; } /* Allocate platform MSIs for each ring */ ret = platform_msi_domain_alloc_irqs(dev, mbox->num_rings, flexrm_mbox_msi_write); if (ret) goto fail_destroy_cmpl_pool; /* Save alloced IRQ numbers for each ring */ for_each_msi_entry(desc, dev) { ring = &mbox->rings[desc->platform.msi_index]; ring->irq = desc->irq; }
static int __init w1_ds2781_init(void) { ida_init(&bat_ida); return w1_register_family(&w1_ds2781_family); }
static int henry_drv_probe(struct see_client *clnt) { int ret = 0; struct henry_drv *drv = NULL; drv = kzalloc(sizeof(struct henry_drv), GFP_KERNEL); if (!drv) return -ENOMEM; ret = alloc_chrdev_region(&drv->dev_num, 0, 1, HENRY_DEV); if (ret < 0) return ret; cdev_init(&drv->cdev, &g_henry_fops); drv->cdev.owner = THIS_MODULE; ret = cdev_add(&drv->cdev, drv->dev_num, 1); if (ret < 0) goto out; drv->dev_class = class_create(THIS_MODULE, HENRY_CLASS); if (IS_ERR_OR_NULL(drv->dev_class)) { ret = PTR_ERR(drv->dev_class); goto out; } drv->dev = device_create(drv->dev_class, NULL, drv->dev_num, drv, HENRY_DEV); if (IS_ERR_OR_NULL(drv->dev)) { ret = PTR_ERR(drv->dev); goto out; } mutex_init(&drv->mutex); drv->num_exist = 0; drv->debug_mode = 0; ida_init(&drv->sess_ida); dev_set_drvdata(&clnt->dev, drv); henry_sysfs_create(drv); henry_dbgfs_create(drv); dev_info(&clnt->dev, "HENRY driver probed\n"); out: if (unlikely(ret)) { if (drv->dev_class) { /* device_create */ device_destroy(drv->dev_class, drv->dev_num); /* cdev_add */ cdev_del(&drv->cdev); /* class_create */ class_destroy(drv->dev_class); /* alloc_chrdev_region */ unregister_chrdev_region(drv->dev_num, 1); } kfree(drv); } return ret; }
static int ida_pci_attach(device_t dev) { struct ida_board *board = ida_pci_match(dev); u_int32_t id = pci_get_devid(dev); struct ida_softc *ida; u_int command; int error, rid; command = pci_read_config(dev, PCIR_COMMAND, 1); /* * it appears that this board only does MEMIO access. */ if ((command & PCIM_CMD_MEMEN) == 0) { device_printf(dev, "Only memory mapped I/O is supported\n"); return (ENXIO); } ida = (struct ida_softc *)device_get_softc(dev); ida->dev = dev; ida->cmd = *board->accessor; ida->flags = board->flags; ida->regs_res_type = SYS_RES_MEMORY; ida->regs_res_id = IDA_PCI_MEMADDR; if (id == IDA_DEVICEID_DEC_SMART) ida->regs_res_id = PCIR_BAR(0); ida->regs = bus_alloc_resource_any(dev, ida->regs_res_type, &ida->regs_res_id, RF_ACTIVE); if (ida->regs == NULL) { device_printf(dev, "can't allocate memory resources\n"); return (ENOMEM); } error = bus_dma_tag_create( /* parent */ NULL, /* alignment */ 1, /* boundary */ 0, /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, /* filterarg */ NULL, /* maxsize */ MAXBSIZE, /* nsegments */ IDA_NSEG, /* maxsegsize */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ BUS_DMA_ALLOCNOW, /* lockfunc */ NULL, /* lockarg */ NULL, &ida->parent_dmat); if (error != 0) { device_printf(dev, "can't allocate DMA tag\n"); ida_free(ida); return (ENOMEM); } rid = 0; ida->irq_res_type = SYS_RES_IRQ; ida->irq = bus_alloc_resource_any(dev, ida->irq_res_type, &rid, RF_ACTIVE | RF_SHAREABLE); if (ida->irq == NULL) { ida_free(ida); return (ENOMEM); } error = bus_setup_intr(dev, ida->irq, INTR_TYPE_BIO | INTR_ENTROPY, NULL, ida_intr, ida, &ida->ih); if (error) { device_printf(dev, "can't setup interrupt\n"); ida_free(ida); return (ENOMEM); } error = ida_init(ida); if (error) { ida_free(ida); return (error); } ida_attach(ida); ida->flags |= IDA_ATTACHED; return (0); }
static int __init ipack_init(void) { ida_init(&ipack_ida); return bus_register(&ipack_bus_type); }
int __init gb_hd_init(void) { ida_init(&gb_hd_bus_id_map); return 0; }
struct gb_host_device *gb_hd_create(struct gb_hd_driver *driver, struct device *parent, size_t buffer_size_max, size_t num_cports) { struct gb_host_device *hd; int ret; /* * Validate that the driver implements all of the callbacks * so that we don't have to every time we make them. */ if ((!driver->message_send) || (!driver->message_cancel)) { pr_err("Must implement all gb_hd_driver callbacks!\n"); return ERR_PTR(-EINVAL); } if (buffer_size_max < GB_OPERATION_MESSAGE_SIZE_MIN) { dev_err(parent, "greybus host-device buffers too small\n"); return ERR_PTR(-EINVAL); } if (num_cports == 0 || num_cports > CPORT_ID_MAX + 1) { dev_err(parent, "Invalid number of CPorts: %zu\n", num_cports); return ERR_PTR(-EINVAL); } /* * Make sure to never allocate messages larger than what the Greybus * protocol supports. */ if (buffer_size_max > GB_OPERATION_MESSAGE_SIZE_MAX) { dev_warn(parent, "limiting buffer size to %u\n", GB_OPERATION_MESSAGE_SIZE_MAX); buffer_size_max = GB_OPERATION_MESSAGE_SIZE_MAX; } hd = kzalloc(sizeof(*hd) + driver->hd_priv_size, GFP_KERNEL); if (!hd) return ERR_PTR(-ENOMEM); ret = ida_simple_get(&gb_hd_bus_id_map, 1, 0, GFP_KERNEL); if (ret < 0) { kfree(hd); return ERR_PTR(ret); } hd->bus_id = ret; hd->driver = driver; INIT_LIST_HEAD(&hd->interfaces); INIT_LIST_HEAD(&hd->connections); ida_init(&hd->cport_id_map); hd->buffer_size_max = buffer_size_max; hd->num_cports = num_cports; hd->dev.parent = parent; hd->dev.bus = &greybus_bus_type; hd->dev.type = &greybus_hd_type; hd->dev.dma_mask = hd->dev.parent->dma_mask; device_initialize(&hd->dev); dev_set_name(&hd->dev, "greybus%d", hd->bus_id); hd->svc = gb_svc_create(hd); if (!hd->svc) { dev_err(&hd->dev, "failed to create svc\n"); put_device(&hd->dev); return ERR_PTR(-ENOMEM); } return hd; }