All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/usb: Introduce Kconfig switches for the CCID card devices
@ 2019-12-10  7:20 Thomas Huth
  2019-12-10  7:43 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2019-12-10  7:20 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: Markus Armbruster

In our downstream distribution of QEMU, we need more fine-grained
control on the set of CCID card devices that we want to include.
So let's introduce some proper Kconfig switches that it is easier
to disable them without modifying the corresponding Makefile.objs.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/usb/Kconfig       | 10 ++++++++++
 hw/usb/Makefile.objs |  7 +++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
index 555e09377b..1358847eba 100644
--- a/hw/usb/Kconfig
+++ b/hw/usb/Kconfig
@@ -96,3 +96,13 @@ config USB_STORAGE_MTP
     bool
     default y
     depends on USB
+
+config CCID_PASSTHRU
+    bool
+    default y
+    depends on USB_SMARTCARD
+
+config CCID_EMULATED
+    bool
+    default y
+    depends on USB_SMARTCARD
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
index 303ac084a0..ebe103fb3d 100644
--- a/hw/usb/Makefile.objs
+++ b/hw/usb/Makefile.objs
@@ -29,11 +29,14 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
 
 ifeq ($(CONFIG_USB_SMARTCARD),y)
 common-obj-y                          += dev-smartcard-reader.o
-common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
-smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
+ifeq ($(CONFIG_SMARTCARD),y)
+common-obj-$(call lor,$(CONFIG_CCID_PASSTHRU),$(CONFIG_CCID_EMULATED)) += smartcard.mo
+smartcard.mo-objs := $(call lif,$(CONFIG_CCID_PASSTHRU),ccid-card-passthru.o) \
+                     $(call lif,$(CONFIG_CCID_EMULATED),ccid-card-emulated.o)
 smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
 smartcard.mo-libs := $(SMARTCARD_LIBS)
 endif
+endif
 
 ifeq ($(CONFIG_POSIX),y)
 common-obj-$(CONFIG_USB_STORAGE_MTP)  += dev-mtp.o
-- 
2.18.1



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

* Re: [PATCH] hw/usb: Introduce Kconfig switches for the CCID card devices
  2019-12-10  7:20 [PATCH] hw/usb: Introduce Kconfig switches for the CCID card devices Thomas Huth
@ 2019-12-10  7:43 ` Philippe Mathieu-Daudé
  2019-12-10  8:11   ` Thomas Huth
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-10  7:43 UTC (permalink / raw)
  To: Thomas Huth, Gerd Hoffmann, qemu-devel; +Cc: Markus Armbruster

On 12/10/19 8:20 AM, Thomas Huth wrote:
> In our downstream distribution of QEMU, we need more fine-grained
> control on the set of CCID card devices that we want to include.
> So let's introduce some proper Kconfig switches that it is easier
> to disable them without modifying the corresponding Makefile.objs.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/usb/Kconfig       | 10 ++++++++++
>   hw/usb/Makefile.objs |  7 +++++--
>   2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
> index 555e09377b..1358847eba 100644
> --- a/hw/usb/Kconfig
> +++ b/hw/usb/Kconfig
> @@ -96,3 +96,13 @@ config USB_STORAGE_MTP
>       bool
>       default y
>       depends on USB
> +
> +config CCID_PASSTHRU
> +    bool
> +    default y
> +    depends on USB_SMARTCARD
> +
> +config CCID_EMULATED
> +    bool
> +    default y
> +    depends on USB_SMARTCARD
> diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
> index 303ac084a0..ebe103fb3d 100644
> --- a/hw/usb/Makefile.objs
> +++ b/hw/usb/Makefile.objs
> @@ -29,11 +29,14 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
>   
>   ifeq ($(CONFIG_USB_SMARTCARD),y)
>   common-obj-y                          += dev-smartcard-reader.o
> -common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
> -smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
> +ifeq ($(CONFIG_SMARTCARD),y)

We don't need the 'ifeq ($(CONFIG_SMARTCARD),y)' ... endif anymore.

> +common-obj-$(call lor,$(CONFIG_CCID_PASSTHRU),$(CONFIG_CCID_EMULATED)) += smartcard.mo
> +smartcard.mo-objs := $(call lif,$(CONFIG_CCID_PASSTHRU),ccid-card-passthru.o) \
> +                     $(call lif,$(CONFIG_CCID_EMULATED),ccid-card-emulated.o)
>   smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
>   smartcard.mo-libs := $(SMARTCARD_LIBS)
>   endif
> +endif
>   
>   ifeq ($(CONFIG_POSIX),y)
>   common-obj-$(CONFIG_USB_STORAGE_MTP)  += dev-mtp.o
> 



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

* Re: [PATCH] hw/usb: Introduce Kconfig switches for the CCID card devices
  2019-12-10  7:43 ` Philippe Mathieu-Daudé
@ 2019-12-10  8:11   ` Thomas Huth
  2019-12-10 13:27     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2019-12-10  8:11 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Gerd Hoffmann, qemu-devel; +Cc: Markus Armbruster

On 10/12/2019 08.43, Philippe Mathieu-Daudé wrote:
> On 12/10/19 8:20 AM, Thomas Huth wrote:
>> In our downstream distribution of QEMU, we need more fine-grained
>> control on the set of CCID card devices that we want to include.
>> So let's introduce some proper Kconfig switches that it is easier
>> to disable them without modifying the corresponding Makefile.objs.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   hw/usb/Kconfig       | 10 ++++++++++
>>   hw/usb/Makefile.objs |  7 +++++--
>>   2 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
>> index 555e09377b..1358847eba 100644
>> --- a/hw/usb/Kconfig
>> +++ b/hw/usb/Kconfig
>> @@ -96,3 +96,13 @@ config USB_STORAGE_MTP
>>       bool
>>       default y
>>       depends on USB
>> +
>> +config CCID_PASSTHRU
>> +    bool
>> +    default y
>> +    depends on USB_SMARTCARD
>> +
>> +config CCID_EMULATED
>> +    bool
>> +    default y
>> +    depends on USB_SMARTCARD
>> diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
>> index 303ac084a0..ebe103fb3d 100644
>> --- a/hw/usb/Makefile.objs
>> +++ b/hw/usb/Makefile.objs
>> @@ -29,11 +29,14 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    +=
>> dev-bluetooth.o
>>     ifeq ($(CONFIG_USB_SMARTCARD),y)
>>   common-obj-y                          += dev-smartcard-reader.o
>> -common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
>> -smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
>> +ifeq ($(CONFIG_SMARTCARD),y)
> 
> We don't need the 'ifeq ($(CONFIG_SMARTCARD),y)' ... endif anymore.

I think we do. Both files #include <libcacard.h> thus can only be
compiled if CONFIG_SMARTCARD has been set.
Don't mix CONFIG_SMARTCARD up with CONFIG_USB_SMARTCARD - these are two
different switches!

 Thomas


>> +common-obj-$(call
>> lor,$(CONFIG_CCID_PASSTHRU),$(CONFIG_CCID_EMULATED)) += smartcard.mo
>> +smartcard.mo-objs := $(call
>> lif,$(CONFIG_CCID_PASSTHRU),ccid-card-passthru.o) \
>> +                     $(call
>> lif,$(CONFIG_CCID_EMULATED),ccid-card-emulated.o)
>>   smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
>>   smartcard.mo-libs := $(SMARTCARD_LIBS)
>>   endif
>> +endif
>>     ifeq ($(CONFIG_POSIX),y)
>>   common-obj-$(CONFIG_USB_STORAGE_MTP)  += dev-mtp.o
>>
> 



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

* Re: [PATCH] hw/usb: Introduce Kconfig switches for the CCID card devices
  2019-12-10  8:11   ` Thomas Huth
@ 2019-12-10 13:27     ` Philippe Mathieu-Daudé
  2019-12-10 13:32       ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-10 13:27 UTC (permalink / raw)
  To: Thomas Huth, Gerd Hoffmann, qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster

On 12/10/19 9:11 AM, Thomas Huth wrote:
> On 10/12/2019 08.43, Philippe Mathieu-Daudé wrote:
>> On 12/10/19 8:20 AM, Thomas Huth wrote:
>>> In our downstream distribution of QEMU, we need more fine-grained
>>> control on the set of CCID card devices that we want to include.
>>> So let's introduce some proper Kconfig switches that it is easier
>>> to disable them without modifying the corresponding Makefile.objs.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>    hw/usb/Kconfig       | 10 ++++++++++
>>>    hw/usb/Makefile.objs |  7 +++++--
>>>    2 files changed, 15 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
>>> index 555e09377b..1358847eba 100644
>>> --- a/hw/usb/Kconfig
>>> +++ b/hw/usb/Kconfig
>>> @@ -96,3 +96,13 @@ config USB_STORAGE_MTP
>>>        bool
>>>        default y
>>>        depends on USB
>>> +
>>> +config CCID_PASSTHRU
>>> +    bool
>>> +    default y
>>> +    depends on USB_SMARTCARD
>>> +
>>> +config CCID_EMULATED
>>> +    bool
>>> +    default y
>>> +    depends on USB_SMARTCARD
>>> diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
>>> index 303ac084a0..ebe103fb3d 100644
>>> --- a/hw/usb/Makefile.objs
>>> +++ b/hw/usb/Makefile.objs
>>> @@ -29,11 +29,14 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    +=
>>> dev-bluetooth.o
>>>      ifeq ($(CONFIG_USB_SMARTCARD),y)
>>>    common-obj-y                          += dev-smartcard-reader.o
>>> -common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
>>> -smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
>>> +ifeq ($(CONFIG_SMARTCARD),y)
>>
>> We don't need the 'ifeq ($(CONFIG_SMARTCARD),y)' ... endif anymore.
> 
> I think we do. Both files #include <libcacard.h> thus can only be
> compiled if CONFIG_SMARTCARD has been set.
> Don't mix CONFIG_SMARTCARD up with CONFIG_USB_SMARTCARD - these are two
> different switches!

OK I missed SMARTCARD is not in Kconfig.host.

What about adding that to your patch and remove the ifeq():

-- >8 --
diff --git a/Kconfig.host b/Kconfig.host
index bb6e116e2a..b532358854 100644
--- a/Kconfig.host
+++ b/Kconfig.host
@@ -35,3 +35,6 @@ config VIRTFS

  config PVRDMA
      bool
+
+config SMARTCARD
+    bool
diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
index 555e09377b..b3292a5cc9 100644
--- a/hw/usb/Kconfig
+++ b/hw/usb/Kconfig
@@ -90,7 +90,7 @@ config USB_BLUETOOTH
  config USB_SMARTCARD
      bool
      default y
-    depends on USB
+    depends on SMARTCARD && USB

  config USB_STORAGE_MTP
      bool
---

>>> +common-obj-$(call
>>> lor,$(CONFIG_CCID_PASSTHRU),$(CONFIG_CCID_EMULATED)) += smartcard.mo
>>> +smartcard.mo-objs := $(call
>>> lif,$(CONFIG_CCID_PASSTHRU),ccid-card-passthru.o) \
>>> +                     $(call
>>> lif,$(CONFIG_CCID_EMULATED),ccid-card-emulated.o)
>>>    smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
>>>    smartcard.mo-libs := $(SMARTCARD_LIBS)
>>>    endif
>>> +endif
>>>      ifeq ($(CONFIG_POSIX),y)
>>>    common-obj-$(CONFIG_USB_STORAGE_MTP)  += dev-mtp.o
>>>
>>
> 



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

