diff mbox

Fix inconsistency between comment and variable name

Message ID 1454469583-15753-1-git-send-email-caoj.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Cao jin Feb. 3, 2016, 3:19 a.m. UTC
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 include/hw/qdev-core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Tokarev Feb. 3, 2016, 7:13 a.m. UTC | #1
03.02.2016 06:19, Cao jin wrote:
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  include/hw/qdev-core.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index abcdee8..42fa5db 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -221,7 +221,7 @@ typedef struct BusChild {
>  
>  /**
>   * BusState:
> - * @hotplug_device: link to a hotplug device associated with bus.
> + * @hotplug_handler: link to a hotplug device associated with bus.

Hmm.  Now while the field name in comment and in the structure
do match, the comment is still wrong, since it is a linke to
a handler, not a device… :)

Thanks,

/mjt
Markus Armbruster Feb. 3, 2016, 9:35 a.m. UTC | #2
Michael Tokarev <mjt@tls.msk.ru> writes:

> 03.02.2016 06:19, Cao jin wrote:
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>  include/hw/qdev-core.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>> index abcdee8..42fa5db 100644
>> --- a/include/hw/qdev-core.h
>> +++ b/include/hw/qdev-core.h
>> @@ -221,7 +221,7 @@ typedef struct BusChild {
>>  
>>  /**
>>   * BusState:
>> - * @hotplug_device: link to a hotplug device associated with bus.
>> + * @hotplug_handler: link to a hotplug device associated with bus.
>
> Hmm.  Now while the field name in comment and in the structure
> do match, the comment is still wrong, since it is a linke to
> a handler, not a device… :)

Do you mean to suggest the line should be changed to

 * @hotplug_device: link to a hotplug handler associated with bus.

?
Cao jin Feb. 3, 2016, 10:51 a.m. UTC | #3
On 02/03/2016 05:35 PM, Markus Armbruster wrote:
> Michael Tokarev <mjt@tls.msk.ru> writes:
>
>> 03.02.2016 06:19, Cao jin wrote:
>>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>>> ---
>>>   include/hw/qdev-core.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>>> index abcdee8..42fa5db 100644
>>> --- a/include/hw/qdev-core.h
>>> +++ b/include/hw/qdev-core.h
>>> @@ -221,7 +221,7 @@ typedef struct BusChild {
>>>
>>>   /**
>>>    * BusState:
>>> - * @hotplug_device: link to a hotplug device associated with bus.
>>> + * @hotplug_handler: link to a hotplug device associated with bus.
>>
>> Hmm.  Now while the field name in comment and in the structure
>> do match, the comment is still wrong, since it is a linke to
>> a handler, not a device… :)
>
> Do you mean to suggest the line should be changed to
>
>   * @hotplug_device: link to a hotplug handler associated with bus.
>
> ?
>

If I understand it right, hotplug_handler is a link property of 
BusState, see qbus_initfn(). Tt actually points to a device, see 
qbus_set_hotplug_handler(), and the actually hotplug handler is reside 
in this device, see how qdev_get_hotplug_handler() is used.

So, base on the talking above, the original comment could be understood 
by me:)
Cao jin Feb. 3, 2016, 12:02 p.m. UTC | #4
On 02/03/2016 05:35 PM, Markus Armbruster wrote:
> Michael Tokarev <mjt@tls.msk.ru> writes:
>
>> 03.02.2016 06:19, Cao jin wrote:
>>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>>> ---
>>>   include/hw/qdev-core.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>>> index abcdee8..42fa5db 100644
>>> --- a/include/hw/qdev-core.h
>>> +++ b/include/hw/qdev-core.h
>>> @@ -221,7 +221,7 @@ typedef struct BusChild {
>>>
>>>   /**
>>>    * BusState:
>>> - * @hotplug_device: link to a hotplug device associated with bus.
>>> + * @hotplug_handler: link to a hotplug device associated with bus.
>>
>> Hmm.  Now while the field name in comment and in the structure
>> do match, the comment is still wrong, since it is a linke to
>> a handler, not a device… :)
>
> Do you mean to suggest the line should be changed to
>
>   * @hotplug_device: link to a hotplug handler associated with bus.
>
> ?
>
>

And sometimes a hotplug handler could be a bus, see 
qbus_set_bus_hotplug_handler(). on both case(device & bus), the actual 
hotplug handler called at last is a TYPE_HOTPLUG_HANDLER which reside in 
that device/bus, so I guess, the @hotplug_handler maybe fine:)

anyway, these terms could easily confuse newbies
diff mbox

Patch

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index abcdee8..42fa5db 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -221,7 +221,7 @@  typedef struct BusChild {
 
 /**
  * BusState:
- * @hotplug_device: link to a hotplug device associated with bus.
+ * @hotplug_handler: link to a hotplug device associated with bus.
  */
 struct BusState {
     Object obj;