示例#1
0
int hda_i915_init(void)
{
	int err = 0;

	get_power = symbol_request(i915_request_power_well);
	if (!get_power) {
		pr_warn("hda-i915: get_power symbol get fail\n");
		return -ENODEV;
	}

	put_power = symbol_request(i915_release_power_well);
	if (!put_power) {
		symbol_put(i915_request_power_well);
		get_power = NULL;
		return -ENODEV;
	}

	get_cdclk = symbol_request(i915_get_cdclk_freq);
	if (!get_cdclk)	/* may have abnormal BCLK and audio playback rate */
		pr_warn("hda-i915: get_cdclk symbol get fail\n");

	pr_debug("HDA driver get symbol successfully from i915 module\n");

	return err;
}
示例#2
0
int hda_i915_init(bool is_broadwell)
{
	int err = 0;

	if (is_broadwell)
		get_power = symbol_request(i915_bdw_request_power_well);
	else
		get_power = symbol_request(i915_request_power_well);
	if (!get_power) {
		snd_printk(KERN_WARNING "hda-i915: get_power symbol get fail\n");
		return -ENODEV;
	}

	if (is_broadwell)
		put_power = symbol_request(i915_bdw_release_power_well);
	else
		put_power = symbol_request(i915_release_power_well);
	if (!put_power) {
		symbol_put(i915_request_power_well);
		get_power = NULL;
		return -ENODEV;
	}

	snd_printd("HDA driver get symbol successfully from i915 module\n");

	return err;
}
示例#3
0
int amdgpu_amdkfd_init(void)
{
	int ret;

#if defined(CONFIG_HSA_AMD_MODULE)
	int (*kgd2kfd_init_p)(unsigned, const struct kgd2kfd_calls**);

	kgd2kfd_init_p = symbol_request(kgd2kfd_init);

	if (kgd2kfd_init_p == NULL)
		return -ENOENT;

	ret = kgd2kfd_init_p(KFD_INTERFACE_VERSION, &kgd2kfd);
	if (ret) {
		symbol_put(kgd2kfd_init);
		kgd2kfd = NULL;
	}

#elif defined(CONFIG_HSA_AMD)
	ret = kgd2kfd_init(KFD_INTERFACE_VERSION, &kgd2kfd);
	if (ret)
		kgd2kfd = NULL;

#else
	ret = -ENOENT;
#endif

	return ret;
}
示例#4
0
static void alc_fixup_dell_wmi(struct hda_codec *codec,
			       const struct hda_fixup *fix, int action)
{
	struct alc_spec *spec = codec->spec;
	bool removefunc = false;

	if (action == HDA_FIXUP_ACT_PROBE) {
		if (!dell_led_set_func)
			dell_led_set_func = symbol_request(dell_app_wmi_led_set);
		if (!dell_led_set_func) {
			codec_warn(codec, "Failed to find dell wmi symbol dell_app_wmi_led_set\n");
			return;
		}

		removefunc = true;
		if (dell_led_set_func(DELL_LED_MICMUTE, false) >= 0) {
			dell_led_value = 0;
			if (spec->gen.num_adc_nids > 1)
				codec_dbg(codec, "Skipping micmute LED control due to several ADCs");
			else {
				dell_old_cap_hook = spec->gen.cap_sync_hook;
				spec->gen.cap_sync_hook = update_dell_wmi_micmute_led;
				removefunc = false;
			}
		}

	}

	if (dell_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
		symbol_put(dell_app_wmi_led_set);
		dell_led_set_func = NULL;
		dell_old_cap_hook = NULL;
	}
}
int kfd_init_peer_direct(void)
{
	int result;

	pr_debug("Try to initialize PeerDirect support\n");

	pfn_ib_register_peer_memory_client =
		(void *(*)(struct peer_memory_client *,
			  invalidate_peer_memory *))
		symbol_request(ib_register_peer_memory_client);

	pfn_ib_unregister_peer_memory_client = (void (*)(void *))
		symbol_request(ib_unregister_peer_memory_client);

	if (!pfn_ib_register_peer_memory_client ||
		!pfn_ib_unregister_peer_memory_client) {
		pr_warn("amdkfd: PeerDirect interface was not detected\n");
		return -EINVAL;
	}

	result = amdkfd_query_rdma_interface(&rdma_interface);

	if (result < 0) {
		pr_err("amdkfd: Cannot get RDMA Interface (result = %d)\n",
				result);
		return result;
	}

	strcpy(amd_mem_client.name,    AMD_PEER_BRIDGE_DRIVER_NAME);
	strcpy(amd_mem_client.version, AMD_PEER_BRIDGE_DRIVER_VERSION);

	ib_reg_handle = pfn_ib_register_peer_memory_client(&amd_mem_client,
						&ib_invalidate_callback);

	if (!ib_reg_handle) {
		pr_err("amdkfd: Cannot register peer memory client\n");
		return -EINVAL;
	}

	pr_info("amdkfd: PeerDirect support was initialized successfully\n");
	return 0;
}
示例#6
0
static void __init DoC_Probe(unsigned long physadr)
{
	void __iomem *docptr;
	struct DiskOnChip *this;
	struct mtd_info *mtd;
	int ChipID;
	char namebuf[15];
	char *name = namebuf;
	void (*initroutine)(struct mtd_info *) = NULL;

	docptr = ioremap(physadr, DOC_IOREMAP_LEN);

	if (!docptr)
		return;

	if ((ChipID = doccheck(docptr, physadr))) {
		if (ChipID == DOC_ChipID_Doc2kTSOP) {
			/* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */
			printk(KERN_NOTICE "Refusing to drive DiskOnChip 2000 TSOP until Bad Block Table is correctly supported by INFTL\n");
			iounmap(docptr);
			return;
		}
		docfound = 1;
		mtd = kmalloc(sizeof(struct DiskOnChip) + sizeof(struct mtd_info), GFP_KERNEL);

		if (!mtd) {
			printk(KERN_WARNING "Cannot allocate memory for data structures. Dropping.\n");
			iounmap(docptr);
			return;
		}

		this = (struct DiskOnChip *)(&mtd[1]);

		memset((char *)mtd,0, sizeof(struct mtd_info));
		memset((char *)this, 0, sizeof(struct DiskOnChip));

		mtd->priv = this;
		this->virtadr = docptr;
		this->physadr = physadr;
		this->ChipID = ChipID;
		sprintf(namebuf, "with ChipID %2.2X", ChipID);

		switch(ChipID) {
		case DOC_ChipID_Doc2kTSOP:
			name="2000 TSOP";
			initroutine = symbol_request(DoC2k_init);
			break;

		case DOC_ChipID_Doc2k:
			name="2000";
			initroutine = symbol_request(DoC2k_init);
			break;

		case DOC_ChipID_DocMil:
			name="Millennium";
#ifdef DOC_SINGLE_DRIVER
			initroutine = symbol_request(DoC2k_init);
#else
			initroutine = symbol_request(DoCMil_init);
#endif /* DOC_SINGLE_DRIVER */
			break;

		case DOC_ChipID_DocMilPlus16:
		case DOC_ChipID_DocMilPlus32:
			name="MillenniumPlus";
			initroutine = symbol_request(DoCMilPlus_init);
			break;
		}

		if (initroutine) {
			(*initroutine)(mtd);
			symbol_put_addr(initroutine);
			return;
		}
		printk(KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n", name, physadr);
		kfree(mtd);
	}
	iounmap(docptr);
}
示例#7
0
/*
 * out_sz (out) size of data put into it by process_kex_msg
 *        (in)  space available in out_buf
 */
int process_kex_msg(struct priv_crypt_ctx *cctx,
		    size_t *out_sz, u8 *out_buf,
		    size_t in_sz, u8 *in_buf)
{
	int rc = -1, i;
	u8 msg_type;
	u8 key_buf[MAX_KEY_LEN];
	struct dhm_kex *kex;
	const struct dhm_kex_ops *kex_ops;
#ifdef KEX_DEBUG
	const size_t debug_msg_sz = 256;
#endif

	if (in_sz < sizeof(u8)) {
		printk(KERN_ERR "kex_msg too short\n");
		rc = -1;
		goto out;
	}

	msg_type = in_buf[0];

	DPRINTF("%s: msg type %u\n", __func__, (unsigned int)msg_type);
	switch (msg_type) {
	case PRIV_CRYPT_KEX_PARAMS:
		kex_ops = symbol_request(cm_dhm_kex_ops);
		if (kex_ops == NULL) {
			printk(KERN_ERR "cannot load kex operations\n");
			goto put;
		}

		if ((rc = kex_ops->init(&kex)) < 0)
			goto put;

		*out_sz -= 1;
		if ((rc = kex_ops->respond(kex,
					   out_sz, out_buf+1,
					   in_sz-1, in_buf+1)) < 0)
			goto destroy;
		*out_sz += 1;

		if ((rc = kex_ops->get_key(kex, cctx->key_size, key_buf)) < 0)
			goto destroy;
		if ((rc = priv_set_key(cctx, cctx->key_size, key_buf)) < 0)
			goto destroy;

	destroy:
		kex_ops->destroy(kex);
		out_buf[0] = PRIV_CRYPT_KEX_RESPONSE;

	put:
		symbol_put(cm_dhm_kex_ops);

		if (rc < 0)
			goto out;

		break;
#ifdef KEX_DEBUG
	case PRIV_CRYPT_KEX_DEBUG:
		DPRINTF("message:\n");
		DPRINT_HEX(in_sz - sizeof(u8), in_buf + sizeof(u8));

		/* debug response message */
		out_buf[0] = PRIV_CRYPT_KEX_DEBUG;
		for (i = sizeof(u8); i < sizeof(u8) + debug_msg_sz; i++) {
			out_buf[i] = (u8)(i - 1);
		}
		*out_sz = sizeof(u8) + debug_msg_sz;
		break;
#endif
	default:
		printk(KERN_ERR "%s: unknown msg type %u\n",
		       __func__, msg_type);
		goto out;
		break;
	}

	rc = 0;

 out:
	memset(key_buf, 0, sizeof(key_buf));
	return rc;
}