当前位置: 首页>>代码示例>>C++>>正文


C++ rfkill_register函数代码示例

本文整理汇总了C++中rfkill_register函数的典型用法代码示例。如果您正苦于以下问题:C++ rfkill_register函数的具体用法?C++ rfkill_register怎么用?C++ rfkill_register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rfkill_register函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rfkill_init

static int rfkill_init(struct platform_device *sdev)
{
	/* add rfkill */
	int retval;

	/* keep the hardware wireless state */
	get_wireless_state_ec_standard();

	rfk_bluetooth = rfkill_alloc("msi-bluetooth", &sdev->dev,
				RFKILL_TYPE_BLUETOOTH,
				&rfkill_bluetooth_ops, NULL);
	if (!rfk_bluetooth) {
		retval = -ENOMEM;
		goto err_bluetooth;
	}
	retval = rfkill_register(rfk_bluetooth);
	if (retval)
		goto err_bluetooth;

	rfk_wlan = rfkill_alloc("msi-wlan", &sdev->dev, RFKILL_TYPE_WLAN,
				&rfkill_wlan_ops, NULL);
	if (!rfk_wlan) {
		retval = -ENOMEM;
		goto err_wlan;
	}
	retval = rfkill_register(rfk_wlan);
	if (retval)
		goto err_wlan;

	if (threeg_exists) {
		rfk_threeg = rfkill_alloc("msi-threeg", &sdev->dev,
				RFKILL_TYPE_WWAN, &rfkill_threeg_ops, NULL);
		if (!rfk_threeg) {
			retval = -ENOMEM;
			goto err_threeg;
		}
		retval = rfkill_register(rfk_threeg);
		if (retval)
			goto err_threeg;
	}

	/* schedule to run rfkill state initial */
	schedule_delayed_work(&msi_rfkill_init,
				round_jiffies_relative(1 * HZ));

	return 0;

err_threeg:
	rfkill_destroy(rfk_threeg);
	if (rfk_wlan)
		rfkill_unregister(rfk_wlan);
err_wlan:
	rfkill_destroy(rfk_wlan);
	if (rfk_bluetooth)
		rfkill_unregister(rfk_bluetooth);
err_bluetooth:
	rfkill_destroy(rfk_bluetooth);

	return retval;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:60,代码来源:msi-laptop.c

示例2: rfkill_init

static int rfkill_init(struct platform_device *sdev)
{
	/* add rfkill */
	int retval;

	rfk_bluetooth = rfkill_alloc("msi-bluetooth", &sdev->dev,
				RFKILL_TYPE_BLUETOOTH,
				&rfkill_bluetooth_ops, NULL);
	if (!rfk_bluetooth) {
		retval = -ENOMEM;
		goto err_bluetooth;
	}
	retval = rfkill_register(rfk_bluetooth);
	if (retval)
		goto err_bluetooth;

	rfk_wlan = rfkill_alloc("msi-wlan", &sdev->dev, RFKILL_TYPE_WLAN,
				&rfkill_wlan_ops, NULL);
	if (!rfk_wlan) {
		retval = -ENOMEM;
		goto err_wlan;
	}
	retval = rfkill_register(rfk_wlan);
	if (retval)
		goto err_wlan;

	if (threeg_exists) {
		rfk_threeg = rfkill_alloc("msi-threeg", &sdev->dev,
				RFKILL_TYPE_WWAN, &rfkill_threeg_ops, NULL);
		if (!rfk_threeg) {
			retval = -ENOMEM;
			goto err_threeg;
		}
		retval = rfkill_register(rfk_threeg);
		if (retval)
			goto err_threeg;
	}

	return 0;

err_threeg:
	rfkill_destroy(rfk_threeg);
	if (rfk_wlan)
		rfkill_unregister(rfk_wlan);
err_wlan:
	rfkill_destroy(rfk_wlan);
	if (rfk_bluetooth)
		rfkill_unregister(rfk_bluetooth);
err_bluetooth:
	rfkill_destroy(rfk_bluetooth);

	return retval;
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:53,代码来源:msi-laptop.c

示例3: spica_btsleep_probe

static int __init spica_btsleep_probe(struct platform_device *pdev)
{
	int rc = 0;

	//bt_sleep = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH);
	bt_sleep = rfkill_alloc(pdev->name,&pdev->dev,RFKILL_TYPE_BLUETOOTH,NULL,NULL);

	if (!bt_sleep)
		return -ENOMEM;

	bt_sleep->name = bt_name;
	bt_sleep->state = RFKILL_STATE_UNBLOCKED;
	//Xmister
	/* userspace cannot take exclusive control */
	//bt_sleep->user_claim_unsupported = 1;
	//bt_sleep->user_claim = 0;
	bt_sleep->data = NULL;  // user data
	//bt_sleep->toggle_radio = bluetooth_set_sleep;

	rc = rfkill_register(bt_sleep);
	if (rc)
		//Xmister
		//rfkill_free(bt_sleep);
		rfkill_destroy(bt_sleep);

	printk(KERN_DEBUG "[BT] rfkill_force_state(bt_sleep, RFKILL_STATE_UNBLOCKED) \n");
	//Xmister
	//rfkill_force_state(bt_sleep, RFKILL_STATE_UNBLOCKED);
	rfkill_set_hw_state(bt_sleep, RFKILL_STATE_UNBLOCKED);

	bluetooth_set_sleep(NULL, RFKILL_STATE_UNBLOCKED);

	return rc;
}
开发者ID:Xmister,项目名称:cm-kernel,代码行数:34,代码来源:board-rfkill.c

示例4: amilo_rfkill_probe

static int amilo_rfkill_probe(struct platform_device *device)
{
	int rc;
	const struct dmi_system_id *system_id =
		dmi_first_match(amilo_rfkill_id_table);

	if (!system_id)
		return -ENXIO;

	amilo_rfkill_dev = rfkill_alloc(KBUILD_MODNAME, &device->dev,
					RFKILL_TYPE_WLAN,
					system_id->driver_data, NULL);
	if (!amilo_rfkill_dev)
		return -ENOMEM;

	rc = rfkill_register(amilo_rfkill_dev);
	if (rc)
		goto fail;

	return 0;

fail:
	rfkill_destroy(amilo_rfkill_dev);
	return rc;
}
开发者ID:020gzh,项目名称:linux,代码行数:25,代码来源:amilo-rfkill.c

示例5: wifi_rfkill_probe

static int wifi_rfkill_probe(struct platform_device *pdev)
{
	int ret = -ENOMEM;

	g_WifiRfkill = rfkill_alloc("wifi_ar6k", &pdev->dev, RFKILL_TYPE_WLAN,
			&wifi_power_rfkill_ops,
			NULL);

	if (!g_WifiRfkill) {
		printk(KERN_DEBUG
				"%s: wifi rfkill register failed=%d\n", __func__,
				ret);
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(g_WifiRfkill, 1);

	ret = rfkill_register(g_WifiRfkill);
	if (ret) {
		printk(KERN_DEBUG
				"%s: rfkill register failed=%d\n", __func__,
				ret);
		rfkill_destroy(g_WifiRfkill);
		return ret;
	}
	return ret;
}
开发者ID:R-N,项目名称:boston-2.6.32.x,代码行数:28,代码来源:bluetooth-power.c

示例6: loox550_rfk_probe

static int loox550_rfk_probe(struct platform_device *dev)
{
	int rc;

	rc = request_gpios_bt();
	if (rc)
		goto err_gpios;

	bt_rfk = rfkill_alloc("loox550-bt", &dev->dev, RFKILL_TYPE_BLUETOOTH,
			   &loox550_bt_rfkill_ops, NULL);


	if (!bt_rfk)
		goto err_rfkill;

	rfkill_set_led_trigger_name(bt_rfk, "loox550-bt");

	rc = rfkill_register(bt_rfk);
	if (rc)
		goto err_rfkill;

	platform_set_drvdata(dev, NULL);

	return 0;

err_rfkill:
	rfkill_destroy(bt_rfk);
err_gpios:
	free_gpios();
	return rc;
}
开发者ID:okias,项目名称:linux-stable,代码行数:31,代码来源:loox550_rfkill.c

示例7: rt2x00rfkill_register

void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
{
	if (test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state))
		return;

	if (rt2x00rfkill_allocate(rt2x00dev)) {
		ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n");
		return;
	}

	if (rfkill_register(rt2x00dev->rfkill)) {
		ERROR(rt2x00dev, "Failed to register rfkill handler.\n");
		rt2x00rfkill_free(rt2x00dev);
		return;
	}

	__set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);

	/*
	 * Force initial poll which will detect the initial device state,
	 * and correctly sends the signal to the rfkill layer about this
	 * state.
	 */
	rt2x00rfkill_poll(&rt2x00dev->rfkill_work.work);
}
开发者ID:Amieow98,项目名称:nAa-kernel-ics,代码行数:25,代码来源:rt2x00rfkill.c

示例8: legend_rfkill_probe

static int legend_rfkill_probe(struct platform_device *pdev)
{
	int rc = 0;
	enum rfkill_state default_state = RFKILL_STATE_SOFT_BLOCKED;  /* off */

	/* force BT on and off to do GPIO setting when initiate */
	bluetooth_set_power(NULL, RFKILL_STATE_UNBLOCKED);
	legend_config_bt_init();	/* bt gpio initial config */

	rfkill_set_default(RFKILL_TYPE_BLUETOOTH, default_state);
	bluetooth_set_power(NULL, default_state);

	bt_rfk = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH);
	if (!bt_rfk)
		return -ENOMEM;

	bt_rfk->name = bt_name;
	bt_rfk->state = default_state;
	/* userspace cannot take exclusive control */
	bt_rfk->user_claim_unsupported = 1;
	bt_rfk->user_claim = 0;
	bt_rfk->data = NULL;  /* user data */
	bt_rfk->toggle_radio = bluetooth_set_power;

	rc = rfkill_register(bt_rfk);

	if (rc)
		rfkill_free(bt_rfk);
	return rc;
}
开发者ID:AKToronto,项目名称:htc-kernel-msm7227,代码行数:30,代码来源:board-legend-rfkill.c

示例9: rfkill_gpio_probe

static int rfkill_gpio_probe(struct platform_device *pdev)
{
	struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
	struct rfkill_gpio_data *rfkill;
	struct gpio_desc *gpio;
	int ret;

	rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
	if (!rfkill)
		return -ENOMEM;

	if (ACPI_HANDLE(&pdev->dev)) {
		ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
		if (ret)
			return ret;
	} else if (pdata) {
		rfkill->name = pdata->name;
		rfkill->type = pdata->type;
	} else {
		return -ENODEV;
	}

	rfkill->clk = devm_clk_get(&pdev->dev, NULL);

	gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
	if (IS_ERR(gpio))
		return PTR_ERR(gpio);

	rfkill->reset_gpio = gpio;

	gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_OUT_LOW);
	if (IS_ERR(gpio))
		return PTR_ERR(gpio);

	rfkill->shutdown_gpio = gpio;

	/* Make sure at-least one of the GPIO is defined and that
	 * a name is specified for this instance
	 */
	if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
		dev_err(&pdev->dev, "invalid platform data\n");
		return -EINVAL;
	}

	rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev,
					  rfkill->type, &rfkill_gpio_ops,
					  rfkill);
	if (!rfkill->rfkill_dev)
		return -ENOMEM;

	ret = rfkill_register(rfkill->rfkill_dev);
	if (ret < 0)
		return ret;

	platform_set_drvdata(pdev, rfkill);

	dev_info(&pdev->dev, "%s device registered.\n", rfkill->name);

	return 0;
}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:60,代码来源:rfkill-gpio.c

