Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
1b045e5d
Commit
1b045e5d
authored
Jul 10, 2006
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Pull battery into test branch
parents
b3cf2576
8970bfe7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
32 deletions
+14
-32
drivers/acpi/cm_sbs.c
drivers/acpi/cm_sbs.c
+14
-32
No files found.
drivers/acpi/cm_sbs.c
View file @
1b045e5d
...
@@ -39,50 +39,43 @@ ACPI_MODULE_NAME("cm_sbs")
...
@@ -39,50 +39,43 @@ ACPI_MODULE_NAME("cm_sbs")
static
struct
proc_dir_entry
*
acpi_ac_dir
;
static
struct
proc_dir_entry
*
acpi_ac_dir
;
static
struct
proc_dir_entry
*
acpi_battery_dir
;
static
struct
proc_dir_entry
*
acpi_battery_dir
;
static
struct
semaphore
cm_sbs_sem
;
static
DEFINE_MUTEX
(
cm_sbs_mutex
)
;
static
int
lock_ac_dir_cnt
=
0
;
static
int
lock_ac_dir_cnt
;
static
int
lock_battery_dir_cnt
=
0
;
static
int
lock_battery_dir_cnt
;
struct
proc_dir_entry
*
acpi_lock_ac_dir
(
void
)
struct
proc_dir_entry
*
acpi_lock_ac_dir
(
void
)
{
{
mutex_lock
(
&
cm_sbs_mutex
);
down
(
&
cm_sbs_sem
);
if
(
!
acpi_ac_dir
)
if
(
!
acpi_ac_dir
)
{
acpi_ac_dir
=
proc_mkdir
(
ACPI_AC_CLASS
,
acpi_root_dir
);
acpi_ac_dir
=
proc_mkdir
(
ACPI_AC_CLASS
,
acpi_root_dir
);
}
if
(
acpi_ac_dir
)
{
if
(
acpi_ac_dir
)
{
lock_ac_dir_cnt
++
;
lock_ac_dir_cnt
++
;
}
else
{
}
else
{
ACPI_DEBUG_PRINT
((
ACPI_DB_ERROR
,
ACPI_DEBUG_PRINT
((
ACPI_DB_ERROR
,
"Cannot create %s
\n
"
,
ACPI_AC_CLASS
));
"Cannot create %s
\n
"
,
ACPI_AC_CLASS
));
}
}
up
(
&
cm_sbs_sem
);
mutex_unlock
(
&
cm_sbs_mutex
);
return
acpi_ac_dir
;
return
acpi_ac_dir
;
}
}
EXPORT_SYMBOL
(
acpi_lock_ac_dir
);
EXPORT_SYMBOL
(
acpi_lock_ac_dir
);
void
acpi_unlock_ac_dir
(
struct
proc_dir_entry
*
acpi_ac_dir_param
)
void
acpi_unlock_ac_dir
(
struct
proc_dir_entry
*
acpi_ac_dir_param
)
{
{
mutex_lock
(
&
cm_sbs_mutex
);
down
(
&
cm_sbs_sem
);
if
(
acpi_ac_dir_param
)
if
(
acpi_ac_dir_param
)
{
lock_ac_dir_cnt
--
;
lock_ac_dir_cnt
--
;
}
if
(
lock_ac_dir_cnt
==
0
&&
acpi_ac_dir_param
&&
acpi_ac_dir
)
{
if
(
lock_ac_dir_cnt
==
0
&&
acpi_ac_dir_param
&&
acpi_ac_dir
)
{
remove_proc_entry
(
ACPI_AC_CLASS
,
acpi_root_dir
);
remove_proc_entry
(
ACPI_AC_CLASS
,
acpi_root_dir
);
acpi_ac_dir
=
0
;
acpi_ac_dir
=
0
;
}
}
up
(
&
cm_sbs_sem
);
mutex_unlock
(
&
cm_sbs_mutex
);
}
}
EXPORT_SYMBOL
(
acpi_unlock_ac_dir
);
EXPORT_SYMBOL
(
acpi_unlock_ac_dir
);
struct
proc_dir_entry
*
acpi_lock_battery_dir
(
void
)
struct
proc_dir_entry
*
acpi_lock_battery_dir
(
void
)
{
{
mutex_lock
(
&
cm_sbs_mutex
);
down
(
&
cm_sbs_sem
);
if
(
!
acpi_battery_dir
)
{
if
(
!
acpi_battery_dir
)
{
acpi_battery_dir
=
acpi_battery_dir
=
proc_mkdir
(
ACPI_BATTERY_CLASS
,
acpi_root_dir
);
proc_mkdir
(
ACPI_BATTERY_CLASS
,
acpi_root_dir
);
...
@@ -93,39 +86,28 @@ struct proc_dir_entry *acpi_lock_battery_dir(void)
...
@@ -93,39 +86,28 @@ struct proc_dir_entry *acpi_lock_battery_dir(void)
ACPI_DEBUG_PRINT
((
ACPI_DB_ERROR
,
ACPI_DEBUG_PRINT
((
ACPI_DB_ERROR
,
"Cannot create %s
\n
"
,
ACPI_BATTERY_CLASS
));
"Cannot create %s
\n
"
,
ACPI_BATTERY_CLASS
));
}
}
up
(
&
cm_sbs_sem
);
mutex_unlock
(
&
cm_sbs_mutex
);
return
acpi_battery_dir
;
return
acpi_battery_dir
;
}
}
EXPORT_SYMBOL
(
acpi_lock_battery_dir
);
EXPORT_SYMBOL
(
acpi_lock_battery_dir
);
void
acpi_unlock_battery_dir
(
struct
proc_dir_entry
*
acpi_battery_dir_param
)
void
acpi_unlock_battery_dir
(
struct
proc_dir_entry
*
acpi_battery_dir_param
)
{
{
mutex_lock
(
&
cm_sbs_mutex
);
down
(
&
cm_sbs_sem
);
if
(
acpi_battery_dir_param
)
if
(
acpi_battery_dir_param
)
{
lock_battery_dir_cnt
--
;
lock_battery_dir_cnt
--
;
}
if
(
lock_battery_dir_cnt
==
0
&&
acpi_battery_dir_param
if
(
lock_battery_dir_cnt
==
0
&&
acpi_battery_dir_param
&&
acpi_battery_dir
)
{
&&
acpi_battery_dir
)
{
remove_proc_entry
(
ACPI_BATTERY_CLASS
,
acpi_root_dir
);
remove_proc_entry
(
ACPI_BATTERY_CLASS
,
acpi_root_dir
);
acpi_battery_dir
=
0
;
acpi_battery_dir
=
0
;
}
}
up
(
&
cm_sbs_sem
);
mutex_unlock
(
&
cm_sbs_mutex
);
return
;
return
;
}
}
EXPORT_SYMBOL
(
acpi_unlock_battery_dir
);
EXPORT_SYMBOL
(
acpi_unlock_battery_dir
);
static
int
__init
acpi_cm_sbs_init
(
void
)
static
int
__init
acpi_cm_sbs_init
(
void
)
{
{
if
(
acpi_disabled
)
return
0
;
init_MUTEX
(
&
cm_sbs_sem
);
return
0
;
return
0
;
}
}
subsys_initcall
(
acpi_cm_sbs_init
);
subsys_initcall
(
acpi_cm_sbs_init
);
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