Skip to content

Commit

Permalink
[device] Provide a driver-private data field for root devices
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Dec 18, 2014
1 parent 35c5379 commit d83fb45
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/include/ipxe/device.h
Expand Up @@ -93,6 +93,8 @@ struct root_device {
struct device dev;
/** Root device driver */
struct root_driver *driver;
/** Driver-private data */
void *priv;
};

/** A root device driver */
Expand Down Expand Up @@ -123,6 +125,27 @@ struct root_driver {
/** Declare a root device */
#define __root_device __table_entry ( ROOT_DEVICES, 01 )

/**
* Set root device driver-private data
*
* @v rootdev Root device
* @v priv Private data
*/
static inline void rootdev_set_drvdata ( struct root_device *rootdev,
void *priv ){
rootdev->priv = priv;
}

/**
* Get root device driver-private data
*
* @v rootdev Root device
* @ret priv Private data
*/
static inline void * rootdev_get_drvdata ( struct root_device *rootdev ) {
return rootdev->priv;
}

extern int device_keep_count;

/**
Expand Down

0 comments on commit d83fb45

Please sign in to comment.