Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
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-2.6.23
Commits
e8b495fe
Commit
e8b495fe
authored
Jul 22, 2007
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Pull dock-bay into release branch
parents
22aadf8a
9254bc84
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
40 deletions
+106
-40
drivers/acpi/bay.c
drivers/acpi/bay.c
+9
-10
drivers/acpi/dock.c
drivers/acpi/dock.c
+97
-30
No files found.
drivers/acpi/bay.c
View file @
e8b495fe
...
...
@@ -288,6 +288,11 @@ static int bay_add(acpi_handle handle, int id)
new_bay
->
pdev
=
pdev
;
platform_set_drvdata
(
pdev
,
new_bay
);
/*
* we want the bay driver to be able to send uevents
*/
pdev
->
dev
.
uevent_suppress
=
0
;
if
(
acpi_bay_add_fs
(
new_bay
))
{
platform_device_unregister
(
new_bay
->
pdev
);
goto
bay_add_err
;
...
...
@@ -328,18 +333,12 @@ static void bay_notify(acpi_handle handle, u32 event, void *data)
{
struct
bay
*
bay_dev
=
(
struct
bay
*
)
data
;
struct
device
*
dev
=
&
bay_dev
->
pdev
->
dev
;
char
event_string
[
12
];
char
*
envp
[]
=
{
event_string
,
NULL
};
bay_dprintk
(
handle
,
"Bay event"
);
switch
(
event
)
{
case
ACPI_NOTIFY_BUS_CHECK
:
case
ACPI_NOTIFY_DEVICE_CHECK
:
case
ACPI_NOTIFY_EJECT_REQUEST
:
kobject_uevent
(
&
dev
->
kobj
,
KOBJ_CHANGE
);
break
;
default:
printk
(
KERN_ERR
PREFIX
"Bay: unknown event %d
\n
"
,
event
);
}
sprintf
(
event_string
,
"BAY_EVENT=%d
\n
"
,
event
);
kobject_uevent_env
(
&
dev
->
kobj
,
KOBJ_CHANGE
,
envp
);
}
static
acpi_status
...
...
drivers/acpi/dock.c
View file @
e8b495fe
...
...
@@ -40,8 +40,15 @@ MODULE_AUTHOR("Kristen Carlson Accardi");
MODULE_DESCRIPTION
(
ACPI_DOCK_DRIVER_DESCRIPTION
);
MODULE_LICENSE
(
"GPL"
);
static
int
immediate_undock
=
1
;
module_param
(
immediate_undock
,
bool
,
0644
);
MODULE_PARM_DESC
(
immediate_undock
,
"1 (default) will cause the driver to "
"undock immediately when the undock button is pressed, 0 will cause"
" the driver to wait for userspace to write the undock sysfs file "
" before undocking"
);
static
struct
atomic_notifier_head
dock_notifier_list
;
static
struct
platform_device
dock_device
;
static
struct
platform_device
*
dock_device
;
static
char
dock_device_name
[]
=
"dock"
;
struct
dock_station
{
...
...
@@ -63,6 +70,7 @@ struct dock_dependent_device {
};
#define DOCK_DOCKING 0x00000001
#define DOCK_UNDOCKING 0x00000002
#define DOCK_EVENT 3
#define UNDOCK_EVENT 2
...
...
@@ -327,12 +335,20 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
static
void
dock_event
(
struct
dock_station
*
ds
,
u32
event
,
int
num
)
{
struct
device
*
dev
=
&
dock_device
.
dev
;
struct
device
*
dev
=
&
dock_device
->
dev
;
char
event_string
[
7
];
char
*
envp
[]
=
{
event_string
,
NULL
};
if
(
num
==
UNDOCK_EVENT
)
sprintf
(
event_string
,
"UNDOCK"
);
else
sprintf
(
event_string
,
"DOCK"
);
/*
* Indicate that the status of the dock station has
* changed.
*/
kobject_uevent
(
&
dev
->
kobj
,
KOBJ_CHANGE
);
kobject_uevent
_env
(
&
dev
->
kobj
,
KOBJ_CHANGE
,
envp
);
}
/**
...
...
@@ -380,12 +396,11 @@ static void handle_dock(struct dock_station *ds, int dock)
union
acpi_object
arg
;
struct
acpi_buffer
buffer
=
{
ACPI_ALLOCATE_BUFFER
,
NULL
};
struct
acpi_buffer
name_buffer
=
{
ACPI_ALLOCATE_BUFFER
,
NULL
};
union
acpi_object
*
obj
;
acpi_get_name
(
ds
->
handle
,
ACPI_FULL_PATHNAME
,
&
name_buffer
);
obj
=
name_buffer
.
pointer
;
printk
(
KERN_INFO
PREFIX
"%s
\n
"
,
dock
?
"docking"
:
"undocking"
);
printk
(
KERN_INFO
PREFIX
"%s - %s
\n
"
,
(
char
*
)
name_buffer
.
pointer
,
dock
?
"docking"
:
"undocking"
);
/* _DCK method has one argument */
arg_list
.
count
=
1
;
...
...
@@ -394,7 +409,8 @@ static void handle_dock(struct dock_station *ds, int dock)
arg
.
integer
.
value
=
dock
;
status
=
acpi_evaluate_object
(
ds
->
handle
,
"_DCK"
,
&
arg_list
,
&
buffer
);
if
(
ACPI_FAILURE
(
status
))
pr_debug
(
"%s: failed to execute _DCK
\n
"
,
obj
->
string
.
pointer
);
printk
(
KERN_ERR
PREFIX
"%s - failed to execute _DCK
\n
"
,
(
char
*
)
name_buffer
.
pointer
);
kfree
(
buffer
.
pointer
);
kfree
(
name_buffer
.
pointer
);
}
...
...
@@ -420,6 +436,16 @@ static inline void complete_dock(struct dock_station *ds)
ds
->
last_dock_time
=
jiffies
;
}
static
inline
void
begin_undock
(
struct
dock_station
*
ds
)
{
ds
->
flags
|=
DOCK_UNDOCKING
;
}
static
inline
void
complete_undock
(
struct
dock_station
*
ds
)
{
ds
->
flags
&=
~
(
DOCK_UNDOCKING
);
}
/**
* dock_in_progress - see if we are in the middle of handling a dock event
* @ds: the dock station
...
...
@@ -550,7 +576,7 @@ static int handle_eject_request(struct dock_station *ds, u32 event)
printk
(
KERN_ERR
PREFIX
"Unable to undock!
\n
"
);
return
-
EBUSY
;
}
complete_undock
(
ds
);
return
0
;
}
...
...
@@ -594,7 +620,11 @@ static void dock_notify(acpi_handle handle, u32 event, void *data)
* to the driver who wish to hotplug.
*/
case
ACPI_NOTIFY_EJECT_REQUEST
:
begin_undock
(
ds
);
if
(
immediate_undock
)
handle_eject_request
(
ds
,
event
);
else
dock_event
(
ds
,
event
,
UNDOCK_EVENT
);
break
;
default:
printk
(
KERN_ERR
PREFIX
"Unknown dock event %d
\n
"
,
event
);
...
...
@@ -652,6 +682,17 @@ static ssize_t show_docked(struct device *dev,
}
DEVICE_ATTR
(
docked
,
S_IRUGO
,
show_docked
,
NULL
);
/*
* show_flags - read method for flags file in sysfs
*/
static
ssize_t
show_flags
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
return
snprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
dock_station
->
flags
);
}
DEVICE_ATTR
(
flags
,
S_IRUGO
,
show_flags
,
NULL
);
/*
* write_undock - write method for "undock" file in sysfs
*/
...
...
@@ -675,16 +716,15 @@ static ssize_t show_dock_uid(struct device *dev,
struct
device_attribute
*
attr
,
char
*
buf
)
{
unsigned
long
lbuf
;
acpi_status
status
=
acpi_evaluate_integer
(
dock_station
->
handle
,
"_UID"
,
NULL
,
&
lbuf
);
if
(
ACPI_FAILURE
(
status
))
{
acpi_status
status
=
acpi_evaluate_integer
(
dock_station
->
handle
,
"_UID"
,
NULL
,
&
lbuf
);
if
(
ACPI_FAILURE
(
status
))
return
0
;
}
return
snprintf
(
buf
,
PAGE_SIZE
,
"%lx
\n
"
,
lbuf
);
}
DEVICE_ATTR
(
uid
,
S_IRUGO
,
show_dock_uid
,
NULL
);
/**
* dock_add - add a new dock station
* @handle: the dock station handle
...
...
@@ -711,33 +751,53 @@ static int dock_add(acpi_handle handle)
ATOMIC_INIT_NOTIFIER_HEAD
(
&
dock_notifier_list
);
/* initialize platform device stuff */
dock_device
.
name
=
dock_device_name
;
ret
=
platform_device_register
(
&
dock_device
);
dock_device
=
platform_device_register_simple
(
dock_device_name
,
0
,
NULL
,
0
);
if
(
IS_ERR
(
dock_device
))
{
kfree
(
dock_station
);
dock_station
=
NULL
;
return
PTR_ERR
(
dock_device
);
}
/* we want the dock device to send uevents */
dock_device
->
dev
.
uevent_suppress
=
0
;
ret
=
device_create_file
(
&
dock_device
->
dev
,
&
dev_attr_docked
);
if
(
ret
)
{
printk
(
KERN_ERR
PREFIX
"Error %d registering dock device
\n
"
,
ret
);
printk
(
"Error %d adding sysfs file
\n
"
,
ret
);
platform_device_unregister
(
dock_device
);
kfree
(
dock_station
);
dock_station
=
NULL
;
return
ret
;
}
ret
=
device_create_file
(
&
dock_device
.
dev
,
&
dev_attr_docked
);
ret
=
device_create_file
(
&
dock_device
->
dev
,
&
dev_attr_undock
);
if
(
ret
)
{
printk
(
"Error %d adding sysfs file
\n
"
,
ret
);
platform_device_unregister
(
&
dock_device
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_docked
);
platform_device_unregister
(
dock_device
);
kfree
(
dock_station
);
dock_station
=
NULL
;
return
ret
;
}
ret
=
device_create_file
(
&
dock_device
.
dev
,
&
dev_attr_undock
);
ret
=
device_create_file
(
&
dock_device
->
dev
,
&
dev_attr_uid
);
if
(
ret
)
{
printk
(
"Error %d adding sysfs file
\n
"
,
ret
);
device_remove_file
(
&
dock_device
.
dev
,
&
dev_attr_docked
);
platform_device_unregister
(
&
dock_device
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_docked
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_undock
);
platform_device_unregister
(
dock_device
);
kfree
(
dock_station
);
dock_station
=
NULL
;
return
ret
;
}
ret
=
device_create_file
(
&
dock_device
.
dev
,
&
dev_attr_uid
);
ret
=
device_create_file
(
&
dock_device
->
dev
,
&
dev_attr_flags
);
if
(
ret
)
{
printk
(
"Error %d adding sysfs file
\n
"
,
ret
);
platform_device_unregister
(
&
dock_device
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_docked
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_undock
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_uid
);
platform_device_unregister
(
dock_device
);
kfree
(
dock_station
);
dock_station
=
NULL
;
return
ret
;
}
...
...
@@ -750,6 +810,7 @@ static int dock_add(acpi_handle handle)
dd
=
alloc_dock_dependent_device
(
handle
);
if
(
!
dd
)
{
kfree
(
dock_station
);
dock_station
=
NULL
;
ret
=
-
ENOMEM
;
goto
dock_add_err_unregister
;
}
...
...
@@ -773,10 +834,13 @@ static int dock_add(acpi_handle handle)
dock_add_err:
kfree
(
dd
);
dock_add_err_unregister:
device_remove_file
(
&
dock_device
.
dev
,
&
dev_attr_docked
);
device_remove_file
(
&
dock_device
.
dev
,
&
dev_attr_undock
);
platform_device_unregister
(
&
dock_device
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_docked
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_undock
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_uid
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_flags
);
platform_device_unregister
(
dock_device
);
kfree
(
dock_station
);
dock_station
=
NULL
;
return
ret
;
}
...
...
@@ -804,12 +868,15 @@ static int dock_remove(void)
printk
(
KERN_ERR
"Error removing notify handler
\n
"
);
/* cleanup sysfs */
device_remove_file
(
&
dock_device
.
dev
,
&
dev_attr_docked
);
device_remove_file
(
&
dock_device
.
dev
,
&
dev_attr_undock
);
platform_device_unregister
(
&
dock_device
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_docked
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_undock
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_uid
);
device_remove_file
(
&
dock_device
->
dev
,
&
dev_attr_flags
);
platform_device_unregister
(
dock_device
);
/* free dock station memory */
kfree
(
dock_station
);
dock_station
=
NULL
;
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