Skip to content

Commit

Permalink
device property: Constify fwnode connection match APIs
Browse files Browse the repository at this point in the history
The fwnode and device parameters are not altered in the fwnode
connection match APIs, constify them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
andy-shev authored and intel-lab-lkp committed Sep 27, 2022
1 parent 58398da commit 34401a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions drivers/base/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ const void *device_get_match_data(const struct device *dev)
}
EXPORT_SYMBOL_GPL(device_get_match_data);

static unsigned int fwnode_graph_devcon_matches(struct fwnode_handle *fwnode,
static unsigned int fwnode_graph_devcon_matches(const struct fwnode_handle *fwnode,
const char *con_id, void *data,
devcon_match_fn_t match,
void **matches,
Expand Down Expand Up @@ -1247,7 +1247,7 @@ static unsigned int fwnode_graph_devcon_matches(struct fwnode_handle *fwnode,
return count;
}

static unsigned int fwnode_devcon_matches(struct fwnode_handle *fwnode,
static unsigned int fwnode_devcon_matches(const struct fwnode_handle *fwnode,
const char *con_id, void *data,
devcon_match_fn_t match,
void **matches,
Expand Down Expand Up @@ -1289,7 +1289,7 @@ static unsigned int fwnode_devcon_matches(struct fwnode_handle *fwnode,
* device node. @match will be used to convert the connection description to
* data the caller is expecting to be returned.
*/
void *fwnode_connection_find_match(struct fwnode_handle *fwnode,
void *fwnode_connection_find_match(const struct fwnode_handle *fwnode,
const char *con_id, void *data,
devcon_match_fn_t match)
{
Expand Down Expand Up @@ -1326,7 +1326,7 @@ EXPORT_SYMBOL_GPL(fwnode_connection_find_match);
*
* Return: Number of matches resolved, or negative errno.
*/
int fwnode_connection_find_matches(struct fwnode_handle *fwnode,
int fwnode_connection_find_matches(const struct fwnode_handle *fwnode,
const char *con_id, void *data,
devcon_match_fn_t match,
void **matches, unsigned int matches_len)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/roles/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
}
EXPORT_SYMBOL_GPL(usb_role_switch_get_role);

static void *usb_role_switch_match(struct fwnode_handle *fwnode, const char *id,
static void *usb_role_switch_match(const struct fwnode_handle *fwnode, const char *id,
void *data)
{
struct device *dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/typec/retimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static int retimer_fwnode_match(struct device *dev, const void *fwnode)
return dev_fwnode(dev) == fwnode && dev_name_ends_with(dev, "-retimer");
}

static void *typec_retimer_match(struct fwnode_handle *fwnode, const char *id, void *data)
static void *typec_retimer_match(const struct fwnode_handle *fwnode, const char *id, void *data)
{
struct device *dev;

Expand Down
10 changes: 5 additions & 5 deletions include/linux/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,21 +438,21 @@ unsigned int fwnode_graph_get_endpoint_count(struct fwnode_handle *fwnode,
int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint);

typedef void *(*devcon_match_fn_t)(struct fwnode_handle *fwnode, const char *id,
typedef void *(*devcon_match_fn_t)(const struct fwnode_handle *fwnode, const char *id,
void *data);

void *fwnode_connection_find_match(struct fwnode_handle *fwnode,
void *fwnode_connection_find_match(const struct fwnode_handle *fwnode,
const char *con_id, void *data,
devcon_match_fn_t match);

static inline void *device_connection_find_match(struct device *dev,
static inline void *device_connection_find_match(const struct device *dev,
const char *con_id, void *data,
devcon_match_fn_t match)
{
return fwnode_connection_find_match(dev_fwnode(dev), con_id, data, match);
return fwnode_connection_find_match(dev_fwnode_const(dev), con_id, data, match);
}

int fwnode_connection_find_matches(struct fwnode_handle *fwnode,
int fwnode_connection_find_matches(const struct fwnode_handle *fwnode,
const char *con_id, void *data,
devcon_match_fn_t match,
void **matches, unsigned int matches_len);
Expand Down

0 comments on commit 34401a7

Please sign in to comment.