drivers/bus: fill driver reference after NXP probing

Message ID 20180925192259.12249-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series drivers/bus: fill driver reference after NXP probing |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Thomas Monjalon Sept. 25, 2018, 7:22 p.m. UTC
  The probing functions of NXP buses were missing to set
the driver used for successfully probing a device.

The NXP driver and the generic rte_driver are now set
in the device structures.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/bus/dpaa/dpaa_bus.c   | 6 +++++-
 drivers/bus/fslmc/fslmc_bus.c | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
  

Comments

Shreyansh Jain Sept. 26, 2018, 8:12 a.m. UTC | #1
On Wednesday 26 September 2018 12:52 AM, Thomas Monjalon wrote:
> The probing functions of NXP buses were missing to set
> the driver used for successfully probing a device.
> 
> The NXP driver and the generic rte_driver are now set
> in the device structures.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

A part of this was already being done in the drv->probe(), though it was 
  not complete (dpaa2_dev->driver = dpaa2_drv; was not being done).

--->8---net/dpaa2/dpaa2_ethdev.c--
2008
2009         eth_dev->device = &dpaa2_dev->device;
2010         eth_dev->device->driver = &dpaa2_drv->driver;
2011
--->8---

Thank you!

Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
  
Thomas Monjalon Sept. 27, 2018, 12:40 p.m. UTC | #2
26/09/2018 10:12, Shreyansh Jain:
> On Wednesday 26 September 2018 12:52 AM, Thomas Monjalon wrote:
> > The probing functions of NXP buses were missing to set
> > the driver used for successfully probing a device.
> > 
> > The NXP driver and the generic rte_driver are now set
> > in the device structures.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> 
> A part of this was already being done in the drv->probe(), though it was 
>   not complete (dpaa2_dev->driver = dpaa2_drv; was not being done).
> 
> --->8---net/dpaa2/dpaa2_ethdev.c--
> 2008
> 2009         eth_dev->device = &dpaa2_dev->device;
> 2010         eth_dev->device->driver = &dpaa2_drv->driver;
> 2011
> --->8---

I guess we could remove the driver assignment in NXP drivers,
after this patch applied.

> Thank you!
> 
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Applied
  
Shreyansh Jain Sept. 28, 2018, 12:27 p.m. UTC | #3
On Thursday 27 September 2018 06:10 PM, Thomas Monjalon wrote:
> 26/09/2018 10:12, Shreyansh Jain:
>> On Wednesday 26 September 2018 12:52 AM, Thomas Monjalon wrote:
>>> The probing functions of NXP buses were missing to set
>>> the driver used for successfully probing a device.
>>>
>>> The NXP driver and the generic rte_driver are now set
>>> in the device structures.
>>>
>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>>> ---
>>
>> A part of this was already being done in the drv->probe(), though it was
>>    not complete (dpaa2_dev->driver = dpaa2_drv; was not being done).
>>
>> --->8---net/dpaa2/dpaa2_ethdev.c--
>> 2008
>> 2009         eth_dev->device = &dpaa2_dev->device;
>> 2010         eth_dev->device->driver = &dpaa2_drv->driver;
>> 2011
>> --->8---
> 
> I guess we could remove the driver assignment in NXP drivers,
> after this patch applied.
> 

Sent. I have kept fixes reference to your patch.
  

Patch

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 16fabd1be..49cd04dbb 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -563,8 +563,12 @@  rte_dpaa_bus_probe(void)
 			    dev->device.devargs->policy ==
 			    RTE_DEV_WHITELISTED)) {
 				ret = drv->probe(drv, dev);
-				if (ret)
+				if (ret) {
 					DPAA_BUS_ERR("Unable to probe.\n");
+				} else {
+					dev->driver = drv;
+					dev->device.driver = &drv->driver;
+				}
 			}
 			break;
 		}
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index d2900edc5..bfe81e236 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -396,8 +396,12 @@  rte_fslmc_probe(void)
 			   dev->device.devargs->policy ==
 			   RTE_DEV_WHITELISTED)) {
 				ret = drv->probe(drv, dev);
-				if (ret)
+				if (ret) {
 					DPAA2_BUS_ERR("Unable to probe");
+				} else {
+					dev->driver = drv;
+					dev->device.driver = &drv->driver;
+				}
 			}
 			break;
 		}