Skip to content

Commit

Permalink
opp: De-obscurify OPP structs and disclose find_device_opp
Browse files Browse the repository at this point in the history
Move definitions of OPP structs in the header file so that its
members are public and the struct is no longer obscure.

Define interface for find_device_opp in the header file.
  • Loading branch information
AndreiLux authored and javilonas committed May 31, 2015
1 parent db85715 commit fa82e93
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
8 changes: 5 additions & 3 deletions drivers/base/power/opp.c
Expand Up @@ -59,6 +59,7 @@
*
* This structure stores the OPP information for a given device.
*/
#if 0 /* Definition moved to header file */
struct opp {
struct list_head node;

Expand All @@ -69,7 +70,7 @@ struct opp {
struct device_opp *dev_opp;
struct rcu_head head;
};

#endif
/**
* struct device_opp - Device opp structure
* @node: list node - contains the devices with OPPs that
Expand All @@ -85,14 +86,15 @@ struct opp {
* a device. This structure is not meant to be shared to users as it is
* meant for book keeping and private to OPP library
*/
#if 0 /* Definition moved to header file */
struct device_opp {
struct list_head node;

struct device *dev;
struct srcu_notifier_head head;
struct list_head opp_list;
};

#endif
/*
* The root of the list of all devices. All device_opp structures branch off
* from here, with each device_opp containing the list of opp it supports in
Expand All @@ -116,7 +118,7 @@ static DEFINE_MUTEX(dev_opp_list_lock);
* is a RCU protected pointer. This means that device_opp is valid as long
* as we are under RCU lock.
*/
static struct device_opp *find_device_opp(struct device *dev)
struct device_opp *find_device_opp(struct device *dev)
{
struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV);

Expand Down
22 changes: 21 additions & 1 deletion include/linux/opp.h
Expand Up @@ -18,7 +18,25 @@
#include <linux/cpufreq.h>
#include <linux/notifier.h>

struct opp;
struct opp {
struct list_head node;

bool available;
unsigned long rate;
unsigned long u_volt;

struct device_opp *dev_opp;
struct rcu_head head;
};

struct device_opp {
struct list_head node;

struct device *dev;
struct srcu_notifier_head head;
struct list_head opp_list;
};

struct device;

enum opp_event {
Expand All @@ -27,6 +45,8 @@ enum opp_event {

#if defined(CONFIG_PM_OPP)

struct device_opp *find_device_opp(struct device *dev);

unsigned long opp_get_voltage(struct opp *opp);

unsigned long opp_get_freq(struct opp *opp);
Expand Down

0 comments on commit fa82e93

Please sign in to comment.