コード例 #1
0
static void __exit test_hwspinlock_exit(void)
{
	int ret;

	ret = hwspin_lock_free(hwlock);
	if (ret)
		pr_err("%s: free failed: %d\n", __func__, ret);
	else
		pr_info("%s: freed lock %d\n", __func__, hwspin_lock_get_id(hwlock));
	return;
}
コード例 #2
0
static int __init test_hwspinlock_init(void)
{
	hwlock = hwspin_lock_request();
	if (!hwlock) {
		pr_err("%s: request failed\n", __func__);
		return -1;
	}

	pr_info("%s: requested lock %d\n", __func__, hwspin_lock_get_id(hwlock));

	return 0;
}
コード例 #3
0
/**
 * omap_i2c_get_hwspinlockid - Get HWSPINLOCK ID for I2C device
 * @dev: I2C device
 *
 * returns the hwspinlock id or -1 if does not exist
 */
int omap_i2c_get_hwspinlockid(struct device *dev)
{
	struct omap_i2c_bus_platform_data *pdata;

	pdata = dev_get_platdata(dev);
	if (!pdata) {
		dev_err(dev, "%s: platform data is missing\n", __func__);
		return -EINVAL;
	}

	if (pdata->handle != NULL)
		return hwspin_lock_get_id(pdata->handle);
	else
		return -1;
}
コード例 #4
0
static int __init early_init_hwlocks(void)
{
	int i;
	struct hwspinlock **plock;
	arch_hwlocks_implemented();

	for (i = 0; i < HWSPINLOCK_ID_TOTAL_NUMS; ++i) {
		if (hwlocks_implemented[i]) {
			plock = &hwlocks[i];
			*plock = hwspin_lock_request_specific(i);
			if (WARN_ON(IS_ERR_OR_NULL(*plock)))
				*plock = NULL;
			else
				pr_info("early alloc hwspinlock id %d\n",
					hwspin_lock_get_id(*plock));
		}
	}
	return 0;
}