Method and apparatus for intercommunications amongst device drivers
First Claim
Patent Images
1. A machine-implemented method for managing device drivers of devices in a computer, the method comprising:
- providing an application programming interface (API) by a kernel of an operating system (OS) executed in a memory by a processor of a computer, the API being accessible by a plurality of device drivers associated with a plurality of devices in the computer, wherein each of the plurality of devices is represented by a node of a device tree having a hierarchical structure, and wherein the API is maintained by a node that is a most top node in the device tree;
receiving, at a device manager running within the kernel via the API, a request from a first instance of a device driver during an initialization of the first instance of the device driver, wherein the first instance of the device driver was launched in response to an initialization of a first of the plurality of devices installed in the computer;
in response to the request, determining, by the device manager based on the request, whether a second instance of the device driver is currently loaded within the kernel for supporting a second of the plurality of devices installed in the computer, including accessing a data structure having a plurality entries corresponding to the plurality of devices, wherein each entry includes a first field to store an identifier of a corresponding device and a second field to store a handle of a device driver currently associated with the corresponding device;
inserting a first handle of the first instance of the device driver in the second field of a corresponding device in the data structure if the second field is empty;
starting the first instance of the device driver if the second field of the corresponding device is empty;
returning, by the device manager via the API, a first driver handle of the first instance of the device driver if the second instance of the device driver has not been loaded;
returning, by the device manager via the API, a second driver handle of the second instance of the device driver if the second instance of the device driver has been loaded, including retrieving the second driver handle from the second field of the corresponding device in the data structure; and
unloading the first instance of the device driver if the second instance of the device driver is currently loaded, wherein the returned first and second driver handles are used by the first instance of the device driver to determine whether the first instance of the device driver should unload itself from the memory prior to finishing the initialization of the first instance of the device driver, such that only one instance of the device driver is loaded in the memory during regular operations of the device driver.
1 Assignment
0 Petitions
Accused Products
Abstract
Techniques for intercommunication amongst device drivers are described herein. In one embodiment, an application programming interface (API) is provided by a kernel of an operating system (OS) running within a data processing system. The API is accessible by device drivers associated with multiple devices installed in the system. In response to a request from a first instance of a driver via the API, information indicating whether another instance of the same driver is currently started is returned via the API. Other methods and apparatuses are also described.
10 Citations
20 Claims
-
1. A machine-implemented method for managing device drivers of devices in a computer, the method comprising:
-
providing an application programming interface (API) by a kernel of an operating system (OS) executed in a memory by a processor of a computer, the API being accessible by a plurality of device drivers associated with a plurality of devices in the computer, wherein each of the plurality of devices is represented by a node of a device tree having a hierarchical structure, and wherein the API is maintained by a node that is a most top node in the device tree; receiving, at a device manager running within the kernel via the API, a request from a first instance of a device driver during an initialization of the first instance of the device driver, wherein the first instance of the device driver was launched in response to an initialization of a first of the plurality of devices installed in the computer; in response to the request, determining, by the device manager based on the request, whether a second instance of the device driver is currently loaded within the kernel for supporting a second of the plurality of devices installed in the computer, including accessing a data structure having a plurality entries corresponding to the plurality of devices, wherein each entry includes a first field to store an identifier of a corresponding device and a second field to store a handle of a device driver currently associated with the corresponding device; inserting a first handle of the first instance of the device driver in the second field of a corresponding device in the data structure if the second field is empty; starting the first instance of the device driver if the second field of the corresponding device is empty; returning, by the device manager via the API, a first driver handle of the first instance of the device driver if the second instance of the device driver has not been loaded; returning, by the device manager via the API, a second driver handle of the second instance of the device driver if the second instance of the device driver has been loaded, including retrieving the second driver handle from the second field of the corresponding device in the data structure; and unloading the first instance of the device driver if the second instance of the device driver is currently loaded, wherein the returned first and second driver handles are used by the first instance of the device driver to determine whether the first instance of the device driver should unload itself from the memory prior to finishing the initialization of the first instance of the device driver, such that only one instance of the device driver is loaded in the memory during regular operations of the device driver. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A non-transitory machine-readable medium having instructions stored herein, which when executed by a computer, cause a machine to perform a method, the method comprising:
-
providing an application programming interface (API) by a kernel of an operating system (OS) executed in a memory by a processor of a computer, the API being accessible by a plurality of device drivers associated with a plurality of devices in the computer, wherein each of the plurality of devices is represented by a node of a device tree having a hierarchical structure, and wherein the API is maintained by a node that is a most top node in the device tree; receiving, at a device manager running within the kernel via the API, a request from a first instance of a device driver during an initialization of the first instance of the device driver, wherein the first instance of the device driver was launched in response to an initialization of a first of the plurality of devices installed in the computer; in response to the request, determining, by the device manager based on the request, whether a second instance of the device driver is currently loaded within the kernel for supporting a second of the plurality of devices installed in the computer, including accessing a data structure having a plurality entries corresponding to the plurality of devices, wherein each entry includes a first field to store an identifier of a corresponding device and a second field to store a handle of a device driver currently associated with the corresponding device; inserting a first handle of the first instance of the device driver in the second field of a corresponding device in the data structure if the second field is empty; starting the first instance of the device driver if the second field of the corresponding device is empty; returning, by the device manager via the API, a first driver handle of the first instance of the device driver if the second instance of the device driver has not been loaded; returning, by the device manager via the API, a second driver handle of the second instance of the device driver if the second instance of the device driver has been loaded, including retrieving the second driver handle from the second field of the corresponding device in the data structure; and unloading the first instance of the device driver if the second instance of the device driver is currently loaded, wherein the returned first and second driver handles are used by the first instance of the device driver to determine whether the first instance of the device driver should unload itself from the memory prior to finishing the initialization of the first instance of the device driver, such that only one instance of the device driver is loaded in the memory during regular operations of the device driver. - View Dependent Claims (7, 8, 9, 10)
-
-
11. An apparatus for managing device drivers of devices in a computer, the apparatus comprising:
-
means for providing an application programming interface (API) within a kernel of an operating system (OS) running within a computer, the API being accessible by a plurality of device drivers associated with a plurality of devices in the computer, wherein each of the plurality of devices is represented by a node of a device tree having a hierarchical structure, and wherein the API is maintained by a node that is a most top node in the device tree; means for receiving a request from a first instance of a device driver during an initialization of the first instance of the device driver, wherein the first instance of the device driver was launched in response to an initialization of a first of the plurality of devices installed in the computer; in response to the request, means for determining whether a second instance of the device driver is currently loaded within the kernel for supporting a second of the plurality of devices installed in the computer, including means for accessing a data structure having a plurality entries corresponding to the plurality of devices, wherein each entry includes a first field to store an identifier of a corresponding device and a second field to store a handle of a device driver currently associated with the corresponding device; means for inserting a first handle of the first instance of the device driver in the second field of a corresponding device in the data structure if the second field is empty; means for starting the first instance of the device driver if the second field of the corresponding device is empty; means for returning a first driver handle of the first instance of the device driver if the second instance of the device driver has not been loaded; means for returning a second driver handle of the second instance of the device driver if the second instance of the device driver has been loaded, including means for retrieving the second driver handle from the second field of the corresponding device in the data structure; and means for unloading the first instance of the device driver if the second instance of the device driver is currently loaded, wherein the returned first and second driver handles are used by the first instance of the device driver to determine whether the first instance of the device driver should unload itself from the memory prior to finishing the initialization of the first instance of the device driver, such that only one instance of the device driver is loaded in the memory during regular operations of the device driver. - View Dependent Claims (12, 13, 14, 15)
-
-
16. A computer system architecture, comprising:
-
a plurality of device drivers loaded in a kernel of an operating system of a computer, each of the device drivers corresponding to a device presented in the computer, wherein each of the plurality of devices is represented by a node of a device tree having a hierarchical structure, and wherein the API is maintained by a node that is a most top node in the device tree; an application programming interface (API) for coupling the kernel with the plurality of device drivers, the API enabling an instance of a device driver to communicate with the kernel to determine whether another instance of the device driver is currently loaded; and a device manager configured to receive, via the API, a request from a first instance of a device driver during an initialization of the first instance of the device driver, wherein the first instance of the device driver was launched in response to an initialization of a first of the plurality of devices installed in the computer, in response to the request, determine based on the request whether a second instance of the device driver is currently loaded within the kernel for supporting a second of the plurality of devices installed in the computer, including accessing a data structure having a plurality entries corresponding to the plurality of devices, wherein each entry includes a first field to store an identifier of a corresponding device and a second field to store a handle of a device driver currently associated with the corresponding device, insert a first handle of the first instance of the device driver in the second field of a corresponding device in the data structure if the second field is empty, start the first instance of the device driver if the second field of the corresponding device is empty, return, via the API, a first driver handle of the first instance of the device driver if the second instance of the device driver has not been loaded, return, via the API, a second driver handle of the second instance of the device driver if the second instance of the device driver has been loaded, including retrieving the second driver handle from the second field of the corresponding device in the data structure, and unload the first instance of the device driver if the second instance of the device driver is currently loaded, wherein the returned first and second driver handles are used by the first instance of the device driver to determine whether the first instance of the device driver should unload itself from the memory prior to finishing the initialization of the first instance of the device driver, such that only one instance of the device driver is loaded in the memory during regular operations of the device driver. - View Dependent Claims (17, 18, 19, 20)
-
Specification