示例10: pico_rfkill_probe

static int pico_rfkill_probe(struct platform_device *pdev)
{
    int rc = 0;
    bool default_state = true; /* off */

    /* always turn on clock */
    htc_wifi_bt_sleep_clk_ctl(CLK_ON, ID_BT);
    mdelay(2);

    bluetooth_set_power(NULL, default_state);

    bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
                          &pico_rfkill_ops, NULL);
    if (!bt_rfk) {
        rc = -ENOMEM;
        goto err_rfkill_alloc;
    }

    rfkill_set_states(bt_rfk, default_state, false);

    /* userspace cannot take exclusive control */
    rc = rfkill_register(bt_rfk);
    if (rc)
        goto err_rfkill_reg;

    return 0;

err_rfkill_reg:
    rfkill_destroy(bt_rfk);
err_rfkill_alloc:
    return rc;
}
开发者ID:high1,项目名称:golfu_testing,代码行数:32,代码来源:board-pico-rfkill.c

示例11: bluetooth_power_rfkill_probe

static int bluetooth_power_rfkill_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	int ret;
#if defined (CONFIG_MACH_LGE_I_BOARD)
		bluetooth_power_rfkill_ops.set_block = bt_platform_data->bluetooth_toggle_radio;
#endif

	rfkill = rfkill_alloc("bt_power", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			      &bluetooth_power_rfkill_ops,
			      pdev->dev.platform_data);

	if (!rfkill) {
		dev_err(&pdev->dev, "rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(rfkill, 1);
#if !defined (CONFIG_MACH_LGE_I_BOARD)	
	previous = 1;
#endif

	ret = rfkill_register(rfkill);
	if (ret) {
		dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
		rfkill_destroy(rfkill);
		return ret;
	}

	platform_set_drvdata(pdev, rfkill);

	return 0;
}
开发者ID:playfulgod,项目名称:kernel_lge_i_vzw,代码行数:34,代码来源:bluetooth-power.c

示例12: lensl_radio_new_rfkill

static int lensl_radio_new_rfkill(struct lensl_radio *radio,
			struct rfkill **rfk, bool sw_blocked,
			bool hw_blocked)
{
	int res;		
		
	*rfk = rfkill_alloc(radio->rfkname, &lensl_pdev->dev, radio->rfktype,
			&rfkops, radio);
	if (!*rfk) {
		vdbg_printk(LENSL_ERR,
			"Failed to allocate memory for rfkill class\n");
		return -ENOMEM;
	}

	rfkill_set_hw_state(*rfk, hw_blocked);
	rfkill_set_sw_state(*rfk, sw_blocked);

	res = rfkill_register(*rfk);
	if (res < 0) {
		vdbg_printk(LENSL_ERR,
			"Failed to register %s rfkill switch: %d\n",
			radio->rfkname, res);
		rfkill_destroy(*rfk);
		*rfk = NULL;
		return res;
	}

	return 0;
}
开发者ID:xuzhen,项目名称:lenovo-sl-laptop,代码行数:29,代码来源:lenovo-sl-laptop.c

示例13: rfkill_alloc

/*************************************************
Function:       bluetooth_power_rfkill_probe
Description:    rfkill init function
Calls:              rfkill_alloc()
                    rfkill_init_sw_state()
                    rfkill_register()
                    rfkill_destroy()
Input:          platform_device *pdev
                bluetooth_power_private_data *p_dev_data
Output:         
Return:         int ret
Others:         NA
*************************************************/
static int bluetooth_power_rfkill_probe(struct platform_device *pdev, 
                struct bluetooth_power_private_data *p_dev_data)
{
	int ret = 0;

	printk(KERN_INFO "bluetooth_power_rfkill_probe in \n");

	/* alloc memery for rfkill */
	p_dev_data->rfkill = rfkill_alloc("bt_power", 
	&pdev->dev, RFKILL_TYPE_BLUETOOTH, &bluetooth_power_rfkill_ops, pdev);
	if(!p_dev_data->rfkill){
		dev_err(&pdev->dev,	"bluetooth rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow	for	user control */
	rfkill_init_sw_state( p_dev_data->rfkill, 1);
	p_dev_data->previous =	1;

	ret	= rfkill_register( p_dev_data->rfkill );
	if (ret) {
		dev_err(&pdev->dev,	"rfkill	register failed=%d\n", ret);
		goto rfkill_failed;
	}

	printk(KERN_INFO "bluetooth_power_rfkill_probe out \n");

	return ret;

rfkill_failed:
	rfkill_destroy( p_dev_data->rfkill );
	return ret;
}
开发者ID:herryfan,项目名称:kernel-huawei-h60,代码行数:46,代码来源:bluetooth_power.c

示例14: bluetooth_power_rfkill_probe

static int bluetooth_power_rfkill_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	int ret;

	rfkill = rfkill_alloc("bt_power", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			      &bluetooth_power_rfkill_ops,
			      pdev->dev.platform_data);

	if (!rfkill) {
		dev_err(&pdev->dev, "rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* add file into rfkill0 to handle LDO27 */
	ret = device_create_file(&pdev->dev, &dev_attr_extldo);
	if (ret < 0)
		BT_PWR_ERR("device create file error!");

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(rfkill, 1);
	previous = 1;

	ret = rfkill_register(rfkill);
	if (ret) {
		dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
		rfkill_destroy(rfkill);
		return ret;
	}

	platform_set_drvdata(pdev, rfkill);

	return 0;
}
开发者ID:AndroidGX,项目名称:SimpleGX-L-5.0.2_BOD6_G901F,代码行数:34,代码来源:bluetooth-power.c

示例15: bluetooth_power_rfkill_probe

static int bluetooth_power_rfkill_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	int ret;

	 printk("%s\n",__func__);

	rfkill = rfkill_alloc("bt_power", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			      &bluetooth_power_rfkill_ops,
			      pdev->dev.platform_data);

	if (!rfkill) {
		dev_err(&pdev->dev, "rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(rfkill, 1);

	ret = rfkill_register(rfkill);
	if (ret) {
		dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
		rfkill_destroy(rfkill);
		return ret;
	}

	platform_set_drvdata(pdev, rfkill);

#ifdef BTLD_CONTROL_WAKE_GPIO
	bluesleep_rfkill_alloc();
#endif

	return 0;
}
开发者ID:CL0SeY,项目名称:i957kernel,代码行数:34,代码来源:bluetooth-power.c


注:本文中的rfkill_register函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。