diff mbox series

[API-NEXT,06/21] drv: driver: change drv unbind function name and pass correct parameter

Message ID 1487768164-43184-7-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show
Series driver items registration and probing | expand

Commit Message

Christophe Milard Feb. 22, 2017, 12:55 p.m. UTC
The driver removal function expects a device, of course...
Also unbind seems a better name to disconnect from a device
since remove has been used for removing the object itself for
enumerators.
Some extra parameters to allow for graceful unbinding are also added.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

---
 include/odp/drv/spec/driver.h | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

-- 
2.7.4

Comments

Bill Fischofer Feb. 22, 2017, 10:14 p.m. UTC | #1
On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard <
christophe.milard@linaro.org> wrote:

> The driver removal function expects a device, of course...

> Also unbind seems a better name to disconnect from a device

> since remove has been used for removing the object itself for

> enumerators.

> Some extra parameters to allow for graceful unbinding are also added.

>

> Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

> ---

>  include/odp/drv/spec/driver.h | 21 ++++++++++++++++++---

>  1 file changed, 18 insertions(+), 3 deletions(-)

>

> diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h

> index b08d7fb..a978d12 100644

> --- a/include/odp/drv/spec/driver.h

> +++ b/include/odp/drv/spec/driver.h

> @@ -300,14 +300,29 @@ struct odpdrv_driver_param_t {

>          */

>         int (*probe)(odpdrv_device_t *dev);

>

> -       /** Remove function:

> +       /** unbind function:

>          * Only called with devices whose probe() returned true

>          *

> +        * dev: the device to unbind

> +        * callback: if flag ODPDRV_DRV_UNBIND_IMMEDIATE is not specified,

> +        *  unbind should be attempted gracefuly, meaning that some IO may

> need

> +        *  to terminate before the driver is really unbound from the

> device:

> +        *  In this case (when the flag is not set), the driver is due to

> call

> +        *  the callback function when the driver is unbound from the

> device.

> +        *  This callback may occurs within the unbind() call if the driver

> +        *  does unbind immediately.

> +        *  If the ODPDRV_DRV_UNBIND_IMMEDIATE is specified, the driver is

> due

> +        *  to release the device immediately (poosibly less gracefuly).

>


Typo: possibly less gracefully


> +        *  The callback must be called immediately in this case.

>          */

> -       int (*remove)(odpdrv_device_param_t *dev);

> -

> +       int (*unbind)(odpdrv_device_t dev,

> +                     void (*callback)(odpdrv_device_t dev),

> +                     uint32_t flags);

>  };

>

> +/** The callback function must be called mmediately by the current ODP

> thread */

> +#define ODPDRV_DRV_UNBIND_IMMEDIATE    0x00000001

> +

>  /**

>  * Register an enumerator class.

>  * Each enumerator class calls this function at init time.

> --

> 2.7.4

>

>
Christophe Milard Feb. 27, 2017, 10:58 a.m. UTC | #2
On 22 February 2017 at 23:14, Bill Fischofer <bill.fischofer@linaro.org> wrote:
>

>

> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard

> <christophe.milard@linaro.org> wrote:

>>

>> The driver removal function expects a device, of course...

>> Also unbind seems a better name to disconnect from a device

>> since remove has been used for removing the object itself for

>> enumerators.

>> Some extra parameters to allow for graceful unbinding are also added.

>>

>> Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

>> ---

>>  include/odp/drv/spec/driver.h | 21 ++++++++++++++++++---

>>  1 file changed, 18 insertions(+), 3 deletions(-)

>>

>> diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h

>> index b08d7fb..a978d12 100644

>> --- a/include/odp/drv/spec/driver.h

>> +++ b/include/odp/drv/spec/driver.h

>> @@ -300,14 +300,29 @@ struct odpdrv_driver_param_t {

>>          */

>>         int (*probe)(odpdrv_device_t *dev);

>>

>> -       /** Remove function:

>> +       /** unbind function:

>>          * Only called with devices whose probe() returned true

>>          *

>> +        * dev: the device to unbind

>> +        * callback: if flag ODPDRV_DRV_UNBIND_IMMEDIATE is not specified,

>> +        *  unbind should be attempted gracefuly, meaning that some IO may

>> need

>> +        *  to terminate before the driver is really unbound from the

>> device:

>> +        *  In this case (when the flag is not set), the driver is due to

>> call

>> +        *  the callback function when the driver is unbound from the

>> device.

>> +        *  This callback may occurs within the unbind() call if the

>> driver

>> +        *  does unbind immediately.

>> +        *  If the ODPDRV_DRV_UNBIND_IMMEDIATE is specified, the driver is

>> due

>> +        *  to release the device immediately (poosibly less gracefuly).

>

>

> Typo: possibly less gracefully


Wonder why check-odp did not catch that...
=> V2

Christophe

>

>>

>> +        *  The callback must be called immediately in this case.

>>          */

>> -       int (*remove)(odpdrv_device_param_t *dev);

>> -

>> +       int (*unbind)(odpdrv_device_t dev,

>> +                     void (*callback)(odpdrv_device_t dev),

>> +                     uint32_t flags);

>>  };

>>

>> +/** The callback function must be called mmediately by the current ODP

>> thread */

>> +#define ODPDRV_DRV_UNBIND_IMMEDIATE    0x00000001

>> +

>>  /**

>>  * Register an enumerator class.

>>  * Each enumerator class calls this function at init time.

>> --

>> 2.7.4

>>

>
diff mbox series

Patch

diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h
index b08d7fb..a978d12 100644
--- a/include/odp/drv/spec/driver.h
+++ b/include/odp/drv/spec/driver.h
@@ -300,14 +300,29 @@  struct odpdrv_driver_param_t {
 	 */
 	int (*probe)(odpdrv_device_t *dev);
 
-	/** Remove function:
+	/** unbind function:
 	 * Only called with devices whose probe() returned true
 	 *
+	 * dev: the device to unbind
+	 * callback: if flag ODPDRV_DRV_UNBIND_IMMEDIATE is not specified,
+	 *  unbind should be attempted gracefuly, meaning that some IO may need
+	 *  to terminate before the driver is really unbound from the device:
+	 *  In this case (when the flag is not set), the driver is due to call
+	 *  the callback function when the driver is unbound from the device.
+	 *  This callback may occurs within the unbind() call if the driver
+	 *  does unbind immediately.
+	 *  If the ODPDRV_DRV_UNBIND_IMMEDIATE is specified, the driver is due
+	 *  to release the device immediately (poosibly less gracefuly).
+	 *  The callback must be called immediately in this case.
 	 */
-	int (*remove)(odpdrv_device_param_t *dev);
-
+	int (*unbind)(odpdrv_device_t dev,
+		      void (*callback)(odpdrv_device_t dev),
+		      uint32_t flags);
 };
 
+/** The callback function must be called mmediately by the current ODP thread */
+#define ODPDRV_DRV_UNBIND_IMMEDIATE	0x00000001
+
 /**
 * Register an enumerator class.
 * Each enumerator class calls this function at init time.