Device properties framework updates for v4.15-rc1

These make the fwnode_handle_get() function return a pointer to the
 target fwnode object, which reflects the of_node_get() behavior, and
 add a macro for iterating over graph endpoints (Sakari Ailus).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJaCg5qAAoJEILEb/54YlRxQ48QAKkvoLbNyj1MM2CpV99h0X01
 /nbzzXexLiCuKW0XwUTFsUFT0gEBI/WVQTB7p79OymIlio+ryWGHPqnD+0BnFSRa
 dRMd/ZygaByaJIkc/wb4Rd3hJ7AIFasfSRXjKko8cBwrqfeW18XKq9otCIHeYkWF
 4gIziJRJQVinLrpJ2m4sJxytIzdTD7wSF3ASqTUwXeXI0QEfUClpt3LDPJqIzqwq
 69pn1h7UEjYYQAPt5j808hD/K5b/tDFwddH+QAaQ1pn1zMC3Ia5i6IVrYo8H6L6p
 JroPCxcnPI5vqCBQp1PG5RNycHvAI1G17YKdfn8Gxs4GlcrW4KAJm9Ex7YOwfyAB
 lua3/ljR4dhcPfjCF5cXiMNfrg5juqrbxMDdNsO2aPMiFifrzHbzdVXlEbP8kbBo
 81qmBYcRSwtQ3HQci2ZjcnOvZmTmE3OaHn9MK090Uz2eiZ6fkNgBvP6lEDzPqfDw
 hzk3toNdFd/sp/aNjHGpbDFBGQcRFPTeJF+iVPFdjmE0Q+W17iECbO8tkJP0AdGS
 d/5yPuG6oNGqryG2tMaGNRhZg5zrOPj7EJTH1eUImhV7YQkDV1O0E/FWJFzXmkwn
 WZzkiGy+D12YUBURZshUufA5wlMxXWMHGP5kEniu/TOepJevXFG8wXC1GptWmzfh
 pfiaG9wxs3FU7YAqqnBZ
 =QZfK
 -----END PGP SIGNATURE-----

Merge tag 'devprop-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull device properties framework updates from Rafael Wysocki:
 "These make the fwnode_handle_get() function return a pointer to the
  target fwnode object, which reflects the of_node_get() behavior, and
  add a macro for iterating over graph endpoints (Sakari Ailus)"

* tag 'devprop-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  device property: Add a macro for interating over graph endpoints
  device property: Make fwnode_handle_get() return the fwnode
This commit is contained in:
Linus Torvalds 2017-11-13 20:36:37 -08:00
commit 3c073991eb
4 changed files with 15 additions and 6 deletions

View file

@ -1044,10 +1044,15 @@ EXPORT_SYMBOL_GPL(device_get_named_child_node);
/**
* fwnode_handle_get - Obtain a reference to a device node
* @fwnode: Pointer to the device node to obtain the reference to.
*
* Returns the fwnode handle.
*/
void fwnode_handle_get(struct fwnode_handle *fwnode)
struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode)
{
fwnode_call_void_op(fwnode, get);
if (!fwnode_has_op(fwnode, get))
return fwnode;
return fwnode_call_ptr_op(fwnode, get);
}
EXPORT_SYMBOL_GPL(fwnode_handle_get);

View file

@ -817,9 +817,9 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node,
}
EXPORT_SYMBOL(of_graph_get_remote_node);
static void of_fwnode_get(struct fwnode_handle *fwnode)
static struct fwnode_handle *of_fwnode_get(struct fwnode_handle *fwnode)
{
of_node_get(to_of_node(fwnode));
return of_fwnode_handle(of_node_get(to_of_node(fwnode)));
}
static void of_fwnode_put(struct fwnode_handle *fwnode)

View file

@ -68,7 +68,7 @@ struct fwnode_reference_args {
* @graph_parse_endpoint: Parse endpoint for port and endpoint id.
*/
struct fwnode_operations {
void (*get)(struct fwnode_handle *fwnode);
struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
void (*put)(struct fwnode_handle *fwnode);
bool (*device_is_available)(const struct fwnode_handle *fwnode);
bool (*property_present)(const struct fwnode_handle *fwnode,

View file

@ -100,7 +100,7 @@ struct fwnode_handle *fwnode_get_named_child_node(
struct fwnode_handle *device_get_named_child_node(struct device *dev,
const char *childname);
void fwnode_handle_get(struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
void fwnode_handle_put(struct fwnode_handle *fwnode);
unsigned int device_get_child_node_count(struct device *dev);
@ -293,6 +293,10 @@ struct fwnode_handle *
fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
u32 endpoint);
#define fwnode_graph_for_each_endpoint(fwnode, child) \
for (child = NULL; \
(child = fwnode_graph_get_next_endpoint(fwnode, child)); )
int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint);