]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
rpmsg: Introduce a driver override mechanism
authorBjorn Andersson <bjorn.andersson@linaro.org>
Sat, 8 Oct 2016 04:23:12 +0000 (21:23 -0700)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Mon, 31 Oct 2016 22:41:46 +0000 (15:41 -0700)
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 <bjorn.andersson@linaro.org>
drivers/rpmsg/rpmsg_core.c
include/linux/rpmsg.h

index b6ea9ffa73816d2bbf3cada1033a5058ccb14394..087d4db896c81f29edd34e80921f2b1acd5576b3 100644 (file)
@@ -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]))
index 452d393cc8dd9b5fccf286c132398819711de71b..7ad6c205f110146ae2084be763bc1f0bd441ac61 100644 (file)
@@ -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
@@ -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;