Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
5a53763c
Commit
5a53763c
authored
Nov 27, 2003
by
Jaroslav Kysela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA CVS update - Takashi Iwai <tiwai@suse.de>
I2C lib core - fixed sleep in lock. use mutex for the locking.
parent
cd5cd92f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
include/sound/i2c.h
include/sound/i2c.h
+5
-5
sound/i2c/i2c.c
sound/i2c/i2c.c
+1
-1
No files found.
include/sound/i2c.h
View file @
5a53763c
...
@@ -58,7 +58,7 @@ struct _snd_i2c_bus {
...
@@ -58,7 +58,7 @@ struct _snd_i2c_bus {
snd_card_t
*
card
;
/* card which I2C belongs to */
snd_card_t
*
card
;
/* card which I2C belongs to */
char
name
[
32
];
/* some useful label */
char
name
[
32
];
/* some useful label */
s
pinlock_t
lock
;
s
truct
semaphore
lock_mutex
;
snd_i2c_bus_t
*
master
;
/* master bus when SCK/SCL is shared */
snd_i2c_bus_t
*
master
;
/* master bus when SCK/SCL is shared */
struct
list_head
buses
;
/* master: slave buses sharing SCK/SCL, slave: link list */
struct
list_head
buses
;
/* master: slave buses sharing SCK/SCL, slave: link list */
...
@@ -84,15 +84,15 @@ int snd_i2c_device_free(snd_i2c_device_t *device);
...
@@ -84,15 +84,15 @@ int snd_i2c_device_free(snd_i2c_device_t *device);
static
inline
void
snd_i2c_lock
(
snd_i2c_bus_t
*
bus
)
{
static
inline
void
snd_i2c_lock
(
snd_i2c_bus_t
*
bus
)
{
if
(
bus
->
master
)
if
(
bus
->
master
)
spin_lock
(
&
bus
->
master
->
lock
);
down
(
&
bus
->
master
->
lock_mutex
);
else
else
spin_lock
(
&
bus
->
lock
);
down
(
&
bus
->
lock_mutex
);
}
}
static
inline
void
snd_i2c_unlock
(
snd_i2c_bus_t
*
bus
)
{
static
inline
void
snd_i2c_unlock
(
snd_i2c_bus_t
*
bus
)
{
if
(
bus
->
master
)
if
(
bus
->
master
)
spin_unlock
(
&
bus
->
master
->
lock
);
up
(
&
bus
->
master
->
lock_mutex
);
else
else
spin_unlock
(
&
bus
->
lock
);
up
(
&
bus
->
lock_mutex
);
}
}
int
snd_i2c_sendbytes
(
snd_i2c_device_t
*
device
,
unsigned
char
*
bytes
,
int
count
);
int
snd_i2c_sendbytes
(
snd_i2c_device_t
*
device
,
unsigned
char
*
bytes
,
int
count
);
...
...
sound/i2c/i2c.c
View file @
5a53763c
...
@@ -84,7 +84,7 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master
...
@@ -84,7 +84,7 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master
bus
=
(
snd_i2c_bus_t
*
)
snd_magic_kcalloc
(
snd_i2c_bus_t
,
0
,
GFP_KERNEL
);
bus
=
(
snd_i2c_bus_t
*
)
snd_magic_kcalloc
(
snd_i2c_bus_t
,
0
,
GFP_KERNEL
);
if
(
bus
==
NULL
)
if
(
bus
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
spin_lock_init
(
&
bus
->
lock
);
init_MUTEX
(
&
bus
->
lock_mutex
);
INIT_LIST_HEAD
(
&
bus
->
devices
);
INIT_LIST_HEAD
(
&
bus
->
devices
);
INIT_LIST_HEAD
(
&
bus
->
buses
);
INIT_LIST_HEAD
(
&
bus
->
buses
);
bus
->
card
=
card
;
bus
->
card
=
card
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment