* [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x @ 2019-01-27 10:18 kumar sourav 2019-01-28 8:37 ` Thomas Huth 0 siblings, 1 reply; 4+ messages in thread From: kumar sourav @ 2019-01-27 10:18 UTC (permalink / raw) To: qemu-trivial; +Cc: balrogg, peter.maydell, qemu-devel, qemu-arm Sets the category of lm832x as DEVICE_CATEGORY_INPUT Devices should be assigned to one of DEVICE_CATEGORY_XXXX Signed-off-by: kumar sourav <sourav.jb1988@gmail.com> --- hw/input/lm832x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c index cffbf586d4..07ae5e0aee 100644 --- a/hw/input/lm832x.c +++ b/hw/input/lm832x.c @@ -509,6 +509,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data) k->recv = lm_i2c_rx; k->send = lm_i2c_tx; dc->vmsd = &vmstate_lm_kbd; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo lm8323_info = { -- 2.17.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x 2019-01-27 10:18 [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x kumar sourav @ 2019-01-28 8:37 ` Thomas Huth 2019-01-28 11:10 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 4+ messages in thread From: Thomas Huth @ 2019-01-28 8:37 UTC (permalink / raw) To: kumar sourav, qemu-trivial; +Cc: peter.maydell, qemu-arm, qemu-devel Hi, On 2019-01-27 11:18, kumar sourav wrote: > Sets the category of lm832x as DEVICE_CATEGORY_INPUT > Devices should be assigned to one of DEVICE_CATEGORY_XXXX > > Signed-off-by: kumar sourav <sourav.jb1988@gmail.com> > --- > hw/input/lm832x.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c > index cffbf586d4..07ae5e0aee 100644 > --- a/hw/input/lm832x.c > +++ b/hw/input/lm832x.c > @@ -509,6 +509,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data) > k->recv = lm_i2c_rx; > k->send = lm_i2c_tx; > dc->vmsd = &vmstate_lm_kbd; > + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); > } This device already has DEVICE_CATEGORY_MISC set since it is derived from TYPE_I2C_SLAVE. If you now set another category bit here, the device shows up twice in the output of "-device help". That's not so nice. I see multiple options here: 1) Drop this patch since the device already has a category 2) Make sure to clear_bit() the MISC category here again 3) Remove the set_bit(DEVICE_CATEGORY_MISC, k->categories) in hw/i2c/core.c - it does not make that much sense to set the MISC category for an abstract parent class. 4) Introduce a new DEVICE_CATEGORY_I2C which could be used instead of the DEVICE_CATEGORY_MISC in hw/i2c/core.c One of the last two options sound most appealing to me. Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x 2019-01-28 8:37 ` Thomas Huth @ 2019-01-28 11:10 ` Philippe Mathieu-Daudé 2019-02-06 11:00 ` Thomas Huth 0 siblings, 1 reply; 4+ messages in thread From: Philippe Mathieu-Daudé @ 2019-01-28 11:10 UTC (permalink / raw) To: Thomas Huth, kumar sourav, qemu-trivial Cc: peter.maydell, qemu-arm, qemu-devel Hi Thomas, On 1/28/19 9:37 AM, Thomas Huth wrote: > Hi, > > On 2019-01-27 11:18, kumar sourav wrote: >> Sets the category of lm832x as DEVICE_CATEGORY_INPUT >> Devices should be assigned to one of DEVICE_CATEGORY_XXXX >> >> Signed-off-by: kumar sourav <sourav.jb1988@gmail.com> >> --- >> hw/input/lm832x.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c >> index cffbf586d4..07ae5e0aee 100644 >> --- a/hw/input/lm832x.c >> +++ b/hw/input/lm832x.c >> @@ -509,6 +509,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data) >> k->recv = lm_i2c_rx; >> k->send = lm_i2c_tx; >> dc->vmsd = &vmstate_lm_kbd; >> + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); >> } > > This device already has DEVICE_CATEGORY_MISC set since it is derived > from TYPE_I2C_SLAVE. If you now set another category bit here, the > device shows up twice in the output of "-device help". That's not so nice. > > I see multiple options here: > > 1) Drop this patch since the device already has a category > > 2) Make sure to clear_bit() the MISC category here again > > 3) Remove the set_bit(DEVICE_CATEGORY_MISC, k->categories) in > hw/i2c/core.c - it does not make that much sense to set the > MISC category for an abstract parent class. > > 4) Introduce a new DEVICE_CATEGORY_I2C which could be used > instead of the DEVICE_CATEGORY_MISC in hw/i2c/core.c > > One of the last two options sound most appealing to me. Can we go with 0/3/4 together? 0 being this patch: 0) This devices inherited DEVICE_CATEGORY_I2C from his abstract parent, also select the DEVICE_CATEGORY_INPUT bit. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x 2019-01-28 11:10 ` Philippe Mathieu-Daudé @ 2019-02-06 11:00 ` Thomas Huth 0 siblings, 0 replies; 4+ messages in thread From: Thomas Huth @ 2019-02-06 11:00 UTC (permalink / raw) To: Philippe Mathieu-Daudé, kumar sourav, qemu-trivial Cc: peter.maydell, qemu-arm, qemu-devel, Marcel Apfelbaum On 2019-01-28 12:10, Philippe Mathieu-Daudé wrote: > Hi Thomas, > > On 1/28/19 9:37 AM, Thomas Huth wrote: >> Hi, >> >> On 2019-01-27 11:18, kumar sourav wrote: >>> Sets the category of lm832x as DEVICE_CATEGORY_INPUT >>> Devices should be assigned to one of DEVICE_CATEGORY_XXXX >>> >>> Signed-off-by: kumar sourav <sourav.jb1988@gmail.com> >>> --- >>> hw/input/lm832x.c | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c >>> index cffbf586d4..07ae5e0aee 100644 >>> --- a/hw/input/lm832x.c >>> +++ b/hw/input/lm832x.c >>> @@ -509,6 +509,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data) >>> k->recv = lm_i2c_rx; >>> k->send = lm_i2c_tx; >>> dc->vmsd = &vmstate_lm_kbd; >>> + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); >>> } >> >> This device already has DEVICE_CATEGORY_MISC set since it is derived >> from TYPE_I2C_SLAVE. If you now set another category bit here, the >> device shows up twice in the output of "-device help". That's not so nice. >> >> I see multiple options here: >> >> 1) Drop this patch since the device already has a category >> >> 2) Make sure to clear_bit() the MISC category here again >> >> 3) Remove the set_bit(DEVICE_CATEGORY_MISC, k->categories) in >> hw/i2c/core.c - it does not make that much sense to set the >> MISC category for an abstract parent class. >> >> 4) Introduce a new DEVICE_CATEGORY_I2C which could be used >> instead of the DEVICE_CATEGORY_MISC in hw/i2c/core.c >> >> One of the last two options sound most appealing to me. > > Can we go with 0/3/4 together? 0 being this patch: > > 0) This devices inherited DEVICE_CATEGORY_I2C from his > abstract parent, also select the DEVICE_CATEGORY_INPUT > bit. Yes, I guess... Thinking about this again ... dc->categories is a bitfield, so there is or at least was the original intention that a device can go into multiple categories. Question: Is this what we want, and if yes, is everybody fine with the fact that a device shows up multiple times in the output of "-device help" ? If not, shall we change the bitfield into a normal enum value? Anyway, a DEVICE_CATEGORY_I2C is likely a good idea, at least it's better than MISC here (and we already have DEVICE_CATOGORY_USB, too). Anybody want to send a patch? Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-06 11:01 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-01-27 10:18 [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x kumar sourav 2019-01-28 8:37 ` Thomas Huth 2019-01-28 11:10 ` Philippe Mathieu-Daudé 2019-02-06 11:00 ` Thomas Huth
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).