Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4033771ybg; Fri, 25 Oct 2019 12:22:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9cKqBlNuP3hdvObU1kgaJaRP4zTbeWCFl6q8d8yiKsRAm0ie9MAieuRPC7Vqp71yoXPeF X-Received: by 2002:a17:906:40d:: with SMTP id d13mr4907404eja.272.1572031322988; Fri, 25 Oct 2019 12:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031322; cv=none; d=google.com; s=arc-20160816; b=wtQyp9906zNwy9hGEd1eQ//WuxOWVGXO9614SBoGE1S5VVdUYnFoD0SeXrJNUk2Fit dS3DuibkE0DMLNB1KT4gkJew5B21netQBleRGjebgiSC/MhVbjidGAsWIkT0IvSnGqQV WO3csEcxcb948esRTFS5rzDxzIJzutCpOAs4N8vIe7TnPIGqHEAph3NCZ/x51Ggp5UBh FkgZKbbYFI1LNg2NRohRrzD+1dPnvXRHneXobwVb3HBH8Jo9sW8Cm2IyvccMv94TJH0c /SsMUIGdncBUHQTgEAkmIPvLCgAbQqL2WQ6Vcl7/Sfych3jBYxc6Ock/lI7cEwv2bcQx QSrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=26nlmZpZwSTIGzW2rf35rnNzzw2vFUJOreV2zfU8qCw=; b=DkNiBvD5N3xOICnAumdxjlm3V3Xmt9WccsZMDzBmWt+8B/4RSZ38UMqCcoqdNvvgC0 PjBMSnc1dayavkJSZscRELemyzXxX5Iu41SVv0CHeQ9Spt258458ACptQlaBWZCiqGMS EXeYHx99R+agE1fc2a6kJtxSqPNmmnTZTk7iDca91P5v/p2640uf0f3qEOlLQgvM6DGw l8lcYzraYTjBb8URzIuYlbu8VgdohbNzSAECKIqNmNJ+SONjIAIOBCLpBIM8E/EcAecC 6CVe0oxzuGZWdqaGHFw1cSMqVlN31MH512S+hMh5ipTCzkGJ36Zo3xeKthNOs0Ls9V+S 0THQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IZW4XV/I"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si2173392edf.309.2019.10.25.12.21.37; Fri, 25 Oct 2019 12:22:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IZW4XV/I"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390326AbfJYCiz (ORCPT + 99 others); Thu, 24 Oct 2019 22:38:55 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:36820 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728416AbfJYCiy (ORCPT ); Thu, 24 Oct 2019 22:38:54 -0400 Received: by mail-ot1-f67.google.com with SMTP id c7so860199otm.3; Thu, 24 Oct 2019 19:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=26nlmZpZwSTIGzW2rf35rnNzzw2vFUJOreV2zfU8qCw=; b=IZW4XV/InxPHxjR0HTsTFEbu0Gd30CHPlFktJ4V18fPaBdeLqbsjj34dVa37h1BwMu LChw1BjtsEq1kBAq5se55t5i00oBKadBPuIqMmfZpOqkdKY5Syj0OA+ghTil2Eeb8lpK TpoBoBjVkdIBDamsPTkGDrQY37ifF8y3ZnoM8CVigi7Q7Hb6rlRkSNo5kMnb0Oy47I/j z2p+JbJvBXqGKRrhBVAT6+GJ5+KVKgfhFTXTxk3LGaZX2XndzO4gpt4kMgVuopmwqcXF 3Z8nEbNHOc5YILAL+0HFjVXMR1QFpHcpW9llSq+1CZtIwBm0I3dp6rr2Kz9Y/djEpIxL UrJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=26nlmZpZwSTIGzW2rf35rnNzzw2vFUJOreV2zfU8qCw=; b=LfbiDMleTljiv0lCAvfpj10LrOBtnPUUo8Tk2XjuVYR4I0BTAbObC/Woh1mqn8MSV6 u9FHEKc6UDim9ekSIM57kQqofotXf9t+iFfo1TwT96NatSb9OEPeaYG2njgKGGWgLhlT IKPUH5N9Y3zvguMHXrmoALtmND3HTdGUnWliG/0VZFK/HjYHvsUGPT4QNyewALoVsGxI M0XuPaQ0qnksqs/Kh1F5vYbg3jAxiRJZ7BLH6hB5AJJ4VIjm2/66rCElNWtPy7doJ6x0 NBVYJ8CLIEFkGe6p7jO4VqPkQlBrfFNSaOprN0mGM5yiOF/hpWZljLFmwRAGhiLRD7Lk xAbA== X-Gm-Message-State: APjAAAVK89z7B1sOOqRsWBdxRsoAZsSIrbHJRjxkeD3592L6gbCg+3wf 4oqiB9ys8rlg6Rpa+s1dCd6SUxMhzCPDnNgJYnQ= X-Received: by 2002:a05:6830:18f7:: with SMTP id d23mr761081otf.205.1571971129473; Thu, 24 Oct 2019 19:38:49 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:648:0:0:0:0:0 with HTTP; Thu, 24 Oct 2019 19:38:46 -0700 (PDT) In-Reply-To: References: <20191020090800.GA2778@light.dominikbrodowski.net> <20191021160952.GA229204@google.com> <20191021184701.GA1823@light.dominikbrodowski.net> From: "Michael ." Date: Fri, 25 Oct 2019 13:38:46 +1100 Message-ID: Subject: Re: PCI device function not being enumerated [Was: PCMCIA not working on Panasonic Toughbook CF-29] To: Bjorn Helgaas Cc: Dominik Brodowski , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Trevor Jacobs , Kris Cleveland , Jeff , Morgan Klym Content-Type: multipart/mixed; boundary="000000000000c53b200595b30c7c" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000c53b200595b30c7c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Here's the resulting output of the failed compilation of 5.4rc1 with the patch applied to quirks.c: CC drivers/pci/quirks.o drivers/pci/quirks.c:3039:1: error: expected identifier or =E2=80=98(=E2=80= =99 before =E2=80=98-=E2=80=99 token 3039 | -static void ricoh_mmc_fixup_rl5c476(struct pci_dev *dev) | ^ drivers/pci/quirks.c:3068:1: error: expected identifier or =E2=80=98(=E2=80= =99 before =E2=80=98-=E2=80=99 token 3068 | -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C476, ricoh_mmc_fixup_rl5c476); | ^ drivers/pci/quirks.c:3069:1: error: expected identifier or =E2=80=98(=E2=80= =99 before =E2=80=98-=E2=80=99 token 3069 | -DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C476, ricoh_mmc_fixup_rl5c476); | ^ drivers/pci/quirks.c:3070:1: error: expected identifier or =E2=80=98(=E2=80= =99 before =E2=80=98-=E2=80=99 token 3070 | - | ^ In file included from ./include/linux/export.h:44, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from drivers/pci/quirks.c:16: drivers/pci/quirks.c:3120:74: error: =E2=80=98ricoh_mmc_fixup_r5c832=E2=80= =99 undeclared here (not in a function) 3120 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | ^~~~~~~~~~~~~~~~~~~~~~ ./include/linux/compiler.h:302:53: note: in definition of macro =E2=80=98__= ADDRESSABLE=E2=80=99 302 | __PASTE(__addressable_##sym, __LINE__) =3D (void *)&sym; | ^~~ ./include/linux/pci.h:1911:2: note: in expansion of macro =E2=80=98__DECLARE_PCI_FIXUP_SECTION=E2=80=99 1911 | __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/pci.h:1956:2: note: in expansion of macro =E2=80=98DECLARE_PCI_FIXUP_SECTION=E2=80=99 1956 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pci/quirks.c:3120:1: note: in expansion of macro =E2=80=98DECLARE_PCI_FIXUP_EARLY=E2=80=99 3120 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | ^~~~~~~~~~~~~~~~~~~~~~~ make[5]: *** [scripts/Makefile.build:266: drivers/pci/quirks.o] Error 1 make[4]: *** [scripts/Makefile.build:509: drivers/pci] Error 2 make[3]: *** [Makefile:1649: drivers] Error 2 make[2]: *** [debian/rules:6: build] Error 2 dpkg-buildpackage: error: debian/rules build subprocess returned exit statu= s 2 make[1]: *** [scripts/Makefile.package:77: deb-pkg] Error 2 make: *** [Makefile:1427: deb-pkg] Error 2 root@michael-desktop:/home/michael/Debian/linux-5.4-rc4# Please also find attached the patched quirks.c file Cheers. Michael On 25/10/2019, Michael . wrote: > I just tried to do a kernel compile on Debian Sid running kernel 5.2. > Downloaded 4.19.80 modded the quirks file, please find modded file > attached, and started the compile. > About an hour into it it fails with: > CC drivers/pci/quirks.o > drivers/pci/quirks.c:2945:1: error: expected identifier or =E2=80=98(=E2= =80=99 before =E2=80=98-=E2=80=99 > token > 2945 | -static void ricoh_mmc_fixup_rl5c476(struct pci_dev *dev) > | ^ > drivers/pci/quirks.c:2974:1: error: expected identifier or =E2=80=98(=E2= =80=99 before =E2=80=98-=E2=80=99 > token > 2974 | -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, > PCI_DEVICE_ID_RICOH_RL5C476, ricoh_mmc_fixup_rl5c476); > | ^ > drivers/pci/quirks.c:2975:1: error: expected identifier or =E2=80=98(=E2= =80=99 before =E2=80=98-=E2=80=99 > token > 2975 | -DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, > PCI_DEVICE_ID_RICOH_RL5C476, ricoh_mmc_fixup_rl5c476); > | ^ > drivers/pci/quirks.c:2976:1: error: expected identifier or =E2=80=98(=E2= =80=99 before =E2=80=98-=E2=80=99 > token > 2976 | - > | ^ > In file included from ./include/linux/export.h:45, > from ./include/linux/linkage.h:7, > from ./include/linux/kernel.h:7, > from drivers/pci/quirks.c:16: > drivers/pci/quirks.c:3026:74: error: =E2=80=98ricoh_mmc_fixup_r5c832=E2= =80=99 > undeclared here (not in a function) > 3026 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, > PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); > | > ^~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/compiler.h:296:53: note: in definition of macro > =E2=80=98__ADDRESSABLE=E2=80=99 > 296 | __PASTE(__addressable_##sym, __LINE__) =3D (void *)&sym; > | ^~~ > ./include/linux/pci.h:1847:2: note: in expansion of macro > =E2=80=98__DECLARE_PCI_FIXUP_SECTION=E2=80=99 > 1847 | __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/pci.h:1892:2: note: in expansion of macro > =E2=80=98DECLARE_PCI_FIXUP_SECTION=E2=80=99 > 1892 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/pci/quirks.c:3026:1: note: in expansion of macro > =E2=80=98DECLARE_PCI_FIXUP_EARLY=E2=80=99 > 3026 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, > PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); > | ^~~~~~~~~~~~~~~~~~~~~~~ > make[5]: *** [scripts/Makefile.build:304: drivers/pci/quirks.o] Error 1 > make[4]: *** [scripts/Makefile.build:544: drivers/pci] Error 2 > make[3]: *** [Makefile:1046: drivers] Error 2 > make[2]: *** [debian/rules:4: build] Error 2 > dpkg-buildpackage: error: debian/rules build subprocess returned exit sta= tus > 2 > make[1]: *** [scripts/package/Makefile:75: deb-pkg] Error 2 > make: *** [Makefile:1359: deb-pkg] Error 2 > root@michael-desktop:/home/michael/Debian/linux-4.19.80# > > I will try later with the latest 5.4-rc to see if the diff is > incompatible with 4.19. > Cheers. > Michael > > On 22/10/2019, Michael . wrote: >> Thanks Domunik I'll get onto this and report back the results. >> >> On 22/10/2019, Dominik Brodowski wrote: >>> On Tue, Oct 22, 2019 at 05:17:12AM +1100, Michael . wrote: >>>> Thank you Dominik for looking at this for us and passing it on. >>>> >>>> Good morning Bjorn, thank you also for looking into this for us and >>>> thank you for CCing us into this as non of us are on the mailing list. >>>> One question how do we apply this patch or is this for Dominik to try? >>> >>> That's for you and/or other users of this hardware; I cannot test this >>> myself, sorry. As to how to apply the patch: you'd need to apply the >>> patch >>> for the linux kernel sources, and then build a custom kernel. Some hint= s >>> on >>> that (details depend on the distribtion): >>> >>> https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel >>> https://wiki.ubuntu.com/KernelTeam/GitKernelBuild >>> https://wiki.archlinux.org/index.php/Kernels/Arch_Build_System >>> https://kernelnewbies.org/KernelBuild >>> >>> Best, >>> Dominik >>> >> > --000000000000c53b200595b30c7c Content-Type: text/x-csrc; charset="UTF-8"; name="quirks.c" Content-Disposition: attachment; filename="quirks.c" Content-Transfer-Encoding: base64 X-Attachment-Id: file0 Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEdQTC0yLjAKLyoKICogVGhpcyBmaWxlIGNvbnRh aW5zIHdvcmstYXJvdW5kcyBmb3IgbWFueSBrbm93biBQQ0kgaGFyZHdhcmUgYnVncy4KICogRGV2 aWNlcyBwcmVzZW50IG9ubHkgb24gY2VydGFpbiBhcmNoaXRlY3R1cmVzIChob3N0IGJyaWRnZXMg ZXQgY2V0ZXJhKQogKiBzaG91bGQgYmUgaGFuZGxlZCBpbiBhcmNoLXNwZWNpZmljIGNvZGUuCiAq CiAqIE5vdGU6IGFueSBxdWlya3MgZm9yIGhvdHBsdWdnYWJsZSBkZXZpY2VzIG11c3QgX05PVF8g YmUgZGVjbGFyZWQgX19pbml0LgogKgogKiBDb3B5cmlnaHQgKGMpIDE5OTkgTWFydGluIE1hcmVz IDxtakB1Y3cuY3o+CiAqCiAqIEluaXQvcmVzZXQgcXVpcmtzIGZvciBVU0IgaG9zdCBjb250cm9s bGVycyBzaG91bGQgYmUgaW4gdGhlIFVTQiBxdWlya3MKICogZmlsZSwgd2hlcmUgdGhlaXIgZHJp dmVycyBjYW4gdXNlIHRoZW0uCiAqLwoKI2luY2x1ZGUgPGxpbnV4L3R5cGVzLmg+CiNpbmNsdWRl IDxsaW51eC9rZXJuZWwuaD4KI2luY2x1ZGUgPGxpbnV4L2V4cG9ydC5oPgojaW5jbHVkZSA8bGlu dXgvcGNpLmg+CiNpbmNsdWRlIDxsaW51eC9pbml0Lmg+CiNpbmNsdWRlIDxsaW51eC9kZWxheS5o PgojaW5jbHVkZSA8bGludXgvYWNwaS5oPgojaW5jbHVkZSA8bGludXgvZG1pLmg+CiNpbmNsdWRl IDxsaW51eC9pb3BvcnQuaD4KI2luY2x1ZGUgPG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