Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
hwspinlock
hwspinlock_internal.h
Go to the documentation of this file.
1
/*
2
* Hardware spinlocks internal header
3
*
4
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
5
*
6
* Contact: Ohad Ben-Cohen <
[email protected]
>
7
*
8
* This program is free software; you can redistribute it and/or modify it
9
* under the terms of the GNU General Public License version 2 as published
10
* by the Free Software Foundation.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*/
17
18
#ifndef __HWSPINLOCK_HWSPINLOCK_H
19
#define __HWSPINLOCK_HWSPINLOCK_H
20
21
#include <
linux/spinlock.h
>
22
#include <linux/device.h>
23
24
struct
hwspinlock_device
;
25
36
struct
hwspinlock_ops
{
37
int
(*
trylock
)(
struct
hwspinlock
*
lock
);
38
void
(*
unlock
)(
struct
hwspinlock
*
lock
);
39
void
(*
relax
)(
struct
hwspinlock
*
lock
);
40
};
41
48
struct
hwspinlock
{
49
struct
hwspinlock_device
*
bank
;
50
spinlock_t
lock
;
51
void
*
priv
;
52
};
53
62
struct
hwspinlock_device
{
63
struct
device
*
dev
;
64
const
struct
hwspinlock_ops
*
ops
;
65
int
base_id
;
66
int
num_locks
;
67
struct
hwspinlock
lock
[0];
68
};
69
70
static
inline
int
hwlock_to_id(
struct
hwspinlock
*hwlock)
71
{
72
int
local_id = hwlock - &hwlock->
bank
->lock[0];
73
74
return
hwlock->
bank
->base_id + local_id;
75
}
76
77
#endif
/* __HWSPINLOCK_HWSPINLOCK_H */
Generated on Thu Jan 10 2013 13:35:26 for Linux Kernel by
1.8.2