Skip to content

Commit 892ebdc

Browse files
jonhunterrafaeljw
authored andcommitted
PM / Domains: Don't expose xlate and provider helper functions
Functions __of_genpd_xlate_simple(), __of_genpd_xlate_onecell() and __of_genpd_add_provider() are not used outside of the core generic PM domain code. Therefore, reduce the number of APIs exposed by making these static. At the same time don't expose the typedef for genpd_xlate_t either and make this a local definition as well. The functions are renamed to follow the naming conventions for static functions in the generic PM domain core. Signed-off-by: Jon Hunter <[email protected]> Acked-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent f58d4e5 commit 892ebdc

File tree

2 files changed

+51
-40
lines changed

2 files changed

+51
-40
lines changed

drivers/base/power/domain.c

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,10 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
13291329
EXPORT_SYMBOL_GPL(pm_genpd_init);
13301330

13311331
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
1332+
1333+
typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
1334+
void *data);
1335+
13321336
/*
13331337
* Device Tree based PM domain providers.
13341338
*
@@ -1340,8 +1344,8 @@ EXPORT_SYMBOL_GPL(pm_genpd_init);
13401344
* maps a PM domain specifier retrieved from the device tree to a PM domain.
13411345
*
13421346
* Two simple mapping functions have been provided for convenience:
1343-
* - __of_genpd_xlate_simple() for 1:1 device tree node to PM domain mapping.
1344-
* - __of_genpd_xlate_onecell() for mapping of multiple PM domains per node by
1347+
* - genpd_xlate_simple() for 1:1 device tree node to PM domain mapping.
1348+
* - genpd_xlate_onecell() for mapping of multiple PM domains per node by
13451349
* index.
13461350
*/
13471351

@@ -1366,26 +1370,25 @@ static LIST_HEAD(of_genpd_providers);
13661370
static DEFINE_MUTEX(of_genpd_mutex);
13671371

