omap_hwspinlock.c (357ace03f0abceabd5fa7ec9fe7bcc1482c87e51) omap_hwspinlock.c (acafe7e30216166a17e6e226aadc3ecb63993242)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * OMAP hardware spinlock driver
4 *
5 * Copyright (C) 2010-2015 Texas Instruments Incorporated - http://www.ti.com
6 *
7 * Contact: Simon Que <sque@ti.com>
8 * Hari Kanigeri <h-kanigeri2@ti.com>
9 * Ohad Ben-Cohen <ohad@wizery.com>
1/*
2 * OMAP hardware spinlock driver
3 *
4 * Copyright (C) 2010-2015 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Contact: Simon Que <sque@ti.com>
7 * Hari Kanigeri <h-kanigeri2@ti.com>
8 * Ohad Ben-Cohen <ohad@wizery.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
10 */
11
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/device.h>
15#include <linux/delay.h>
16#include <linux/io.h>
17#include <linux/bitops.h>

--- 101 unchanged lines hidden (view full) ---

119 /* one of the four lsb's must be set, and nothing else */
120 if (hweight_long(i & 0xf) != 1 || i > 8) {
121 ret = -EINVAL;
122 goto iounmap_base;
123 }
124
125 num_locks = i * 32; /* actual number of locks in this device */
126
18 */
19
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/device.h>
23#include <linux/delay.h>
24#include <linux/io.h>
25#include <linux/bitops.h>

--- 101 unchanged lines hidden (view full) ---

127 /* one of the four lsb's must be set, and nothing else */
128 if (hweight_long(i & 0xf) != 1 || i > 8) {
129 ret = -EINVAL;
130 goto iounmap_base;
131 }
132
133 num_locks = i * 32; /* actual number of locks in this device */
134
127 bank = kzalloc(sizeof(*bank) + num_locks * sizeof(*hwlock), GFP_KERNEL);
135 bank = kzalloc(struct_size(bank, lock, num_locks), GFP_KERNEL);
128 if (!bank) {
129 ret = -ENOMEM;
130 goto iounmap_base;
131 }
132
133 platform_set_drvdata(pdev, bank);
134
135 for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)

--- 69 unchanged lines hidden ---
136 if (!bank) {
137 ret = -ENOMEM;
138 goto iounmap_base;
139 }
140
141 platform_set_drvdata(pdev, bank);
142
143 for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)

--- 69 unchanged lines hidden ---