All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Use macro instead of plain text
@ 2015-12-18  8:52 Cao jin
  2015-12-18 12:52 ` Markus Armbruster
  0 siblings, 1 reply; 5+ messages in thread
From: Cao jin @ 2015-12-18  8:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, pbonzini, mst, ehabkost, rth

There is TYPE_ICH9_AHCI definition in ahci.h when QOMify it, seems it
is missed.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 hw/i386/pc_q35.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 9a12068..aa34a07 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -249,7 +249,7 @@ static void pc_q35_init(MachineState *machine)
     ahci = pci_create_simple_multifunction(host_bus,
                                            PCI_DEVFN(ICH9_SATA1_DEV,
                                                      ICH9_SATA1_FUNC),
-                                           true, "ich9-ahci");
+                                           true, TYPE_ICH9_AHCI);
     idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
     idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
     g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports);
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH v2] Use macro instead of plain text
  2015-12-18  8:52 [Qemu-devel] [PATCH v2] Use macro instead of plain text Cao jin
@ 2015-12-18 12:52 ` Markus Armbruster
  2015-12-18 13:01   ` Peter Maydell
  2015-12-20 10:09   ` Cao jin
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Armbruster @ 2015-12-18 12:52 UTC (permalink / raw)
  To: Cao jin; +Cc: ehabkost, mst, qemu-trivial, qemu-devel, pbonzini, rth

Cao jin <caoj.fnst@cn.fujitsu.com> writes:

> There is TYPE_ICH9_AHCI definition in ahci.h when QOMify it, seems it
> is missed.
>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  hw/i386/pc_q35.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 9a12068..aa34a07 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -249,7 +249,7 @@ static void pc_q35_init(MachineState *machine)
>      ahci = pci_create_simple_multifunction(host_bus,
>                                             PCI_DEVFN(ICH9_SATA1_DEV,
>                                                       ICH9_SATA1_FUNC),
> -                                           true, "ich9-ahci");
> +                                           true, TYPE_ICH9_AHCI);
>      idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
>      idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
>      g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports);

I suspect there are more instances of the same problem.

To find all similar macro definitions:

    $ git-grep -Eh '^ *# *define +TYPE_[A-Za-z0-9_]+ +"'

Extract the strings:

    $ git-grep -Eh '^ *# *define +TYPE_[A-Za-z0-9_]+ +"' | sed 's/^[^"]*\("[^"]*"\).*/\1/'

Search the source for them:

    $ for i in `git-grep -Eh '^ *# *define +TYPE_[A-Za-z0-9_]+ +"' | sed 's/^[^"]*\("[^"]*"\).*/\1/'`; do echo "= $i ="; git-grep -F "$i"; done

Results in more than 1000 hits for me.  Names like "device" are of
course very prone to false positives.

Not sure how interested we are in consistent use of these macros...

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

* Re: [Qemu-devel] [PATCH v2] Use macro instead of plain text
  2015-12-18 12:52 ` Markus Armbruster
@ 2015-12-18 13:01   ` Peter Maydell
  2015-12-20 10:16     ` Cao jin
  2015-12-20 10:09   ` Cao jin
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2015-12-18 13:01 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Eduardo Habkost, Michael S. Tsirkin, QEMU Trivial,
	QEMU Developers, Cao jin, Paolo Bonzini, Richard Henderson

On 18 December 2015 at 12:52, Markus Armbruster <armbru@redhat.com> wrote:
> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
>
>> There is TYPE_ICH9_AHCI definition in ahci.h when QOMify it, seems it
>> is missed.

> I suspect there are more instances of the same problem.

> Not sure how interested we are in consistent use of these macros...

In a lot of cases we'd need to find somewhere appropriate to put the
TYPE_* macro which might well mean creating a new header file just
for the purpose. That seems like overkill...

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH v2] Use macro instead of plain text
  2015-12-18 12:52 ` Markus Armbruster
  2015-12-18 13:01   ` Peter Maydell
@ 2015-12-20 10:09   ` Cao jin
  1 sibling, 0 replies; 5+ messages in thread
From: Cao jin @ 2015-12-20 10:09 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: ehabkost, mst, qemu-trivial, qemu-devel, pbonzini, rth



On 12/18/2015 08:52 PM, Markus Armbruster wrote:
> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
>
>> There is TYPE_ICH9_AHCI definition in ahci.h when QOMify it, seems it
>> is missed.
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   hw/i386/pc_q35.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
>> index 9a12068..aa34a07 100644
>> --- a/hw/i386/pc_q35.c
>> +++ b/hw/i386/pc_q35.c
>> @@ -249,7 +249,7 @@ static void pc_q35_init(MachineState *machine)
>>       ahci = pci_create_simple_multifunction(host_bus,
>>                                              PCI_DEVFN(ICH9_SATA1_DEV,
>>                                                        ICH9_SATA1_FUNC),
>> -                                           true, "ich9-ahci");
>> +                                           true, TYPE_ICH9_AHCI);
>>       idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
>>       idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
>>       g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports);
>
> I suspect there are more instances of the same problem.
>
> To find all similar macro definitions:
>
>      $ git-grep -Eh '^ *# *define +TYPE_[A-Za-z0-9_]+ +"'
>
> Extract the strings:
>
>      $ git-grep -Eh '^ *# *define +TYPE_[A-Za-z0-9_]+ +"' | sed 's/^[^"]*\("[^"]*"\).*/\1/'
>
> Search the source for them:
>
>      $ for i in `git-grep -Eh '^ *# *define +TYPE_[A-Za-z0-9_]+ +"' | sed 's/^[^"]*\("[^"]*"\).*/\1/'`; do echo "= $i ="; git-grep -F "$i"; done
>
> Results in more than 1000 hits for me.  Names like "device" are of
> course very prone to false positives.
>

Yes, often seeing "plain text" style when browsing code, and after 
seeing PMM`s explanation, I finally see why there are lots of these...

> Not sure how interested we are in consistent use of these macros...
>

I didn`t pay any attention to this before. It comes to me when I make 
the V2 "msi/msix" patch. as I said in that cover-letter: special case:)

we can forget this patch now.

>
> .
>

-- 
Yours Sincerely,

Cao Jin

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

* Re: [Qemu-devel] [PATCH v2] Use macro instead of plain text
  2015-12-18 13:01   ` Peter Maydell
@ 2015-12-20 10:16     ` Cao jin
  0 siblings, 0 replies; 5+ messages in thread
From: Cao jin @ 2015-12-20 10:16 UTC (permalink / raw)
  To: Peter Maydell, Markus Armbruster
  Cc: Eduardo Habkost, Michael S. Tsirkin, QEMU Trivial,
	QEMU Developers, Paolo Bonzini, Richard Henderson

Hi Peter,

Thanks for the explanation, it make me aware that why there are lots of 
"plain_text_for_device":)

forget it please.

On 12/18/2015 09:01 PM, Peter Maydell wrote:
> On 18 December 2015 at 12:52, Markus Armbruster <armbru@redhat.com> wrote:
>> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
>>
>>> There is TYPE_ICH9_AHCI definition in ahci.h when QOMify it, seems it
>>> is missed.
>
>> I suspect there are more instances of the same problem.
>
>> Not sure how interested we are in consistent use of these macros...
>
> In a lot of cases we'd need to find somewhere appropriate to put the
> TYPE_* macro which might well mean creating a new header file just
> for the purpose. That seems like overkill...
>
> thanks
> -- PMM
>
>
>

-- 
Yours Sincerely,

Cao Jin

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

end of thread, other threads:[~2015-12-20 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18  8:52 [Qemu-devel] [PATCH v2] Use macro instead of plain text Cao jin
2015-12-18 12:52 ` Markus Armbruster
2015-12-18 13:01   ` Peter Maydell
2015-12-20 10:16     ` Cao jin
2015-12-20 10:09   ` Cao jin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.