13681372
/**
1369-
* __of_genpd_xlate_simple() - Xlate function for direct node-domain mapping
1373+
* genpd_xlate_simple() - Xlate function for direct node-domain mapping
13701374
* @genpdspec: OF phandle args to map into a PM domain
13711375
* @data: xlate function private data - pointer to struct generic_pm_domain
13721376
*
13731377
* This is a generic xlate function that can be used to model PM domains that
13741378
* have their own device tree nodes. The private data of xlate function needs
13751379
* to be a valid pointer to struct generic_pm_domain.
13761380
*/
1377-
struct generic_pm_domain *__of_genpd_xlate_simple(
1381+
static struct generic_pm_domain *genpd_xlate_simple(
13781382
struct of_phandle_args *genpdspec,
13791383
void *data)
13801384
{
13811385
if (genpdspec->args_count != 0)
13821386
return ERR_PTR(-EINVAL);
13831387
return data;
13841388
}
1385-
EXPORT_SYMBOL_GPL(__of_genpd_xlate_simple);
13861389

13871390
/**
1388-
* __of_genpd_xlate_onecell() - Xlate function using a single index.
1391+
* genpd_xlate_onecell() - Xlate function using a single index.
13891392
* @genpdspec: OF phandle args to map into a PM domain
13901393
* @data: xlate function private data - pointer to struct genpd_onecell_data
13911394
*
@@ -1394,7 +1397,7 @@ EXPORT_SYMBOL_GPL(__of_genpd_xlate_simple);
13941397
* A single cell is used as an index into an array of PM domains specified in
13951398
* the genpd_onecell_data struct when registering the provider.
13961399
*/
1397-
struct generic_pm_domain *__of_genpd_xlate_onecell(
1400+
static struct generic_pm_domain *genpd_xlate_onecell(
13981401
struct of_phandle_args *genpdspec,
13991402
void *data)
14001403
{
@@ -1414,16 +1417,15 @@ struct generic_pm_domain *__of_genpd_xlate_onecell(
14141417

14151418
return genpd_data->domains[idx];
14161419
}
1417-
EXPORT_SYMBOL_GPL(__of_genpd_xlate_onecell);
14181420

14191421
/**
1420-
* __of_genpd_add_provider() - Register a PM domain provider for a node
1422+
* genpd_add_provider() - Register a PM domain provider for a node
14211423
* @np: Device node pointer associated with the PM domain provider.
14221424
* @xlate: Callback for decoding PM domain from phandle arguments.
14231425
* @data: Context pointer for @xlate callback.
14241426
*/
1425-
int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
1426-
void *data)
1427+
static int genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
1428+
void *data)
14271429
{
14281430
struct of_genpd_provider *cp;
14291431

@@ -1442,7 +1444,30 @@ int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
14421444

14431445
return 0;
14441446
}
1445-
EXPORT_SYMBOL_GPL(__of_genpd_add_provider);
1447+
1448+
/**
1449+
* of_genpd_add_provider_simple() - Register a simple PM domain provider
1450+
* @np: Device node pointer associated with the PM domain provider.
1451+
* @genpd: Pointer to PM domain associated with the PM domain provider.
1452+
*/
1453+
int of_genpd_add_provider_simple(struct device_node *np,
1454+
struct generic_pm_domain *genpd)
1455+
{
1456+
return genpd_add_provider(np, genpd_xlate_simple, genpd);
1457+
}
1458+
EXPORT_SYMBOL_GPL(of_genpd_add_provider_simple);
1459+
1460+
/**
1461+
* of_genpd_add_provider_onecell() - Register a onecell PM domain provider
1462+
* @np: Device node pointer associated with the PM domain provider.
1463+
* @data: Pointer to the data associated with the PM domain provider.
1464+
*/
1465+
int of_genpd_add_provider_onecell(struct device_node *np,
1466+
struct genpd_onecell_data *data)
1467+
{
1468+
return genpd_add_provider(np, genpd_xlate_onecell, data);
1469+
}
1470+
EXPORT_SYMBOL_GPL(of_genpd_add_provider_onecell);
14461471

14471472
/**
14481473
* of_genpd_del_provider() - Remove a previously registered PM domain provider

include/linux/pm_domain.h

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -187,35 +187,32 @@ struct genpd_onecell_data {
187187
unsigned int num_domains;
188188
};
189189

190-
typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
191-
void *data);
192-
193190
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
194-
int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
195-
void *data);
191+
int of_genpd_add_provider_simple(struct device_node *np,
192+
struct generic_pm_domain *genpd);
193+
int of_genpd_add_provider_onecell(struct device_node *np,
194+
struct genpd_onecell_data *data);
196195
void of_genpd_del_provider(struct device_node *np);
197-
struct generic_pm_domain *__of_genpd_xlate_simple(
198-
struct of_phandle_args *genpdspec,
199-
void *data);
200-
struct generic_pm_domain *__of_genpd_xlate_onecell(
201-
struct of_phandle_args *genpdspec,
202-
void *data);
203196
extern int of_genpd_add_device(struct of_phandle_args *args,
204197
struct device *dev);
205198
extern int of_genpd_add_subdomain(struct of_phandle_args *parent,
206199
struct of_phandle_args *new_subdomain);
207200

208201
int genpd_dev_pm_attach(struct device *dev);
209202
#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
210-
static inline int __of_genpd_add_provider(struct device_node *np,
211-
genpd_xlate_t xlate, void *data)
203+
static inline int of_genpd_add_provider_simple(struct device_node *np,
204+
struct generic_pm_domain *genpd)
212205
{
213-
return 0;
206+
return -ENOTSUPP;
207+
}
208+
209+
static inline int of_genpd_add_provider_onecell(struct device_node *np,
210+
struct genpd_onecell_data *data)
211+
{
212+
return -ENOTSUPP;
214213
}
215-
static inline void of_genpd_del_provider(struct device_node *np) {}
216214

217-
#define __of_genpd_xlate_simple NULL
218-
#define __of_genpd_xlate_onecell NULL
215+
static inline void of_genpd_del_provider(struct device_node *np) {}
219216

220217
static inline int of_genpd_add_device(struct of_phandle_args *args,
221218
struct device *dev)
@@ -235,17 +232,6 @@ static inline int genpd_dev_pm_attach(struct device *dev)
235232
}
236233
#endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
237234

238-
static inline int of_genpd_add_provider_simple(struct device_node *np,
239-
struct generic_pm_domain *genpd)
240-
{
241-
return __of_genpd_add_provider(np, __of_genpd_xlate_simple, genpd);
242-
}
243-
static inline int of_genpd_add_provider_onecell(struct device_node *np,
244-
struct genpd_onecell_data *data)
245-
{
246-
return __of_genpd_add_provider(np, __of_genpd_xlate_onecell, data);
247-
}
248-
249235
#ifdef CONFIG_PM
250236
extern int dev_pm_domain_attach(struct device *dev, bool power_on);
251237
extern void dev_pm_domain_detach(struct device *dev, bool power_off);

0 commit comments

Comments
 (0)