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; }
static void __init omap_i2c_hwspinlock_init(int bus_id, int spinlock_id, struct omap_i2c_bus_board_data *pdata) { /* spinlock_id should be -1 for a generic lock request */ if (spinlock_id < 0) pdata->handle = hwspin_lock_request(); else pdata->handle = hwspin_lock_request_specific(spinlock_id); if (pdata->handle != NULL) { pdata->hwspin_lock_timeout = hwspin_lock_timeout; pdata->hwspin_unlock = hwspin_unlock; } else { pr_err("I2C hwspinlock request failed for bus %d\n", bus_id); } }