Skip to content

Commit

Permalink
rpmsg: Introduce a driver override mechanism
Browse files Browse the repository at this point in the history
Similar to other subsystems it's useful to provide a mechanism to force
a specific driver match on a device, so introduce this.

Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
andersson committed Oct 31, 2016
1 parent 66dca39 commit e950604
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/rpmsg/rpmsg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)
const struct rpmsg_device_id *ids = rpdrv->id_table;
unsigned int i;

if (rpdev->driver_override)
return !strcmp(rpdev->driver_override, drv->name);

if (ids)
for (i = 0; ids[i].name[0]; i++)
if (rpmsg_id_match(rpdev, &ids[i]))
Expand Down
2 changes: 2 additions & 0 deletions include/linux/rpmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct rpmsg_channel_info {
* rpmsg_device - device that belong to the rpmsg bus
* @dev: the device struct
* @id: device id (used to match between rpmsg drivers and devices)
* @driver_override: driver name to force a match
* @src: local address
* @dst: destination address
* @ept: the rpmsg endpoint of this channel
Expand All @@ -72,6 +73,7 @@ struct rpmsg_channel_info {
struct rpmsg_device {
struct device dev;
struct rpmsg_device_id id;
char *driver_override;
u32 src;
u32 dst;
struct rpmsg_endpoint *ept;
Expand Down

0 comments on commit e950604

Please sign in to comment.