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
Kirill Smelkov
linux
Commits
5389102e
Commit
5389102e
authored
Aug 05, 2011
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'battery' into release
parents
de96355c
69d94ec6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
drivers/acpi/battery.c
drivers/acpi/battery.c
+7
-3
No files found.
drivers/acpi/battery.c
View file @
5389102e
...
@@ -99,6 +99,7 @@ enum {
...
@@ -99,6 +99,7 @@ enum {
struct
acpi_battery
{
struct
acpi_battery
{
struct
mutex
lock
;
struct
mutex
lock
;
struct
mutex
sysfs_lock
;
struct
power_supply
bat
;
struct
power_supply
bat
;
struct
acpi_device
*
device
;
struct
acpi_device
*
device
;
struct
notifier_block
pm_nb
;
struct
notifier_block
pm_nb
;
...
@@ -573,16 +574,16 @@ static int sysfs_add_battery(struct acpi_battery *battery)
...
@@ -573,16 +574,16 @@ static int sysfs_add_battery(struct acpi_battery *battery)
static
void
sysfs_remove_battery
(
struct
acpi_battery
*
battery
)
static
void
sysfs_remove_battery
(
struct
acpi_battery
*
battery
)
{
{
mutex_lock
(
&
battery
->
lock
);
mutex_lock
(
&
battery
->
sysfs_
lock
);
if
(
!
battery
->
bat
.
dev
)
{
if
(
!
battery
->
bat
.
dev
)
{
mutex_unlock
(
&
battery
->
lock
);
mutex_unlock
(
&
battery
->
sysfs_
lock
);
return
;
return
;
}
}
device_remove_file
(
battery
->
bat
.
dev
,
&
alarm_attr
);
device_remove_file
(
battery
->
bat
.
dev
,
&
alarm_attr
);
power_supply_unregister
(
&
battery
->
bat
);
power_supply_unregister
(
&
battery
->
bat
);
battery
->
bat
.
dev
=
NULL
;
battery
->
bat
.
dev
=
NULL
;
mutex_unlock
(
&
battery
->
lock
);
mutex_unlock
(
&
battery
->
sysfs_
lock
);
}
}
/*
/*
...
@@ -982,6 +983,7 @@ static int acpi_battery_add(struct acpi_device *device)
...
@@ -982,6 +983,7 @@ static int acpi_battery_add(struct acpi_device *device)
strcpy
(
acpi_device_class
(
device
),
ACPI_BATTERY_CLASS
);
strcpy
(
acpi_device_class
(
device
),
ACPI_BATTERY_CLASS
);
device
->
driver_data
=
battery
;
device
->
driver_data
=
battery
;
mutex_init
(
&
battery
->
lock
);
mutex_init
(
&
battery
->
lock
);
mutex_init
(
&
battery
->
sysfs_lock
);
if
(
ACPI_SUCCESS
(
acpi_get_handle
(
battery
->
device
->
handle
,
if
(
ACPI_SUCCESS
(
acpi_get_handle
(
battery
->
device
->
handle
,
"_BIX"
,
&
handle
)))
"_BIX"
,
&
handle
)))
set_bit
(
ACPI_BATTERY_XINFO_PRESENT
,
&
battery
->
flags
);
set_bit
(
ACPI_BATTERY_XINFO_PRESENT
,
&
battery
->
flags
);
...
@@ -1010,6 +1012,7 @@ static int acpi_battery_add(struct acpi_device *device)
...
@@ -1010,6 +1012,7 @@ static int acpi_battery_add(struct acpi_device *device)
fail:
fail:
sysfs_remove_battery
(
battery
);
sysfs_remove_battery
(
battery
);
mutex_destroy
(
&
battery
->
lock
);
mutex_destroy
(
&
battery
->
lock
);
mutex_destroy
(
&
battery
->
sysfs_lock
);
kfree
(
battery
);
kfree
(
battery
);
return
result
;
return
result
;
}
}
...
@@ -1027,6 +1030,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
...
@@ -1027,6 +1030,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
#endif
#endif
sysfs_remove_battery
(
battery
);
sysfs_remove_battery
(
battery
);
mutex_destroy
(
&
battery
->
lock
);
mutex_destroy
(
&
battery
->
lock
);
mutex_destroy
(
&
battery
->
sysfs_lock
);
kfree
(
battery
);
kfree
(
battery
);
return
0
;
return
0
;
}
}
...
...
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