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
462bcde6
Commit
462bcde6
authored
May 23, 2003
by
Andy Grover
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ACPI: Allow multiple compatible IDs for PnP purposes
parent
ce7d8354
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
36 deletions
+38
-36
drivers/acpi/scan.c
drivers/acpi/scan.c
+37
-36
include/acpi/acpi_bus.h
include/acpi/acpi_bus.h
+1
-0
No files found.
drivers/acpi/scan.c
View file @
462bcde6
...
...
@@ -28,6 +28,8 @@ static spinlock_t acpi_device_lock = SPIN_LOCK_UNLOCKED;
static
void
acpi_device_release
(
struct
kobject
*
kobj
)
{
struct
acpi_device
*
dev
=
container_of
(
kobj
,
struct
acpi_device
,
kobj
);
if
(
dev
->
pnp
.
cid_list
)
kfree
(
dev
->
pnp
.
cid_list
);
kfree
(
dev
);
}
...
...
@@ -201,32 +203,15 @@ acpi_bus_match (
goto
Done
;
if
(
device
->
flags
.
compatible_ids
)
{
acpi_status
status
=
AE_OK
;
union
acpi_object
*
object
=
NULL
;
char
cid
[
256
]
=
{};
struct
acpi_compatible_id_list
*
cid_list
=
device
->
pnp
.
cid_list
;
int
i
;
status
=
acpi_evaluate_object
(
device
->
handle
,
"_CID"
,
NULL
,
&
buffer
);
if
(
ACPI_FAILURE
(
status
)
||
!
buffer
.
pointer
)
return
-
ENOENT
;
object
=
(
union
acpi_object
*
)
buffer
.
pointer
;
switch
(
object
->
type
)
{
case
ACPI_TYPE_INTEGER
:
acpi_ex_eisa_id_to_string
((
u32
)
object
->
integer
.
value
,
cid
);
break
;
case
ACPI_TYPE_STRING
:
strncpy
(
cid
,
object
->
string
.
pointer
,
sizeof
(
cid
)
-
1
);
break
;
case
ACPI_TYPE_PACKAGE
:
/* TBD: Support CID packages */
break
;
/* compare multiple _CID entries against driver ids */
for
(
i
=
0
;
i
<
cid_list
->
count
;
i
++
)
{
if
(
strstr
(
driver
->
ids
,
cid_list
->
id
[
i
].
value
))
goto
Done
;
}
if
(
strlen
(
cid
)
&&
strstr
(
driver
->
ids
,
cid
))
goto
Done
;
}
error
=
-
ENOENT
;
...
...
@@ -523,27 +508,30 @@ static void acpi_device_get_busid(struct acpi_device * device, acpi_handle handl
static
void
acpi_device_set_id
(
struct
acpi_device
*
device
,
struct
acpi_device
*
parent
,
acpi_handle
handle
,
int
type
)
{
struct
acpi_device_info
info
;
struct
acpi_device_info
*
info
;
struct
acpi_buffer
buffer
=
{
ACPI_ALLOCATE_BUFFER
,
NULL
};
char
*
hid
=
NULL
;
char
*
uid
=
NULL
;
struct
acpi_compatible_id_list
*
cid_list
=
NULL
;
acpi_status
status
;
switch
(
type
)
{
case
ACPI_BUS_TYPE_DEVICE
:
status
=
acpi_get_object_info
(
handle
,
&
info
);
status
=
acpi_get_object_info
(
handle
,
&
buffer
);
if
(
ACPI_FAILURE
(
status
))
{
printk
(
"%s: Error reading device info
\n
"
,
__FUNCTION__
);
return
;
}
/* Clean up info strings (not NULL terminated) */
info
.
hardware_id
[
sizeof
(
info
.
hardware_id
)
-
1
]
=
'\0'
;
info
.
unique_id
[
sizeof
(
info
.
unique_id
)
-
1
]
=
'\0'
;
if
(
info
.
valid
&
ACPI_VALID_HID
)
hid
=
info
.
hardware_id
;
if
(
info
.
valid
&
ACPI_VALID_UID
)
uid
=
info
.
unique_id
;
if
(
info
.
valid
&
ACPI_VALID_ADR
)
{
device
->
pnp
.
bus_address
=
info
.
address
;
info
=
buffer
.
pointer
;
if
(
info
->
valid
&
ACPI_VALID_HID
)
hid
=
info
->
hardware_id
.
value
;
if
(
info
->
valid
&
ACPI_VALID_UID
)
uid
=
info
->
unique_id
.
value
;
if
(
info
->
valid
&
ACPI_VALID_CID
)
cid_list
=
&
info
->
compatibility_id
;
if
(
info
->
valid
&
ACPI_VALID_ADR
)
{
device
->
pnp
.
bus_address
=
info
->
address
;
device
->
flags
.
bus_address
=
1
;
}
break
;
...
...
@@ -586,6 +574,15 @@ static void acpi_device_set_id(struct acpi_device * device, struct acpi_device *
sprintf
(
device
->
pnp
.
unique_id
,
"%s"
,
uid
);
device
->
flags
.
unique_id
=
1
;
}
if
(
cid_list
)
{
device
->
pnp
.
cid_list
=
kmalloc
(
cid_list
->
size
,
GFP_KERNEL
);
if
(
device
->
pnp
.
cid_list
)
memcpy
(
device
->
pnp
.
cid_list
,
cid_list
,
cid_list
->
size
);
else
printk
(
KERN_ERR
"Memory allocation error
\n
"
);
}
acpi_os_free
(
buffer
.
pointer
);
}
int
acpi_device_set_context
(
struct
acpi_device
*
device
,
int
type
)
...
...
@@ -781,8 +778,12 @@ acpi_bus_add (
end:
if
(
!
result
)
*
child
=
device
;
else
else
{
if
(
device
->
pnp
.
cid_list
)
kfree
(
device
->
pnp
.
cid_list
);
kfree
(
device
);
}
return_VALUE
(
result
);
}
...
...
include/acpi/acpi_bus.h
View file @
462bcde6
...
...
@@ -186,6 +186,7 @@ struct acpi_device_pnp {
acpi_bus_id
bus_id
;
/* Object name */
acpi_bus_address
bus_address
;
/* _ADR */
acpi_hardware_id
hardware_id
;
/* _HID */
struct
acpi_compatible_id_list
*
cid_list
;
/* _CIDs */
acpi_unique_id
unique_id
;
/* _UID */
acpi_device_name
device_name
;
/* Driver-determined */
acpi_device_class
device_class
;
/* " */
...
...
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