diff mbox series

usb-host: Do not override USB node name

Message ID 20190903032912.54251-1-aik@ozlabs.ru
State Accepted
Headers show
Series usb-host: Do not override USB node name | expand

Commit Message

Alexey Kardashevskiy Sept. 3, 2019, 3:29 a.m. UTC
QEMU creates nodes for PCI devices and preserves the node names with
one exception for USB hosts; this fixes it.

Fixes: be9b2fa44c73 ("pci: Use QEMU created PCI device nodes")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

David, this is how we loose QEMU's "usb-xhci@" nodename.
I am very curious now how it ever worked without an 's' in front
of " usb".


---
 slof/fs/usb/dev-hci.fs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth Sept. 4, 2019, 7:04 a.m. UTC | #1
On 03/09/2019 05.29, Alexey Kardashevskiy wrote:
> QEMU creates nodes for PCI devices and preserves the node names with
> one exception for USB hosts; this fixes it.
> 
> Fixes: be9b2fa44c73 ("pci: Use QEMU created PCI device nodes")
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> 
> David, this is how we loose QEMU's "usb-xhci@" nodename.
> I am very curious now how it ever worked without an 's' in front
> of " usb".

" usb" is pretty much the same as s" usb" ... the only difference
between '"' and 's"' is that you can encode characters via hex numbers
in the string, e.g. try:

" hello "(61) world" type

See OF1275 page 102 for details.

> ---
>  slof/fs/usb/dev-hci.fs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/slof/fs/usb/dev-hci.fs b/slof/fs/usb/dev-hci.fs
> index 5fb25b8b6b4e..685280ce3de0 100644
> --- a/slof/fs/usb/dev-hci.fs
> +++ b/slof/fs/usb/dev-hci.fs
> @@ -20,7 +20,7 @@ VALUE usb_type \ USB type
>  
>  \ Open Firmware Properties
>  device-type
> -" usb" 2dup device-name
> +s" usb"
>  
>  rot
>  VALUE usb_num                           \ controller number
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>
Alexey Kardashevskiy Sept. 4, 2019, 7:17 a.m. UTC | #2
On 04/09/2019 17:04, Thomas Huth wrote:
> On 03/09/2019 05.29, Alexey Kardashevskiy wrote:
>> QEMU creates nodes for PCI devices and preserves the node names with
>> one exception for USB hosts; this fixes it.
>>
>> Fixes: be9b2fa44c73 ("pci: Use QEMU created PCI device nodes")
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>
>> David, this is how we loose QEMU's "usb-xhci@" nodename.
>> I am very curious now how it ever worked without an 's' in front
>> of " usb".
> 
> " usb" is pretty much the same as s" usb" ... the only difference
> between '"' and 's"' is that you can encode characters via hex numbers
> in the string, e.g. try:
> 
> " hello "(61) world" type
> 
> See OF1275 page 102 for details.


yeah found this much later, I always used s" and was so surprised :)

> 
>> ---
>>   slof/fs/usb/dev-hci.fs | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/slof/fs/usb/dev-hci.fs b/slof/fs/usb/dev-hci.fs
>> index 5fb25b8b6b4e..685280ce3de0 100644
>> --- a/slof/fs/usb/dev-hci.fs
>> +++ b/slof/fs/usb/dev-hci.fs
>> @@ -20,7 +20,7 @@ VALUE usb_type \ USB type
>>   
>>   \ Open Firmware Properties
>>   device-type
>> -" usb" 2dup device-name
>> +s" usb"
>>   
>>   rot
>>   VALUE usb_num                           \ controller number
>>
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>


Thanks!
Segher Boessenkool Sept. 4, 2019, 12:49 p.m. UTC | #3
On Wed, Sep 04, 2019 at 09:04:33AM +0200, Thomas Huth wrote:
> On 03/09/2019 05.29, Alexey Kardashevskiy wrote:
> > QEMU creates nodes for PCI devices and preserves the node names with
> > one exception for USB hosts; this fixes it.
> > 
> > Fixes: be9b2fa44c73 ("pci: Use QEMU created PCI device nodes")
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > ---
> > 
> > David, this is how we loose QEMU's "usb-xhci@" nodename.
> > I am very curious now how it ever worked without an 's' in front
> > of " usb".
> 
> " usb" is pretty much the same as s" usb" ... the only difference
> between '"' and 's"' is that you can encode characters via hex numbers
> in the string, e.g. try:
> 
> " hello "(61) world" type
> 
> See OF1275 page 102 for details.

s"  is a standard Forth word, and  "  is not.  Paflof (the core engine
of SLOF) aims to be a standard Forth system, so it implements  s"  ,
but it did not implement  "  .  It turns out that

: hw ( - str . )  s" hello" s" " $cat s" world" $cat ;

is quite a bit nicer to read than

: hw ( - str . )  " hello" " " $cat " world" $cat ;

It is also faster, and in the earlier days of SLOF it was the only
thing that *existed*, so the convention stuck.


Segher
diff mbox series

Patch

diff --git a/slof/fs/usb/dev-hci.fs b/slof/fs/usb/dev-hci.fs
index 5fb25b8b6b4e..685280ce3de0 100644
--- a/slof/fs/usb/dev-hci.fs
+++ b/slof/fs/usb/dev-hci.fs
@@ -20,7 +20,7 @@  VALUE usb_type \ USB type
 
 \ Open Firmware Properties
 device-type
-" usb" 2dup device-name
+s" usb"
 
 rot
 VALUE usb_num                           \ controller number