public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* DXE core - Connecting a controller to driver
@ 2017-06-26 16:30 TVKR
  2017-06-27 13:52 ` TVKR
  2017-06-27 14:07 ` Andrew Fish
  0 siblings, 2 replies; 4+ messages in thread
From: TVKR @ 2017-06-26 16:30 UTC (permalink / raw)
  To: edk2-devel

Hi experts,

I have  a question related to the ConnectController implementation in the
edk2 codebase (MdeModulePkg\Core\Dxe\Hand\DriverSupport.c). Under the
CoreConnectSingleController function, what if DriverBinding->Supported
returns an error? I see that there is a do/while loop waiting for
DriverFound to be set to TRUE, but it looks like this wont happen if
DriverBinding->Supported returns an error (looping for ever). Am I reading
this wrong?

Thanks


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DXE core - Connecting a controller to driver
  2017-06-26 16:30 DXE core - Connecting a controller to driver TVKR
@ 2017-06-27 13:52 ` TVKR
  2017-06-27 14:07 ` Andrew Fish
  1 sibling, 0 replies; 4+ messages in thread
From: TVKR @ 2017-06-27 13:52 UTC (permalink / raw)
  To: edk2-devel

Hello experts!!

Any thoughts on this?

Thanks

On Mon, Jun 26, 2017 at 11:30 AM, TVKR <tresko1@gmail.com> wrote:

> Hi experts,
>
> I have  a question related to the ConnectController implementation in the
> edk2 codebase (MdeModulePkg\Core\Dxe\Hand\DriverSupport.c). Under the
> CoreConnectSingleController function, what if DriverBinding->Supported
> returns an error? I see that there is a do/while loop waiting for
> DriverFound to be set to TRUE, but it looks like this wont happen if
> DriverBinding->Supported returns an error (looping for ever). Am I reading
> this wrong?
>
> Thanks
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DXE core - Connecting a controller to driver
  2017-06-26 16:30 DXE core - Connecting a controller to driver TVKR
  2017-06-27 13:52 ` TVKR
@ 2017-06-27 14:07 ` Andrew Fish
  2017-06-27 22:44   ` TVKR
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Fish @ 2017-06-27 14:07 UTC (permalink / raw)
  To: TVKR; +Cc: edk2-devel


> On Jun 26, 2017, at 9:30 AM, TVKR <tresko1@gmail.com> wrote:
> 
> Hi experts,
> 
> I have  a question related to the ConnectController implementation in the
> edk2 codebase (MdeModulePkg\Core\Dxe\Hand\DriverSupport.c). Under the
> CoreConnectSingleController function, what if DriverBinding->Supported
> returns an error? I see that there is a do/while loop waiting for
> DriverFound to be set to TRUE, but it looks like this wont happen if
> DriverBinding->Supported returns an error (looping for ever). Am I reading
> this wrong?
> 

How do you think a do while loop works in C?

DriverFound = FALSE;
do {
 ;
} while (DriverFound);

Is not an infinite loop? It just runs one time. 

The code is looping as long as Start() is called as calling Start() could cause other drivers Supported() to start returning TRUE, so you have to recheck the set after calling Start(). 

Thanks,

Andrew Fish

> Thanks
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DXE core - Connecting a controller to driver
  2017-06-27 14:07 ` Andrew Fish
@ 2017-06-27 22:44   ` TVKR
  0 siblings, 0 replies; 4+ messages in thread
From: TVKR @ 2017-06-27 22:44 UTC (permalink / raw)
  To: Andrew Fish; +Cc: edk2-devel

Thanks for the reply Andrew. I misread the code and mixed up the for loop
inside the do/while and got confused there for a moment (having one of
those brain fade moments :().

Regards

On Tue, Jun 27, 2017 at 9:07 AM, Andrew Fish <afish@apple.com> wrote:

>
> > On Jun 26, 2017, at 9:30 AM, TVKR <tresko1@gmail.com> wrote:
> >
> > Hi experts,
> >
> > I have  a question related to the ConnectController implementation in the
> > edk2 codebase (MdeModulePkg\Core\Dxe\Hand\DriverSupport.c). Under the
> > CoreConnectSingleController function, what if DriverBinding->Supported
> > returns an error? I see that there is a do/while loop waiting for
> > DriverFound to be set to TRUE, but it looks like this wont happen if
> > DriverBinding->Supported returns an error (looping for ever). Am I
> reading
> > this wrong?
> >
>
> How do you think a do while loop works in C?
>
> DriverFound = FALSE;
> do {
>  ;
> } while (DriverFound);
>
> Is not an infinite loop? It just runs one time.
>
> The code is looping as long as Start() is called as calling Start() could
> cause other drivers Supported() to start returning TRUE, so you have to
> recheck the set after calling Start().
>
> Thanks,
>
> Andrew Fish
>
> > Thanks
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-27 22:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-26 16:30 DXE core - Connecting a controller to driver TVKR
2017-06-27 13:52 ` TVKR
2017-06-27 14:07 ` Andrew Fish
2017-06-27 22:44   ` TVKR

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox