From: Moore, R. <rob...@in...> - 2002-10-01 20:07:07
|
The reason we have the "valid" bitfield is that a Zero in at least some of those fields (HID/UID/STA/ADR) is not enough information to determine that the field is in fact invalid. Therefore, the ONLY way to determine which fields are valid is to examine the valid bits. Thus, it becomes overkill to clear out the entire structure first. We of course clear the valid field and set the bits one-by-one as the information becomes available. This probably boils down to a philosophical debate -- but however, my feeling is that the less code in the kernel, the better. Any code that does not check the valid bits after this call is broken. Bob -----Original Message----- From: KOCHI, Takayoshi [mailto:t-k...@mv...] Sent: Tuesday, October 01, 2002 11:13 AM To: acp...@li... Subject: [ACPI] acpi_get_object_info() and acpi_device_info Hi, I was tracking down a problem and found that acpi_get_object_info() sometimes returns a partially initialized object. I'd like to add a line: memset(&info, 0, sizeof(acpi_device_info)); in acpi_get_object_info(), is it ok? acpi_get_object_info() fills acpi_device_info structure, but if, for example, _HID method evaluation fails, it won't fill `hardware_id' member of acpi_device_info structure. We can know which member is initialized by `valid' member of the structure, but I think it's safe to fill 0's before filling any contents. Not all of the acpi_get_object_info() users cares it. bus.c::acpi_bus_add() handles `info' very carefully while nsdumpdv.c::acpi_ns_dump_one_device() doesn't clear `info' variable nor check info.valid flag. Thanks, -- KOCHI, Takayoshi <t-k...@cq.../t-k...@mv...> ------------------------------------------------------- This sf.net email is sponsored by: DEDICATED SERVERS only $89! Linux or FreeBSD, FREE setup, FAST network. Get your own server today at http://www.ServePath.com/indexfm.htm _______________________________________________ Acpi-devel mailing list Acp...@li... https://lists.sourceforge.net/lists/listinfo/acpi-devel |