diff mbox series

Allow building hid.ko as an "external" module

Message ID 20200518113742.21718-1-cristian.klein@elastisys.com (mailing list archive)
State New
Delegated to: Jiri Kosina
Headers show
Series Allow building hid.ko as an "external" module | expand

Commit Message

Cristian Klein May 18, 2020, 11:37 a.m. UTC
For quickly testing USB HID quirks with a larger community, it is useful
to be able to build hid.ko as an external module, e.g., against the
source code of the running kernel.

Before this patch this failed as follows:
```
$ make -C /lib/modules/$(uname -r)/build M=$PWD/drivers/hid
make: Entering directory '/usr/src/linux-headers-5.3.0-51-generic'
  CC [M]  /home/cklein/linux/drivers/hid/i2c-hid/i2c-hid-core.o
  CC [M]  /home/cklein/linux/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.o
  LD [M]  /home/cklein/linux/drivers/hid/i2c-hid/i2c-hid.o
  CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/init.o
  CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/hbm.o
  CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/client.o
  CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/bus.o
  CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/dma-if.o
  CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/client-buffers.o
  LD [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/intel-ishtp.o
  CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ipc/ipc.o
/home/cklein/linux/drivers/hid/intel-ish-hid/ipc/ipc.c:12:10: fatal error: client.h: No such file or directory
   12 | #include "client.h"
      |          ^~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:290: /home/cklein/linux/drivers/hid/intel-ish-hid/ipc/ipc.o] Error 1
make[1]: *** [scripts/Makefile.build:519: /home/cklein/linux/drivers/hid/intel-ish-hid] Error 2
make: *** [Makefile:1656: _module_/home/cklein/linux/drivers/hid] Error 2
make: Leaving directory '/usr/src/linux-headers-5.3.0-51-generic'
```
---
 drivers/hid/intel-ish-hid/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Kosina June 19, 2020, 7:14 a.m. UTC | #1
On Mon, 18 May 2020, Cristian Klein wrote:

> For quickly testing USB HID quirks with a larger community, it is useful
> to be able to build hid.ko as an external module, e.g., against the
> source code of the running kernel.
> 
> Before this patch this failed as follows:
> ```
> $ make -C /lib/modules/$(uname -r)/build M=$PWD/drivers/hid
> make: Entering directory '/usr/src/linux-headers-5.3.0-51-generic'
>   CC [M]  /home/cklein/linux/drivers/hid/i2c-hid/i2c-hid-core.o
>   CC [M]  /home/cklein/linux/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.o
>   LD [M]  /home/cklein/linux/drivers/hid/i2c-hid/i2c-hid.o
>   CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/init.o
>   CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/hbm.o
>   CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/client.o
>   CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/bus.o
>   CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/dma-if.o
>   CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ishtp/client-buffers.o
>   LD [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/intel-ishtp.o
>   CC [M]  /home/cklein/linux/drivers/hid/intel-ish-hid/ipc/ipc.o
> /home/cklein/linux/drivers/hid/intel-ish-hid/ipc/ipc.c:12:10: fatal error: client.h: No such file or directory
>    12 | #include "client.h"
>       |          ^~~~~~~~~~
> compilation terminated.
> make[2]: *** [scripts/Makefile.build:290: /home/cklein/linux/drivers/hid/intel-ish-hid/ipc/ipc.o] Error 1
> make[1]: *** [scripts/Makefile.build:519: /home/cklein/linux/drivers/hid/intel-ish-hid] Error 2
> make: *** [Makefile:1656: _module_/home/cklein/linux/drivers/hid] Error 2
> make: Leaving directory '/usr/src/linux-headers-5.3.0-51-generic'
> ```

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/hid/intel-ish-hid/Makefile b/drivers/hid/intel-ish-hid/Makefile
index f0a82b1c7..db4974c43 100644
--- a/drivers/hid/intel-ish-hid/Makefile
+++ b/drivers/hid/intel-ish-hid/Makefile
@@ -23,4 +23,4 @@  intel-ishtp-hid-objs += ishtp-hid-client.o
 obj-$(CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ishtp-loader.o
 intel-ishtp-loader-objs += ishtp-fw-loader.o
 
-ccflags-y += -I $(srctree)/$(src)/ishtp
+ccflags-y += -I $(src)/ishtp