* Re: [PATCH] hw/usb: Introduce Kconfig switches for the CCID card devices
  2019-12-10 13:27     ` Philippe Mathieu-Daudé
@ 2019-12-10 13:32       ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2019-12-10 13:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Thomas Huth, Gerd Hoffmann, qemu-devel
  Cc: Markus Armbruster

On 10/12/19 14:27, Philippe Mathieu-Daudé wrote:
> On 12/10/19 9:11 AM, Thomas Huth wrote:
>> On 10/12/2019 08.43, Philippe Mathieu-Daudé wrote:
>>> On 12/10/19 8:20 AM, Thomas Huth wrote:
>>>> In our downstream distribution of QEMU, we need more fine-grained
>>>> control on the set of CCID card devices that we want to include.
>>>> So let's introduce some proper Kconfig switches that it is easier
>>>> to disable them without modifying the corresponding Makefile.objs.
>>>>
>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>> ---
>>>>    hw/usb/Kconfig       | 10 ++++++++++
>>>>    hw/usb/Makefile.objs |  7 +++++--
>>>>    2 files changed, 15 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
>>>> index 555e09377b..1358847eba 100644
>>>> --- a/hw/usb/Kconfig
>>>> +++ b/hw/usb/Kconfig
>>>> @@ -96,3 +96,13 @@ config USB_STORAGE_MTP
>>>>        bool
>>>>        default y
>>>>        depends on USB
>>>> +
>>>> +config CCID_PASSTHRU
>>>> +    bool
>>>> +    default y
>>>> +    depends on USB_SMARTCARD
>>>> +
>>>> +config CCID_EMULATED
>>>> +    bool
>>>> +    default y
>>>> +    depends on USB_SMARTCARD
>>>> diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
>>>> index 303ac084a0..ebe103fb3d 100644
>>>> --- a/hw/usb/Makefile.objs
>>>> +++ b/hw/usb/Makefile.objs
>>>> @@ -29,11 +29,14 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    +=
>>>> dev-bluetooth.o
>>>>      ifeq ($(CONFIG_USB_SMARTCARD),y)
>>>>    common-obj-y                          += dev-smartcard-reader.o
>>>> -common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
>>>> -smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
>>>> +ifeq ($(CONFIG_SMARTCARD),y)
>>>
>>> We don't need the 'ifeq ($(CONFIG_SMARTCARD),y)' ... endif anymore.
>>
>> I think we do. Both files #include <libcacard.h> thus can only be
>> compiled if CONFIG_SMARTCARD has been set.
>> Don't mix CONFIG_SMARTCARD up with CONFIG_USB_SMARTCARD - these are two
>> different switches!
> 
> OK I missed SMARTCARD is not in Kconfig.host.
> 
> What about adding that to your patch and remove the ifeq():
> 
> -- >8 --
> diff --git a/Kconfig.host b/Kconfig.host
> index bb6e116e2a..b532358854 100644
> --- a/Kconfig.host
> +++ b/Kconfig.host
> @@ -35,3 +35,6 @@ config VIRTFS
> 
>  config PVRDMA
>      bool
> +
> +config SMARTCARD
> +    bool
> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
> index 555e09377b..b3292a5cc9 100644
> --- a/hw/usb/Kconfig
> +++ b/hw/usb/Kconfig
> @@ -90,7 +90,7 @@ config USB_BLUETOOTH
>  config USB_SMARTCARD
>      bool
>      default y
> -    depends on USB
> +    depends on SMARTCARD && USB
> 
>  config USB_STORAGE_MTP
>      bool

Yes, this is a good idea.

Paolo

> ---
> 
>>>> +common-obj-$(call
>>>> lor,$(CONFIG_CCID_PASSTHRU),$(CONFIG_CCID_EMULATED)) += smartcard.mo
>>>> +smartcard.mo-objs := $(call
>>>> lif,$(CONFIG_CCID_PASSTHRU),ccid-card-passthru.o) \
>>>> +                     $(call
>>>> lif,$(CONFIG_CCID_EMULATED),ccid-card-emulated.o)
>>>>    smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
>>>>    smartcard.mo-libs := $(SMARTCARD_LIBS)
>>>>    endif
>>>> +endif
>>>>      ifeq ($(CONFIG_POSIX),y)
>>>>    common-obj-$(CONFIG_USB_STORAGE_MTP)  += dev-mtp.o
>>>>
>>>
>>
> 



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

end of thread, other threads:[~2019-12-10 13:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10  7:20 [PATCH] hw/usb: Introduce Kconfig switches for the CCID card devices Thomas Huth
2019-12-10  7:43 ` Philippe Mathieu-Daudé
2019-12-10  8:11   ` Thomas Huth
2019-12-10 13:27     ` Philippe Mathieu-Daudé
2019-12-10 13:32       ` Paolo Bonzini

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.