lkml.org 
[lkml]   [2013]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: RFC: (re-)binding the VFIO platform driver to a platform device
    From
    Date
    On Wed, 2013-10-09 at 14:02 -0500, Yoder Stuart-B08248 wrote:
    > Have been thinking about this issue some more. As Scott mentioned,
    > 'wildcard' matching for a driver can be fairly done in the platform
    > bus driver. We could add a new flag to the platform driver struct:
    >
    > diff --git a/drivers/base/platform.c b/drivers/base/platform.c
    > index 4f8bef3..4d6cf14 100644
    > --- a/drivers/base/platform.c
    > +++ b/drivers/base/platform.c
    > @@ -727,6 +727,10 @@ static int platform_match(struct device *dev, struct device_driver *drv)
    > struct platform_device *pdev = to_platform_device(dev);
    > struct platform_driver *pdrv = to_platform_driver(drv);
    >
    > + /* the driver matches any device */
    > + if (pdrv->match_any)
    > + return 1;
    > +
    > /* Attempt an OF style match first */
    > if (of_driver_match_device(dev, drv))
    > return 1;
    >
    > However, the more problematic issue is that a bus driver has no way to
    > differentiate from an explicit bind request via sysfs and a bind that
    > happened through bus probing.

    Again, I think the wildcard match should be orthogonal to "don't bind by
    default" as far as the mechanism goes.

    There's already a "bool suppress_bind_attrs" to prevent sysfs
    bind/unbind. I suggested a similar flag to mean the oppsosite -- bind
    *only* through sysfs. Greg KH was skeptical and wanted to see a patch
    before any further discussion.

    > diff --git a/drivers/base/base.h b/drivers/base/base.h
    > index 2cbc677..7a15ef3 100644
    > --- a/drivers/base/base.h
    > +++ b/drivers/base/base.h
    > @@ -114,9 +114,9 @@ extern void driver_detach(struct device_driver *drv);
    > extern int driver_probe_device(struct device_driver *drv, struct device *dev);
    > extern void driver_deferred_probe_del(struct device *dev);
    > static inline int driver_match_device(struct device_driver *drv,
    > - struct device *dev)
    > + struct device *dev, int explicit_bind)
    > {
    > - return drv->bus->match ? drv->bus->match(dev, drv) : 1;
    > + return drv->bus->match ? drv->bus->match(dev, drv, explicit_bind) : 1;
    > }
    >
    > Of, course the above change would need to be propagated to the different
    > bus drivers that implement the 'match' function.

    ...which would not be a problem with my approach, because you could
    handle it in the callers of driver_match_device().

    -Scott





    \
     
     \ /
      Last update: 2013-10-09 21:41    [W:4.000 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site