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
6358bf2c
Commit
6358bf2c
authored
Jan 13, 2010
by
Corentin Chary
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asus-laptop: stop using read_status and store_status for GPS
Signed-off-by:
Corentin Chary
<
corentincj@iksaif.net
>
parent
aa9df930
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
21 deletions
+35
-21
drivers/platform/x86/asus-laptop.c
drivers/platform/x86/asus-laptop.c
+35
-21
No files found.
drivers/platform/x86/asus-laptop.c
View file @
6358bf2c
...
@@ -331,26 +331,9 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val)
...
@@ -331,26 +331,9 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val)
return
write_acpi_int_ret
(
handle
,
method
,
val
,
NULL
);
return
write_acpi_int_ret
(
handle
,
method
,
val
,
NULL
);
}
}
static
int
read_gps_status
(
struct
asus_laptop
*
asus
)
{
unsigned
long
long
status
;
acpi_status
rv
=
AE_OK
;
rv
=
acpi_evaluate_integer
(
gps_status_handle
,
NULL
,
NULL
,
&
status
);
if
(
ACPI_FAILURE
(
rv
))
pr_warning
(
"Error reading GPS status
\n
"
);
else
return
status
?
1
:
0
;
return
(
asus
->
status
&
GPS_ON
)
?
1
:
0
;
}
/* Generic LED functions */
/* Generic LED functions */
static
int
read_status
(
struct
asus_laptop
*
asus
,
int
mask
)
static
int
read_status
(
struct
asus_laptop
*
asus
,
int
mask
)
{
{
if
(
mask
==
GPS_ON
)
return
read_gps_status
(
asus
);
return
(
asus
->
status
&
mask
)
?
1
:
0
;
return
(
asus
->
status
&
mask
)
?
1
:
0
;
}
}
...
@@ -979,21 +962,52 @@ static ssize_t store_lslvl(struct device *dev, struct device_attribute *attr,
...
@@ -979,21 +962,52 @@ static ssize_t store_lslvl(struct device *dev, struct device_attribute *attr,
/*
/*
* GPS
* GPS
* TODO: use rfkill
*/
*/
static
int
asus_gps_status
(
struct
asus_laptop
*
asus
)
{
unsigned
long
long
status
;
acpi_status
rv
=
AE_OK
;
rv
=
acpi_evaluate_integer
(
gps_status_handle
,
NULL
,
NULL
,
&
status
);
if
(
ACPI_FAILURE
(
rv
))
{
pr_warning
(
"Error reading GPS status
\n
"
);
return
-
ENODEV
;
}
return
!!
status
;
}
static
int
asus_gps_switch
(
struct
asus_laptop
*
asus
,
int
status
)
{
acpi_handle
handle
=
status
?
gps_on_handle
:
gps_off_handle
;
if
(
write_acpi_int
(
handle
,
NULL
,
0x02
))
return
-
ENODEV
;
return
0
;
}
static
ssize_t
show_gps
(
struct
device
*
dev
,
static
ssize_t
show_gps
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
struct
device_attribute
*
attr
,
char
*
buf
)
{
{
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
return
sprintf
(
buf
,
"%d
\n
"
,
read_status
(
asus
,
GPS_ON
));
return
sprintf
(
buf
,
"%d
\n
"
,
asus_gps_status
(
asus
));
}
}
static
ssize_t
store_gps
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
static
ssize_t
store_gps
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
const
char
*
buf
,
size_t
count
)
{
{
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
int
rv
,
value
;
int
ret
;
return
store_status
(
asus
,
buf
,
count
,
NULL
,
GPS_ON
);
rv
=
parse_arg
(
buf
,
count
,
&
value
);
if
(
rv
<=
0
)
return
-
EINVAL
;
ret
=
asus_gps_switch
(
asus
,
!!
value
);
if
(
ret
)
return
ret
;
return
rv
;
}
}
/*
/*
...
@@ -1451,7 +1465,7 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
...
@@ -1451,7 +1465,7 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
set_light_sens_level
(
asus
,
asus
->
light_level
);
set_light_sens_level
(
asus
,
asus
->
light_level
);
/* GPS is on by default */
/* GPS is on by default */
write_status
(
asus
,
NULL
,
1
,
GPS_ON
);
asus_gps_switch
(
asus
,
1
);
return
result
;
return
result
;
}
}
...
...
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