コード例 #1
0
ファイル: msi-laptop.c プロジェクト: garyvan/openwrt-1.6
static int __init load_scm_model_init(struct platform_device *sdev)
{
	u8 data;
	int result;

	if (!quirks->ec_read_only) {
		/* allow userland write sysfs file  */
		pax_open_kernel();
		*(void **)&dev_attr_bluetooth.store = store_bluetooth;
		*(void **)&dev_attr_wlan.store = store_wlan;
		*(void **)&dev_attr_threeg.store = store_threeg;
		*(umode_t *)&dev_attr_bluetooth.attr.mode |= S_IWUSR;
		*(umode_t *)&dev_attr_wlan.attr.mode |= S_IWUSR;
		*(umode_t *)&dev_attr_threeg.attr.mode |= S_IWUSR;
		pax_close_kernel();
	}

	/* disable hardware control by fn key */
	result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data);
	if (result < 0)
		return result;

	result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS,
		data | MSI_STANDARD_EC_SCM_LOAD_MASK);
	if (result < 0)
		return result;

	/* initial rfkill */
	result = rfkill_init(sdev);
	if (result < 0)
		goto fail_rfkill;

	/* setup input device */
	result = msi_laptop_input_setup();
	if (result)
		goto fail_input;

	result = i8042_install_filter(msi_laptop_i8042_filter);
	if (result) {
		pr_err("Unable to install key filter\n");
		goto fail_filter;
	}

	return 0;

fail_filter:
	msi_laptop_input_destroy();

fail_input:
	rfkill_cleanup();

fail_rfkill:

	return result;

}
コード例 #2
0
static int __init load_scm_model_init(struct platform_device *sdev)
{
	u8 data;
	int result;

	
	dev_attr_bluetooth.store = store_bluetooth;
	dev_attr_wlan.store = store_wlan;
	dev_attr_threeg.store = store_threeg;
	dev_attr_bluetooth.attr.mode |= S_IWUSR;
	dev_attr_wlan.attr.mode |= S_IWUSR;
	dev_attr_threeg.attr.mode |= S_IWUSR;

	
	result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data);
	if (result < 0)
		return result;

	result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS,
		data | MSI_STANDARD_EC_SCM_LOAD_MASK);
	if (result < 0)
		return result;

	
	result = rfkill_init(sdev);
	if (result < 0)
		goto fail_rfkill;

	
	result = msi_laptop_input_setup();
	if (result)
		goto fail_input;

	result = i8042_install_filter(msi_laptop_i8042_filter);
	if (result) {
		pr_err("Unable to install key filter\n");
		goto fail_filter;
	}

	return 0;

fail_filter:
	msi_laptop_input_destroy();

fail_input:
	rfkill_cleanup();

fail_rfkill:

	return result;

}